Open hkdobrev opened 9 years ago
The SQL statements that Base generates are quite simple. I wonder if, apart from the INSERT discussed in #3, there are other statements that might be incompatible with the other engines that PDO supports.
PDO does support a big list of engines. Each with their own differences - subtle or not.
Some differences from the top of my head:
LIMIT
or OFFSET
, instead it uses TOP
and subqueries.ORDER BY
.Some resources:
Thanks! Then, perhaps, we should see which engines are compatible (or could become compatible after minor changes) with the current implementation and list them in the readme. SQLite might be one of them. We should also think about running the test suites on these engine.
p.s. Idiorm states that it supports SQLite, MySQL, Firebird and PostgreSQL and it has no drivers. Perhaps base should be able to support these as well.
Idiorm has things such as:
LIMIT
or TOP
- https://github.com/j4mie/idiorm/blob/1db83c9fee8a6418d92fd6fa87447d31faf88842/idiorm.php#L346-L361Also it has options for these: https://github.com/j4mie/idiorm/blob/1db83c9fee8a6418d92fd6fa87447d31faf88842/idiorm.php#L70-L71
Another approach is having a syntax agnostic codebase for the query builder which does not build SQL strings, but just composes the syntax in objects/arrays and then adapters for the different SQL implementations carry out the syntax building. Examples:
PDO
does allow you to use a number of database engines like Postgres, MSSQL, MySQL, SQLite etc.However it won't automagically convert your SQL syntax for the engine used.
The SQL syntax produced by Base is MySQL-only (except quite generic queries).
Nowhere in the readme or
composer.json
is specified it is MySQL-only.I guess it would be easy to create adapters for more database engines and this could be a nice improvement if there is enough demand.