PHP Classes

DBInterface: SQL Database abstraction layer

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 778 All time: 4,366 This week: 488Up
Version License Categories
dbinterface 1.0GNU Lesser Genera...XML, Databases
Description 

Author

This class can be used a SQL database abstraction layer.

It provides a single interface to access several types of SQL databases from the same class. Currently it supports MySQL, PostgreSQL, Interbase and Microsoft SQL server.

It can establish connections to the database server, execute SQL queries, retrieve query results, begin and end transactions, build and execute common types of SQL queries from a list of parameters, generate XML from query results, etc..

The values are retrived from global variables, you only must enter the name. If you want enter the entire format you can do it.

Notice: the field and the global variable must have the same name.

Example:

// In your config file
$CFG_SQL_db = 'dbname';
$CFG_SQL_usuario = 'user';
$CFG_SQL_clave = 'password';
$CFG_SQL_server = 'localhost';
$CFG_SQL_tipo = 'mysql';


// Mysql Code
$dbi = DBI::select('table','field1,field2',"field1 = '$value'");
while($record = $dbi->fetch_object() )
{
echo "Field1: $record->field1";
}

// PostgreSQL
$dbi = DBI::select('table','field1,field2',"field1 = '$value'");
while($record = $dbi->fetch_object() )
{
echo "Field1: $record->field1";
}

// XML Dump
$dbi = new DBI();
echo $dbi->XMLDump('select * from table', 'Records');


// Upload Images
// View Code
<input type="file" name="picture"/>


// Application code (the table has a field named picture with blob type)
dbi::insert('table','picture::blob');

Picture of Alejandro Vidal Quiroga
Name: Alejandro Vidal Quiroga <contact>
Classes: 1 package by
Country: Argentina Argentina
Age: 44
All time rank: 269934 in Argentina Argentina
Week rank: 214 Up2 in Argentina Argentina Up

  Files folder image Files (1)  
File Role Description
Plain text file dbi.inc.php Class Main FIle

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:778
This week:0
All time:4,366
This week:488Up