[Solar-talk] Model class exception where column name = "key"

Rodrigo Moraes rodrigo.moraes at gmail.com
Wed Dec 12 10:21:00 CST 2007


On Dec 12, 2007 2:09 PM, Cruz, Darwin wrote:
> I've run into an issue where if i have a table in the database with a
> field that is named "key" i'm getting an exception error when i call a
> fetchAll() to the model.
>
> error:  SQLSTATE[42000]: Syntax error or access violation: 1064 You have
> an error in your SQL syntax;
>
> I changed to column name from "key" to "mykey" and it works fine.  Just
> wanted to let people know.

Hey,
This occurs because Solar_Sql won't let you use reserved words from
the supported adapters. Meaning: all reserved words from all supported
databases are blacklisted in Solar_Sql_Reserved. Take a look there.

-- rodrigo


More information about the Solar-talk mailing list