-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpdoops.php
71 lines (55 loc) · 1.34 KB
/
pdoops.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
* Class for easily debugging PDO statements
*
* (c) 2013 Dotan Cohen
* This computer code file is the proprietary intellectual
* property of Dotan Cohen. Copying or modifying the file,
* in part or in whole, is strictly forbidden.
*
*
* TODO
* Add remaining PDO methods
*
*
* KNOWN ISSUES
* Only supports the most basic PDO functionality
*
*
* @copyright [DOTAN COHEN]
* @author Dotan Cohen
* @package PDOops
* @version $Id: pdoops.php 2013-03-13 15:45$
*
*/
class PDOops extends PDO
{
private $_pdo_connection;
private $_statement;
private $_bindValues;
public function __construct($dsn, $username=NULL, $password=NULL, $driver_options=NULL)
{
$this->_bindValues = array();
$_pdo_connection = parent::__construct($dsn, $username, $password, $driver_options);
return $_pdo_connection;
}
public function prepare($statement, $driver_options=NULL)
{
$this->_statement = $statement;
return parent::prepare($statement, $driver_options);
}
public function bindValue($parameter, $value, $data_type=NULL)
{
$this->_bindValues[$parameter] = $value;
return parent::bindValue($parameter, $value, $data_type);
}
public function getPseudoSql()
{
$pseudoSql = $this->_statement;
foreach ( $this->_bindValues as $f=>$v ) {
str_replace('{$f}', '{$v}', $pseudoSql);
}
return $pseudoSql;
}
}
?>