Welcome Guest, Not a member yet? Register   Sign In
Some "write" commands returning values
#1

[eluser]Claudiu CISMARU[/eluser]
I don't use active records in my applications.

I usually use Postgres SQL as database and I encountered a problem. Postgres has the ability to return field values after the INSERT command (that were computed in the backend, like serial values). The problem is that Codeigniter forces returning TRUE on "write" commands, like INSERT.

I don't like to mix db class calls with non-active records work, like using db->last_id() or similar features, instead I want to get the values like they were returned by a "read" command like SELECT.

In order to achieve this I found a quick hack (after reading the source code of DB_driver): I add at the start of INSERT command a closed comment, supported by Postgres, like: /* */. But I don't want to rely on this "hack" in the future and will be nice to have more control of the SQL queries in the future, in Codeigniter.




Theme © iAndrew 2016 - Forum software by © MyBB