PHP Classes

DbUtils: Access and Manage MySQL, PostgreSQL or MS SQL

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 51%Total: 760 All time: 4,441 This week: 44Up
Version License PHP version Categories
dbutilspdo 1.9MIT/X Consortium ...5.1PHP 5, Databases
Description 

Author

This package can Access and Manage MySQL, PostgreSQL or Microsoft SQL database using PHP Data Objects (PDO).

It can establish database connections extending PDO class and perform several types of queries.

The class can execute arbitrary queries, select queries that return one row, queries that return a range of result set rows, execute INSERT and UPDATE queries, retrieve the last inserted record identifier or the next record sequence value, begin, commit and rollback transactions.

Picture of Kakhaber Kashmadze
Name: Kakhaber Kashmadze <contact>
Classes: 4 packages by
Country: Georgia Georgia
Age: 51
All time rank: 21262 in Georgia Georgia
Week rank: 180 Up1 in Georgia Georgia Up
Innovation award
Innovation award
Nominee: 1x

Recommendations

PDO SQL server connection and execution of stored procedures
want to connect execute sql queries and stored procedures

Example

<?php
# Example for class DbUtils\Db
# Writen By Kakhaber Kashmadze <info@soft.ge>

#for this example use test-mysql.sql from folder ../sql/

use DbUtils\Db;
use
DbUtils\Helper\HelperDb;

define('INCLUDE_DIR',dirname(dirname(__FILE__)).'/include');
define('CLASSES_DIR',INCLUDE_DIR.'/classes');

require_once
'params.php';

$dbMapper=new DbMapper(array(
   
'type'=>'mysql',
   
'host'=>DBHOST,
   
'name'=>DBNAME,
   
'user'=>DBUSER,
   
'password'=>DBPASS,
   
'port'=>3306
));

Db::init($dbMapper->getDbparams(), $dbMapper->getDb());

require_once
'include/classes/DbUtils/Db.php';
require_once
'include/classes/DbUtils/DbMapper.php';
require_once
'include/classes/DbUtils/Helper/HelperDb.php';


Db::init($dbMapper->getDbparams(), $dbMapper->getDb());


Retrieve one row from table users:

$row=Db::fetchRow("select lname, fname from users where id=1");
echo
$row['lname']." ".$row['fname']."\n";

?>


Details

Database Utilities

Access and Manage MySQL, PostgreSQL, MicrosoftSQL database using PHP Data Objects (PDO)


use DbUtils\Db;
use DbUtils\Helper\HelperDb;

define('INCLUDE_DIR',dirname(dirname(__FILE__)).'/include');
define('CLASSES_DIR',INCLUDE_DIR.'/classes');

require_once 'params.php';

$dbMapper=new DbMapper(array(
	'type'=>'mysql',
	'host'=>DBHOST,
	'name'=>DBNAME,
	'user'=>DBUSER,
	'password'=>DBPASS,
	'port'=>3306
));

Db::init($dbMapper->getDbparams(), $dbMapper->getDb());

require_once 'include/classes/DbUtils/Db.php';
require_once 'include/classes/DbUtils/DbMapper.php';
require_once 'include/classes/DbUtils/Helper/HelperDb.php';


Db::init($dbMapper->getDbparams(), $dbMapper->getDb());


Retrieve one row from table users:

$row=Db::fetchRow("select lname, fname from users where id=1");
echo $row['lname']." ".$row['fname']."\n";

  Files folder image Files (14)  
File Role Description
Files folder imageinclude (1 file, 1 directory)
Files folder imagepublic_html (3 files)
Files folder imagesql (2 files)
Accessible without login Plain text file changelog.txt Doc. Documentation
Accessible without login Plain text file LICENSE Lic. License Text
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files (14)  /  include  
File Role Description
Files folder imageclasses (1 file, 1 directory)
  Accessible without login Plain text file functions.php Aux. alternative functions of php: empty and var_dump

  Files folder image Files (14)  /  include  /  classes  
File Role Description
Files folder imageDbUtils (3 files, 1 directory)
  Plain text file DbUtils.php Class Class source

  Files folder image Files (14)  /  include  /  classes  /  DbUtils  
File Role Description
Files folder imageHelper (1 file)
  Plain text file Db.php Class DbUtils/Db.php
  Plain text file DbAddons.php Class Class source
  Plain text file DbMapper.php Class DbUtils/DbMapper.php

  Files folder image Files (14)  /  include  /  classes  /  DbUtils  /  Helper  
File Role Description
  Plain text file HelperDb.php Class DbUtils/Helper/HelperDb.php

  Files folder image Files (14)  /  public_html  
File Role Description
  Accessible without login Plain text file example-old.php Example old example
  Accessible without login Plain text file example.php Example Example script
  Accessible without login Plain text file LICENSE Lic. License text

  Files folder image Files (14)  /  sql  
File Role Description
  Accessible without login Plain text file test-mysql.sql Data Auxiliary data
  Accessible without login Plain text file test-postgresql.sql Data Auxiliary data

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  
 100%
Total:760
This week:0
All time:4,441
This week:44Up
User Ratings User Comments (1)
 All time
Utility:65%StarStarStarStar
Consistency:70%StarStarStarStar
Documentation:68%StarStarStarStar
Examples:55%StarStarStar
Tests:-
Videos:-
Overall:51%StarStarStar
Rank:2456