Skip to content

Conversation

@dm-coding
Copy link

  1. In the first instance, an invalid database configuration can sometimes result in a failure to connect to the SQLite database without an error. As no error is caught by CakePhP, PhP itself throws a fatal error on line 221 as no $connection object exists. This bug fix forces the _execute() function to check that the database is in fact connected - if not, CakePhP gracefully throws a helpful error message to the user.

Reported here: http://stackoverflow.com/questions/4779007/cakephp-and-sqlite-fatal-error-call-to-a-member-function-query-on-a-non-obje, here: http://stackoverflow.com/questions/7107996/fatal-error-call-to-a-member-function-query-on-a-non-object-in-var-www-likes, and here: http://stackoverflow.com/questions/7572091/error-while-trying-to-connect-to-sqlite3-database-from-cakephp
To reproduce: set $config['connect'] to an invalid value.

  1. In the second instance, the sqlite driver ignores SQL views. Changing the SQL query to read "SELECT name FROM sqlite_master WHERE type='table' OR type='view'" where it previously read just "type='table'" fixes this problem.

All the best,

Daniel

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test case is easier to read than an inline comment, and would help prevent a future regression.

@AD7six
Copy link
Member

AD7six commented Feb 17, 2014

In the first instance, an invalid database configuration can sometimes result in a failure to connect to the SQLite database without an error.

Is this point still relevant? if the config is invalid what should happen is to fail early so the developer can fix their config.

I've created a seperate 1 line PR (#100) for the second point.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants