Facilitates the use of Firebird with object orientation without using the PDO
Add repositories and require section in composer.json project
{
"repositories": [
{
"url": "https://github.com/ricogmacedo/firebird-db.git",
"type": "git"
}
],
"require": {
"ricogmacedo/firebird-db": "1.0.8"
}
}
Create a namespace alias for ease of use
use \FirebirdDB\FirebirdDB as FirebirdDB;
Set the connection parameters
$ipAddr = "IP Address";
$pathFDB = "Path to .FDB file";
$nameFDB = "Name of .FDB file";
$userDB = "Firebird Server Username";
$passwDB = "Firebird Server Password";
$charConn = "Connection Charset";
Create a connection to the Firebird's Server
$dbh = new FirebirdDB($ipAddr, $pathFDB, $nameFDB, $userDB, $passwDB, $charConn);
Set a SQL Query
$sqlQuery = "SELECT FOO FROM BAR WHERE NAME = ?";
Build a statement with the SQL Query
$stmt = $dbh->build($sql);
Set the Query Param
$stmt->setParam('S', 'FOOBAR');
Run the Query
$stmt->run($conn);
Return all results
echo $stmt->getResult();
Returns only one result
echo $stmt->getOneResult();
Returns the query
echo $stmt->getQuery();