summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-02-20 19:23:06 +0100
committerTimothy Warren <tim@timshomepage.net>2012-02-20 19:23:06 +0100
commit07b660b56dcf608b64fc1811c602c4072c276e70 (patch)
tree4aba941475d5affdf2a81af241202c31f01065fa /system/database/drivers
parent53d109dbd831506c4b9ca77f10bc1b2dba9c28d5 (diff)
Fixed insert_id possibly returning 0
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/interbase/interbase_driver.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index fcefa6d97..4044c4529 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -309,7 +309,12 @@ class CI_DB_interbase_driver extends CI_DB {
*/
public function insert_id($generator_name, $inc_by=0)
{
- return ibase_gen_id('"'.$generator_name.'"', $inc_by);
+ //If a generator hasn't been used before it will return 0
+ if($id = ibase_gen_id('"'.$generator_name.'"', $inc_by) !== 0)
+ {
+ return $id;
+ }
+ return ibase_gen_id('"'.$generator_name.'"', 1);
}
// --------------------------------------------------------------------