Linking sequences with tables
Posted: Fri Jul 15, 2011 2:21 pm
hello,
Im using php and postgresql in order to create dynamic sequences and tables but I'm not sure how to link the table to the sequence. Any idea how?
Im using php and postgresql in order to create dynamic sequences and tables but I'm not sure how to link the table to the sequence. Any idea how?
Code: Select all
if($_REQUEST['fieldid'] == ''){
if ($seq = $adb->pquery("CREATE SEQUENCE cust_".$columnName."_seq INCREMENT BY 1 MINVALUE 1000 MAXVALUE 999999999999999999"))
{
$log->debug("********seq: $seq created***");
} else{
$log->debug("********seq: $seq failed***");
}
$qur ="CREATE TABLE cust_".$columnName."(
".$columnName."id integer NOT NULL,
".$columnName." varchar(200) NOT NULL,
presence integer NOT NULL default '1',
picklist_valueid integer NOT NULL default '0',
PRIMARY KEY (".$columnName."id))";
$adb->pquery($qur, array());
}