Welcome Guest, Not a member yet? Register   Sign In
PostGreSQL $this->db->insert_id()
#2

[eluser]Pascal Kriete[/eluser]
I don't have a postgre setup to test on, but that looks good to me. It could check for php5 and return 0 for php 4 (anything smaller than 8 should work).

A quick look at how cake and zend do it makes me think that CI might to be taking the complicated (read: übercompatible) route again.

The other two essentially do:
Code:
$seq = $column ? $table.'_'.$column.'_seq' : $table.'_seq';

$query = "SELECT CURRVAL({$seq}) as ins_id";
$query = $this->query($sql);
$row = $query->row();
return $row->ins_id;


Messages In This Thread
PostGreSQL $this->db->insert_id() - by El Forum - 09-10-2008, 02:53 PM
PostGreSQL $this->db->insert_id() - by El Forum - 09-10-2008, 03:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB