Improved usage of use
in dba_pdo
This commit is contained in:
parent
c0a6f1122b
commit
4293e27d5c
1 changed files with 6 additions and 7 deletions
|
@ -1,12 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use DDDBL;
|
use DDDBL\DataObjectPool;
|
||||||
|
use DDDBL\Queue;
|
||||||
use Exception;
|
|
||||||
|
|
||||||
require_once('include/datetime.php');
|
require_once('include/datetime.php');
|
||||||
|
|
||||||
$objDDDBLResultHandler = new DDDBL\DataObjectPool('Result-Handler');
|
$objDDDBLResultHandler = new DataObjectPool('Result-Handler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create handler, which returns just the PDOStatement object
|
* create handler, which returns just the PDOStatement object
|
||||||
|
@ -14,7 +13,7 @@ $objDDDBLResultHandler = new DDDBL\DataObjectPool('Result-Handler');
|
||||||
* big result-sets
|
* big result-sets
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
$cloPDOStatementResultHandler = function(DDDBL\Queue $objQueue) {
|
$cloPDOStatementResultHandler = function(Queue $objQueue) {
|
||||||
|
|
||||||
$objPDO = $objQueue->getState()->get('PDOStatement');
|
$objPDO = $objQueue->getState()->get('PDOStatement');
|
||||||
$objQueue->getState()->update(array('result' => $objPDO));
|
$objQueue->getState()->update(array('result' => $objPDO));
|
||||||
|
@ -51,7 +50,7 @@ class dba {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
# work around, to store the database - configuration in DDDBL
|
# work around, to store the database - configuration in DDDBL
|
||||||
$objDataObjectPool = new DDDBL\DataObjectPool('Database-Definition');
|
$objDataObjectPool = new DataObjectPool('Database-Definition');
|
||||||
$objDataObjectPool->add('DEFAULT', array('CONNECTION' => "mysql:host=$server;dbname=$db",
|
$objDataObjectPool->add('DEFAULT', array('CONNECTION' => "mysql:host=$server;dbname=$db",
|
||||||
'USER' => $user,
|
'USER' => $user,
|
||||||
'PASS' => $pass,
|
'PASS' => $pass,
|
||||||
|
@ -110,7 +109,7 @@ class dba {
|
||||||
$strQueryAlias = md5($sql);
|
$strQueryAlias = md5($sql);
|
||||||
$strSQLType = strtoupper(strstr($sql, ' ', true));
|
$strSQLType = strtoupper(strstr($sql, ' ', true));
|
||||||
|
|
||||||
$objPreparedQueryPool = new DDDBL\DataObjectPool('Query-Definition');
|
$objPreparedQueryPool = new DataObjectPool('Query-Definition');
|
||||||
|
|
||||||
# check if query do not exists till now, if so create its definition
|
# check if query do not exists till now, if so create its definition
|
||||||
if (!$objPreparedQueryPool->exists($strQueryAlias))
|
if (!$objPreparedQueryPool->exists($strQueryAlias))
|
||||||
|
|
Loading…
Reference in a new issue