I need to execute this query to find out the next auto_increment value that will be used by MySQL for a particular table.
find_by_sql ["select auto_increment from information_schema.tables where
table_schema = ? and table_name = ? and auto_increment is not null", db_name, tbl_name]
How to invoke this particular query? This works on any model that I invoke it with returning an array of size 1 containing the object of the model. Edit: The object contains a hash named attributes which contains the auto_increment value as desired.
Are there any other ways to run such generic queries ? Would like to know if a change in the whole approach of using find_by_sql is possible to solve the original problem as well.