function db_insert($query, $seq) { $q = pg_query($query); if (!$q) { return null; } return db_select_one_field("SELECT currval('" . db_driver_quote($seq) . "');"); }
function db_quote($value) { if (is_null($value)) { return 'NULL'; } if (is_numeric($value)) { return $value; } if (is_array($value) and count($value) == 1) { return $value[0]; } return "'" . db_driver_quote($value) . "'"; }