pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Jeremy Smith <jer@highboard.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Inserting NULL into Integer column
Date: Wed, 18 Feb 2004 13:44:47 -0700 (MST)
Message-ID: <Pine.LNX.4.33.0402181344110.3399-100000@css120.ihs.com> (raw)
In-Reply-To: <FKEOIJEHOIKIOEHCGNCLGEMGEDAA.jer@highboard.com>

On Wed, 18 Feb 2004, Jeremy Smith wrote:

> 
> 
> I've run into this kind of thing before.  IT helps if you have an array of
> all your fields like:
> 
> $fields = array("field1","field3","last_name");
> 
> and then you can foreach across the input:
> 
> foreach($fields as $f){
>   if (!$_POST[$f]){
>     $_POST[$f]='DEFAULT';
>   } else {
>     $_POST[$f] = "'".$_POST[$f]."'";
>   }
> }
> 
> Wow, great idea.  I will definitely do this, thanks alot.
> 
> 
> 
> Well, you might find yourself rewriting fair portions of your site, but
> usually you wind up with better code and better checking, so it's a bit of
> a trade off.
> 
> 
> No doubt that this is true.  Of course even without the better code and
> error checking, the extra features like stored procedures and automatic row
> locking was more than enough to make the switch worth it.
> 
> Thanks again!

You're welcome!  Enjoy getting to know Postgresql and all the great folks 
on the lists, I know I have.




view thread (10+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0402181344110.3399-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0402181344110.3399-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0402181344110.3399-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: scott.marlowe@ihs.com, jer@highboard.com
  Subject: Re: Inserting NULL into Integer column
  In-Reply-To: <Pine.LNX.4.33.0402181344110.3399-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox