Subject | Re: [firebird-php] Inserting NULLs as parameter |
---|---|
Author | Jochem Maas |
Post date | 2008-04-13T18:55:10Z |
Jiri Cincura schreef:
one way to tackle this is use an insert trigger that sets
the new.id (from the relevant generator) when the given insert id
is not set ... and change your query to:
update or insert into polls (question, visible) values (?, ?) returning new.id
which means in effect using 2 queries instead of 1.
alternatively if you wnat to stick with a single query then you
have to 'pre-generate' the id.
> Hello,the field doesn't allow a NULL, that's why you get the error.
>
> I have a simple function in PHP:
> @fbird_query('update or insert into polls (id, question, visible)
> values (?, ?, ?) returning new.id', $this->id, $this->question,
> $this->visible);
>
> and when i.e. id param is null (indicating, that this is new, unsaved
> object) I get error "Parameter 1: non-empty value required in".
>
> Is there any way to use parameters and nulls?
one way to tackle this is use an insert trigger that sets
the new.id (from the relevant generator) when the given insert id
is not set ... and change your query to:
update or insert into polls (question, visible) values (?, ?) returning new.id
which means in effect using 2 queries instead of 1.
alternatively if you wnat to stick with a single query then you
have to 'pre-generate' the id.
>