public function insert_id($_sql, $column = '', $data = array())
{
try {
if ($this->dbtype == 'oci') {
$_sql .= ' RETURNING ' . $column . ' INTO :primary_key';
}
$stmt = $this->prepare($_sql);
if (!empty($data)) {
foreach (array_keys($data) as $key) {
$stmt->bindParam(':' . $key, $data[$key], PDO::PARAM_STR, strlen($data[$key]));
}
}
if ($this->dbtype == 'oci') {
$stmt->bindParam(':primary_key', $primary_key, PDO::PARAM_INT, 11);
}
$stmt->execute();
if ($this->dbtype == 'oci') {
return $primary_key;
} else {
return $this->lastInsertId();
}
} catch (PDOException $e) {
trigger_error($e->getMessage());
}
return false;
}