core
core copied to clipboard
Multi_query feature
Suggest to add something like php built-in mysqli->multi_query function. Current implementation of DB class can't to handle sql with definition mysql triggers/stored routne with delimiter change because method query() execute only one query to first ocassion of ;
@SCIF it's a bit overdue, but what's the usecase you want to handle? Import an sql file?
I wanted to import triggers via migrations.
@FrenkyNet does Cabinet support multiple queries and PDO::nextRowset() ?
If so, this can be closed as addressed in 2.0.
@WanWizard I'm still looking for a good resource, haven't found one thus far
Resource, in the sense of an example of how it works?
That is pretty simple. There where you now do a fetchAll(), you loop over the resultsets and do a fetchAll() for each one. See example 1: http://php.net/manual/en/pdostatement.nextrowset.php
Big question here whether you build this into execute(), or if you use a fetchNextResult() method which you can call manually if there are more results.
This functionality is required when using stored procedures, so it's handy to have.
Hehe, I know how the next rowset function works, the biggest issue is; what should the api be like? I haven't thought of a nice way to do so. I'll keep my eyes out for it. Any suggestions are welcome! I'd be happy to code it up.
It's now implemented as a "one-stop-shop": executeSelect() receives the query, executes it, and returns the result.
So you either implement it in there (which would make the return value variable, since you'll have to return an array of results in case you have multiple), or split that into an execute() and a fetch() method, so you can do mutliple fetch() calls on a single query result.