cvs: pear /DB_DataObject DataObject.php
| From: | Alan Knowles | Date: | Tue, 24 Dec 2002 03:26:53 +0000 |
| Subject: | cvs: pear /DB_DataObject DataObject.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7955@lists.php.net to get a copy of this message | ||
alan_k Mon Dec 23 22:26:53 2002 EDT
Modified files:
/pear/DB_DataObject DataObject.php
Log:
added check for strings in key return = thx to Anthony Julou for spotting that one
Index: pear/DB_DataObject/DataObject.php
diff -u pear/DB_DataObject/DataObject.php:1.47 pear/DB_DataObject/DataObject.php:1.48
--- pear/DB_DataObject/DataObject.php:1.47 Sun Dec 15 22:29:16 2002
+++ pear/DB_DataObject/DataObject.php Mon Dec 23 22:26:52 2002
@@ -15,7 +15,7 @@
// | Author: Alan Knowles <alan@akbkhome.com>
// +----------------------------------------------------------------------+
//
-// $Id: DataObject.php,v 1.47 2002/12/16 03:29:16 alan_k Exp $
+// $Id: DataObject.php,v 1.48 2002/12/24 03:26:52 alan_k Exp $
//
// Object Based Database Query Builder and data store
//
@@ -487,7 +487,7 @@
* echo $object->insert();
*
* @access public
- * @return int
+ * @return mixed|false key value or false on failure
*/
function insert()
{
@@ -556,11 +556,19 @@
DB_DataObject::raiseError($r);
return false;
}
- if ($key && ($dbtype == 'mysql') &&
(@$options['ignore_sequence_keys'] != 'ALL')) {
- if (!@$options['ignore_sequence_keys'] ||
in_array($this->__table,@$options['ignore_sequence_keys'])) {
- $this->$key =
mysql_insert_id($connections[$this->_database_dsn_md5]->connection);
- }
+
+ if ($key &&
+ ($items[$key] & DB_DATAOBJECT_INT) &&
+ ($dbtype == 'mysql') &&
+ (@$options['ignore_sequence_keys'] != 'ALL') &&
+ (
+ !@$options['ignore_sequence_keys'] ||
+ in_array($this->__table,@$options['ignore_sequence_keys'])
+ ))
+ {
+ $this->$key =
mysql_insert_id($connections[$this->_database_dsn_md5]->connection);
}
+
$this->_clear_cache();
return $this->$key;
}