Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[NOVICE] populating arrays with default values

From: G. J. Walsh <gjwalsh(at)dscdirectionalservices.com>
Date: Wed Nov 14 2007 - 15:09:37 EST


I come from a long background with C and isam. Moving into php and postgresql is therefore not all that strange, but I suffer with the comparative lack of structure at times.

I deal with a lot of psych scoring and am establishing tables which will contain the response patterns for each individual test within a battery. In defining this, I plan on something like: ans CHAR(1) ARRAY[192]

But I learned that PostgreSQL does not 'enforce' this. I would rather have an '?' placed in each of the 192 array elements (and thereby constrain with NOT NULL) to indicate lack of a response (the default) when the test records are first established for the client.

Because the client does not need to complete a test at one sitting, but must do so before tackling another test in his or her battery, I need to 'see' where things stand test by test at each login.

I can certainly write php script to fill the array as each record is established - clumsy the first time around, but pretty efficient after that - just an include function. There is apparently no other way of defining (inserting) a default value for array elements.

Am I correct in my approach to this?

Thanks for any insight .....

George

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend Received on Wed Nov 14 15:10:17 2007
Do you need help?X

This archive was generated by hypermail 2.1.8 : Thu Jun 19 2008 - 00:03:55 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library