|
|
@ -360,6 +360,8 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
|
|
|
|
|
|
|
|
|
|
|
|
public function InsertIntoDatabase()
|
|
|
|
public function InsertIntoDatabase()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
global $cphp_config, $database;
|
|
|
|
|
|
|
|
|
|
|
|
if(!empty($this->verify_query))
|
|
|
|
if(!empty($this->verify_query))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if($this->sId == 0)
|
|
|
|
if($this->sId == 0)
|
|
|
@ -498,9 +500,17 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
|
|
|
|
if($result = mysql_query_cached($query, 0, "", true))
|
|
|
|
if($result = mysql_query_cached($query, 0, "", true))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if($insert_mode == CPHP_INSERTMODE_INSERT)
|
|
|
|
if($insert_mode == CPHP_INSERTMODE_INSERT)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Temporary PDO implementation. */
|
|
|
|
|
|
|
|
if(!empty($cphp_config->database->pdo))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->sId = $database->lastInsertId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->sId = mysql_insert_id();
|
|
|
|
$this->sId = mysql_insert_id();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->RefreshData();
|
|
|
|
$this->RefreshData();
|
|
|
|
|
|
|
|
|
|
|
@ -509,6 +519,7 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$classname = get_class($this);
|
|
|
|
$classname = get_class($this);
|
|
|
|
|
|
|
|
var_dump($database->errorInfo());
|
|
|
|
throw new DatabaseException("Database insertion query failed in object of type {$classname}. Error message: " . mysql_error());
|
|
|
|
throw new DatabaseException("Database insertion query failed in object of type {$classname}. Error message: " . mysql_error());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|