Part of the EllisLab Network

Bug Report

CI_DB_postgre_driver::insert_id() throws PHP fatal error

Date: 05/22/2007 Severity: Major
Status: Resolved Reporter: JAAulde
Version: 1.5.3
Keywords: Libraries, Database Class

Description

In system/database/drivers/postgre/postgre_driver.php CI_DB_postgre_driver defines a method, CI_DB_postgre_driver::_version()

CI_DB_postgre_driver:insert_id(), however, tries to invoke this method on line 233 as follows:

$v = version($this->conn_id);

This throws a PHP Fatal error for undefined function for obvious reasons.  Code on line 233 should read:

$v = $this->_version($this->conn_id);

Code Sample

<div class="codeblock"><code><span style="color: #000000">
<
span style="color: #FF8000">//With 3 rows in DB already, we run this code<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">db</span><span style="color: #007700">-></span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'field'</span><span style="color: #007700">,</span><span style="color: #DD0000">'value'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">db</span><span style="color: #007700">-></span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">'my_table'</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">db</span><span style="color: #007700">-></span><span style="color: #0000BB">insert_id</span><span style="color: #007700">(); </span>
</span>
</
code></div>

Expected Result

4

Actual Result

PHP Fatal error:  Call to undefined function version() in /var/www/CodeIgniter_1.5.3/system/database/drivers/postgre/postgre_driver.php on line 233

Comment on Bug Report

Page 1 of 1 pages
Posted by: JAAulde on 22 May 2007 1:47pm
no avatar

I hosed up the Code Sample…trying again:

//With 3 rows in DB already, we run this code
$this->db->set('field','value');
$this->db->insert('my_table');

echo
$this->db->insert_id();

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?