chriscct7
Repos
10
Followers
142
Following
46

Add Google Analytics to WordPress and be able to use all the powerful functions Google Analytics offers

119
60

Sell digital downloads through WordPress

811
433

Disables external data calls and loading for working on a purely local (i.e. no internet connection) WordPress site

457
52

Modern task runner for PHP

2531
288

Jigoshop is an eCommerce plugin for WordPress forged from years of experience by the WordPress Community & the Jigoshop Team.

249
127

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

61
9

Events

issue comment
Unable to execute a query from a remote server such as Planetscale

We've tested the PR orware submitted above and it works fantastically

Created at 2 weeks ago
issue comment
Add support for modifying the identifier delimiter

This works great! @catfan can this be put into a release?

Created at 2 weeks ago
issue comment
Unable to execute a query from a remote server such as Planetscale

Note, the lack of ANSI_QUOTES support is a known issue for Vitess: https://github.com/vitessio/vitess/issues/7769

Created at 2 weeks ago
issue comment
sql_mode='ANSI' doesn't allow ANSI syntax

We ran into this same thing while trying to migrate a project that used the Medoo PHP PDO wrapper library, see https://github.com/catfan/Medoo/issues/1044

Created at 2 weeks ago
issue comment
Unable to execute a query from a remote server such as Planetscale

It looks like Vitess doesn't support alternative SQL_MODES.

@catfan would it be okay if we submit a pr to allow for an option that would let PlanetScale (and similar MySQL compatible database types that don't support the changing of SQL_MODE) to use backticks instead of double quotes for these two cases?

Also, are there other places we need to account for the double quotes other than just the two places mentioned above if SQL_MODE can't be altered to ANSI_QUOTES?

Created at 2 weeks ago
issue comment
Unable to execute a query from a remote server such as Planetscale

Ok, so this seems to be done because of #578, where it discusses the use of double quotes instead of backticks to adhere to the SQL-92 standard

Created at 2 weeks ago
issue comment
Unable to execute a query from a remote server such as Planetscale

Ok, progress to report!

I have figured out that with the following modifications, the library starts working again on PlanetScale:

In the tableQuote function, changing it to return the column in a tick instead of in double quotes:

return '`' . $this->prefix . $table . '`';
                ```
                
and in the `columnQuote` function, doing the same:

return strpos($column, '.') !== false ? '' . $this->prefix . str_replace('.', '"."', $column) . '' : '' . $column . ''; ``` This has to be related to the handling of the MySQL ANSI_QUOTES

Created at 2 weeks ago
issue comment
Unable to execute a query from a remote server such as Planetscale

Notably, if I run

$app = $container['db']->query("SELECT `id` FROM `test_table` WHERE `id` = 1 LIMIT 1;")->fetchAll();

The result works with no error.

Created at 2 weeks ago
issue comment
Unable to execute a query from a remote server such as Planetscale

We're running into the same issue on PlanetScale.

The DB type is set to MySQL (hardcoded), and we don't use custom charsets, ports or ATTR cases.

When we run debug() and ask Medoo to output the SQL it thinks it should run, the SQL statement outputted is correct and runs fine if we execute it manually, but for some reason, that SQL statement is not the one Medoo is actually running.

We're able to replicate this with an extremely simple test case:

global $container;
$container['db'] = function () {
	return new Medoo(
		[
			'database_type' => 'mysql',
			'database_name' => DB_NAME,
			'server'        => DB_HOST,
			'username'      => DB_USER,
			'password'      => DB_PASSWORD,
			'option'        => array(
				\PDO::ATTR_ERRMODE       => \PDO::ERRMODE_EXCEPTION,
				\PDO::MYSQL_ATTR_SSL_CA   => dirname(__FILE__) . '/cacert.pem'
			)
		]
	);
};
$app = $container['db']->select( 'test_table',['id'], [ "LIMIT" => 1 ] );

where the test_table has 2 columns, an autoincrementing ID column and a VARCHAR value column

We also get a syntax error like the previous reporter.

We've confirmed the DB variables are correctly set (though we wouldn't get the syntax error but rather a connection failed error if they weren't) and we did the same for the cacert.pem to ensure it's in the right place (and again it would also trigger a different error if it was in the wrong place).

Note, if it helps, PlanetScale offers a free db plan, and we're able to replicate this issue on that plan as well.

Created at 2 weeks ago