Linking sequences with tables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
itsmeagain
Forum Newbie
Posts: 1
Joined: Fri Jul 15, 2011 2:13 pm

Linking sequences with tables

Post 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());
				}
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Re: Linking sequences with tables

Post 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.
Post Reply