I use Idiorm as ORM for MySQL with PHP.
I need to check if a table is created or not.
In SQL
This works in phpMyAdmin
SHOW TABLES LIKE 'ro_globals'
What I tried in Idiorm
ORM::raw_query("SHOW TABLES LIKE 'ro_globals'")->count()
Call to undefined method admin::count()
Is it possible to make this work with Idiorm? If so, how?
raw_query?find_manyis another method thancount, right? Check, which type of object you are getting back fromraw_query:var_dump( get_class( ORM::raw_query( '…' ) ) );to know which methods it provides. Just trying out random method names wouldn't lead to success. AlsoSELECTqueries do return data in a different format thanSHOWqueries.raw_query()is not to be used in this way, but withfor_table. Recently there was some code added to thedevelopbranch of Idiorm to support this style with a method calledraw_execute().