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

Already on GitHub? Sign in to your account

Column, and table names are not escaped in query with SQLite adapter. (1.6.9) #796

kmarshal opened this Issue Nov 22, 2013 · 1 comment


None yet
2 participants

I am getting error at vendor/propel/propel1/runtime/lib/query/ModelCriteria.php:1334
when trying to select rows form relation like:


$item could have many galleries, and every gallery have images.

Unable to execute SELECT statement [SELECT image.id, image.gallery_id, image.name, image.img, image.thumb, image.order, image.visible, image.created_at FROM image WHERE image.gallery_id=:p1] [wrapped: SQLSTATE[HY000]: General error: 1 near "order": syntax error]

In image table i have order field which is unescaped and is reserved word.
Is there any option to enable escaping column names for SQLite adapter? Or is it a bug?

Using: Propel 1.6.9
Db: SQLite
Propel configuration:

'propel' => array(
        'datasources' => array(
            'MyApp' => array(
                'adapter' => 'sqlite',
                'connection' => array(
                    'classname' => 'DebugPDO',
                    'dsn' => 'sqlite:/path/to/sqlite.db',
                    'user' => '',
                    'password' => '',
                    'options' => array(
                        'ATTR_PERSISTENT' => array('value' => false),
                    'attributes' => array(
                        'ATTR_EMULATE_PREPARES' => array(
                            'value' => true,
                    'settings' => array(
                        'charset' => null,
                        'queries' => null,
            'default' => 'MyApp',
        'generator_version' => '1.6.9',


I use the latest version of propel and i have a same error, please check your getting started :

setFirstName("Leo"); $author->setLastName("Tolstoy"); $author->save(); $book = new Book(); $book->setTitle("War & Peace"); // associate the $author object with the current $book $book->setAuthor($author); $book->save(); ## ?>

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group (id, name) VALUES (NULL, 'Anonymous')' at line 1' in /var/www/html/api/vendor/propel/propel/src/Propel/Runtime/Adapter/Pdo/PdoStatement.php:57 Stack trace: #0 /var/www/html/api/vendor/propel/propel/src/Propel/Runtime/Adapter/Pdo/PdoStatement.php(57): PDOStatement->execute(NULL) #1 /var/www/html/api/vendor/propel/propel/src/Propel/Runtime/Connection/StatementWrapper.php(194): Propel\Runtime\Adapter\Pdo\PdoStatement->execute(NULL) #2 /var/www/html/api/generated-classes/Base/Group.php(713): Propel\Runtime\Connection\StatementWrapper->execute() #3 /var/www/html/api/generated-classes/Base/Group.php(608): Base\Group->doInsert(Object(Propel\Runtime\Connection\ConnectionWrapper)) #4 /var/www/html/api/generated-classes/Base/Group.php(572): Base\Group->doSave(Object(Propel\Runti in /var/www/html/api/generated-classes/Base/Group.php on line 716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment