Rob

Looking at the code below and the docs on ibase_execute it does a
positional replace, so if you want to do a parambyname function you would
have to code it yourself (by stripping your :tags replacing them with ?
whilst retaing a 'map' of the order they are in if you get my drift)

as an aside the cryptic

while( list($k,$v) = each($data) ) {
 ....
}

I would consider is 'superceded' by

foreach ($data as $k => $v) {
 ...
}

Blobs are a separate issue and i'd look at ibase_blob_? functions first
http://us2.php.net/manual/en/function.ibase-blob-add.php

HTH

Neven



> Hi
>
> I am a PHP newbie.
>
> I was using PDO for other Dbs (MYSQL) but have switched to using the
> firebird/interbase drivers for Firebird as the PDO firebird stuff was
> full of bugs.
>
> Anyway I have got my php connecting, disconnecting and using
> 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 ?
>
> If I do have to use "Update TableName SET Field1 = ? WHERE Field2 = ?" I
> 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)
> {
>     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 or
> more of the params I suspect the above will fail, correct?
>
> If so what should I do?
>
> Sorry about the long email :)
>
> Thanks
>
> Rob
>
>
>
> _______________________________________________
> NZ Borland Developers Group Offtopic mailing list
> Post: [email protected]
> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
> Unsubscribe: send an email to [email protected] with
> Subject: unsubscribe
>
>
>


_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to