• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme ┬ę 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.