Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Table SQL is invalid #7

Open
ka215 opened this issue Jan 27, 2015 · 1 comment
Open

Create Table SQL is invalid #7

ka215 opened this issue Jan 27, 2015 · 1 comment
Labels

Comments

@ka215
Copy link
Owner

ka215 commented Jan 27, 2015

Using release v 1.10 I cannot create tables with the front-end plugin. It generates a popup saying “Create Table SQL is invalid.”

In method validate_create_sql from file lib/cdbt.class.php:

$org_sql = preg_replace("/\r|\n|\t/", '', $sql);

$reg_base = '/^(CREATE\sTABLE\s'. $table_name .'\s()(.*)$/iU';

The preg_replace call removes spacing characters if they are newlines. This causes the first preg_match to fail unnecessarily sometimes.

I’m currently using $org_sql = trim(preg_replace("/[\s|\r|\n|\t]+/", ' ', $sql)); instead to turn any run of these characters into a single normal space character and then remove any preceding whitespace characters.

I also use $reg_base = '/^(CREATE\sTABLE\s'. $table_name .'\s_()(._)$/iU'; because space between table name and opening parenthesis is not required in SQL.

It allows me to proceed, but am I using the right approach? Could doing this break something else?

validate_alter_sql has similar.

@ka215 ka215 added the invalid label Jan 27, 2015
@ka215
Copy link
Owner Author

ka215 commented Jan 28, 2015

Tried to fix the SQL validation process. During the current operation test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant