From: | <operationsengineer1(at)yahoo(dot)com> |
---|---|
To: | "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Error |
Date: | 2005-12-01 01:00:02 |
Message-ID: | 20051201010002.24481.qmail@web33303.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
--- Charley Tiggs <ctiggs(at)xpressdocs(dot)com> wrote:
> On Nov 30, 2005, at 3:35 PM,
> <operationsengineer1(at)yahoo(dot)com>
> <operationsengineer1(at)yahoo(dot)com> wrote:
>
> > i have the following code...
> >
> > // start
> >
> > $db = &ADONewConnection('postgres');
> > $db ->
> > Connect($db_string,$db_owner,$db_pw,$db_name);
> > // $db -> debug=true;
> >
> > $customer_name =
> > $form->GetInputValue('customer_name');
> > $customer_id = $db->getone("select
> > nextval('t_customer_cust_id_seq')");
> >
> > $sql_insert = <<<_EOSQL
> >
> > INSERT INTO t_customer (customer_id,
> > customer_name, customer_entry_date)
> > VALUES (?,?,?)
> >
> > _EOSQL;
> >
> > $result = $db->Execute($sql_insert,
> > array($customer_id, $customer_name,
> > $db->DBDate(time())));
> >
> > //end code
> >
> > it produces the following error...
> >
> > ERROR: column "customer_id" is of type integer but
> > expression is of type boolean HINT: You will need
> to
> > rewrite or cast the expression.
> >
> > any ideas?
>
> What's the value of $customer_id before you attempt
> the insert?
>
> right after $customer_id variable is set, do the
> following:
>
> echo $customer_id . '<br />';
> echo gettype ( $customer_id );
> exit;
>
the answer is... boolean.
> With ADO, a couple of times, I've run into a glitch
> where bindings
> changed types. Haven't taken the time to figure out
> why. Switching
> to autoExecute solves the problem:
>
> $insert_array = array ( 'customer_id' =>
> $db->getone("select nextval
> ('t_customer_cust_id_seq')"),
> 'customer_name' =>
> $form->GetInputValue('customer_name'),
> 'customer_entry_date' => $db->DBDate(time()))
>
> $result = $db->autoExecute ( 't_customer',
> $insert_array,
> 'INSERT' );
>
> Most likely, the reason it works for me is that I
> cleaned up my error
> when switching to the autoExecute method.
>
> Charley
Charley, i'm not sure. this code worked before i
upgraded both pgsql. at least i'm pretty darn sure it
did. then again, maybe i've lost my mind. having
said that, i don't see anything in the code that says
"boolean" to me.
i will try and cast it is an integer and let the adodb
maintainer know about this issue.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | operationsengineer1 | 2005-12-01 01:12:03 | Re: Error |
Previous Message | P G | 2005-12-01 00:39:51 | ODBC driver is broken |