Page 1 of 1

Linking sequences with tables

Posted: Fri Jul 15, 2011 2:21 pm
by itsmeagain
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?

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());
				}

Re: Linking sequences with tables

Posted: Wed Aug 10, 2011 10:09 pm
by Pyrite
What do you mean by dynamic sequences?

I use Postgres, and seqs are created/used automatically for serial types.

Not sure what you are asking.