hi Harro, PDO driver is problem and not work with update and delete with limit and insert, i write pgsql driver (like as write mssql driver for windows) and work fine for me.
I have no Postgresql experience, so I don't know that the difference is.
From what I can see
pg_escape_identifieris for identifiers (table names, column names, etc, the backtick in MySQL) pg_escape_literal is for strings (as in insert values, etc)
bytea is like literal but for bytea columns, and literal should be used instead of escape.
Would you like to contribute your drivers to Fuel? It would be great if we have better support for other platforms.
hi Harro, how can i send you my psql driver files Orm (model.php, query.php) DB (core\classes\db.php, core\classes\database\connection.php) psql (folder)
With 1.9/dev there is no need to modify any of these files.
You can create a /fuel/core/classes/database/postgresql directory, and in there a connection.php for stuff you need to overload from the base class. If you need custom builder code, you can create builder classes in /fuel/core/classes/database/postgresql/builder, and again overload what you need.
You can also create a /fuel/core/classes/database/postgresql/schema.php, and assign it to the _schema property in your custom connection.php's constructor, so you can use dbutil methods with Postgres.
The database platform used should be completely transparent for the underlying layers, be it DB or ORM.
done! but in orm/classes/query in build_query function $query it must \Fuel\Core\Database_Query_Builder_Where object and i create postgresql/build/where.php (for field convert type without DB::expr()) and for now i use (/*\Fuel\Core\Database_Query_Builder_Where*/) $query object and work fine! one more question : how i send auto increment field to insert (postgresql/build/insert.php ) for return insert id with RETURNING id (reason i change other file for send return key in option of get, get_one, execute,...); thanks!
\Fuel\Core\Database_Query_Builder_Where should not be a problem, as your postgres/build/where should extend this class, and type hinting works for extended classes. Same for the other query classes, they should all extend the base class.
As Postgresql doesn't have AUTOINCREMENT, it doesn't have a set mechanism to get it's value returned after an INSERT. There are three possible options:
1. After the INSERT, run "SELECT LASTVAL();" to get the last generated sequence number.
2. Alter the INSERT by adding "RETURNING <pk>"; to it. This does require you to know what the PK column name (or names for a compound key) is, which isn't easy to find out in the DB class.
3. After the INSERT, run "SELECT CURRVAL(<sequence-name>);". Downside is obviously that you need to know the sequence name for that table, which isn't really possible as well.
So I think 1 is safest. Your driver need to extend Database_Connection::query(), so you can replace "$this->_connection->lastInsertId()," by the result of the LASTVAL query.