Firebird: prepared statement execute arguments issue

I have a database access app that I am adding Firebird support to. Right now I am hung up on the prepared statement class.

Calling the prepared statement creates a statement instance as well as registering the prepared statement query. The binding method adds the value(s) to an associative array variable ($params[]) in the prepared statement class.

$stmt = $dbh->prepare( 'select * from table where field_1=? and field_2=?' );
$stmt->bind( 'val_1' );
$stmt->bind( 'val_2' );
$result = $stmt->execute();

Firebird doesn’t have a native binding method and the values are bound via arguments in the ibase_execute() method. If successful, the execute method in the prepared statement class returns a result instance.

$stmt = ibase_execute( $prepare_instance, val_1, val_2, etc... );

if ( $stmt || is_resource( $stmt ) )
	return new firebird_resultset( $stmt );
else
    return false;

My issue is that if I implode the $params array, I have a string that is seen by the ibase_execute() method as a single string argument. I am stumped on how to populate the arguments. I keep getting a “Warning: ibase_execute(): Statement expects 2 arguments, 1 given” error.

Sponsor our Newsletter | Privacy Policy | Terms of Service