Subject | Re: [firebird-php] Paramter Queries |
---|---|
Author | Lester Caine |
Post date | 2009-06-24T06:29:22Z |
Robert martin wrote:
have other more flexible ways of handling databases on PHP, so are not
prepared to spend time on something which only does half the job anyway.
ADOdb will provide cross database support for the SQL rather than just
some aspects of the data.
to ->
a parameter handle for a blob with a file, such as on image, and include
that in the params array.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
> I was using PDO for other Dbs but have switched to using theThe PDO stuff DOES need work, but those of us who actually use Firebird
> firebird/interbase drivers as the PDO firebird stuff was full of bugs.
have other more flexible ways of handling databases on PHP, so are not
prepared to spend time on something which only does half the job anyway.
ADOdb will provide cross database support for the SQL rather than just
some aspects of the data.
> Anyway I have got my php connecting, disconnecting and usingNot even with ADOdb, at the end of the day the dtat HAS to be converted
> transactions ok. However I am struggling with running queries that take
> parameters. In the PDO drivers I used a bindparam function to assign a
> value to a named parameter. However I cant see an equivelent function
> for the native drivers. I see that ibase_execute and ibase_Query take a
> 'bind_arg' list of parameters that fill in '?' indicated parameters.
>
> First Question
> I would like to do queries like "Update TableName SET Field1 =
> :Field1Param WHERE Field2 = :Field2param" and assing parameters by
> name. IS this at all possible ?
to ->
> If I do have to use "Update TableName SET Field1 = ? WHERE Field2 = ?" IAnyway ;)
> have found the following function (which I don't fully understand) that
> takes an array of params and runs an execute. I am using it and it
> appears to work well.
> function db_execute($stmt, $data)Looks about right - ADOdb does something similar.
> {
> if(!is_array($data))
> return ibase_execute($stmt,$data);
>
> $params = array();
> while( list($k,$v) = each($data) )
> $params[$k] = '$data['.$k.']';
> eval('$rc=ibase_execute($stmt,'.join(',',$params).');');
>
> return $rc;
> }
> If I am using the above and I want to pass in Blob (binary) data as 1 orAs you have found - this works. Or you can use ibase_blob_import to load
> more of the params I suspect the above will fail, correct?
>
> If so what should I do?
a parameter handle for a blob with a file, such as on image, and include
that in the params array.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php