You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Note I am using the PDO connection with a mariadb database, this may be different for other connection implementation types or database types.
The documentation states that the DBUtil::create_database function returns the number of rows affected. Yet it if you run it with if_not_exist set to true and a database that already exists, it still returns 1 instead of 0. If you run a create if not exists query in the mariadb shell on a database that already exists, it returns 0 rows affected.
Example query to test: run DBUtil::create_database('test'); twice.
Debug::dump( DBUtil::create_database('test') ); results in the dump saying that this is a boolean and not an integer. is_bool( DBUtil::create_database('test') ); confirms it is a boolean as well.
Diving into the source code I followed it from DBUtil:create_database-> Database_Connection::schema->Schema::create_database->Database_Connection::query and then got lost in the PDO query implementation.
The text was updated successfully, but these errors were encountered:
willpoorman
changed the title
DBUtil::create_database Function Appears to a return a Boolean instead of an Int
DBUtil::create_database Function Appears to Return A Boolean Instead of An Int
Aug 8, 2017
*Note I am using the PDO connection with a mariadb database, this may be different for other connection implementation types or database types.
The documentation states that the DBUtil::create_database function returns the number of rows affected. Yet it if you run it with if_not_exist set to true and a database that already exists, it still returns 1 instead of 0. If you run a create if not exists query in the mariadb shell on a database that already exists, it returns 0 rows affected.
Example query to test: run
DBUtil::create_database('test');
twice.Debug::dump( DBUtil::create_database('test') );
results in the dump saying that this is a boolean and not an integer.is_bool( DBUtil::create_database('test') );
confirms it is a boolean as well.Diving into the source code I followed it from DBUtil:create_database-> Database_Connection::schema->Schema::create_database->Database_Connection::query and then got lost in the PDO query implementation.
The text was updated successfully, but these errors were encountered: