Bernd Wurst commited on 2014-02-02 10:48:58
Zeige 1 geänderte Dateien mit 12 Einfügungen und 12 Löschungen.
... | ... |
@@ -61,9 +61,9 @@ class DB extends PDO { |
61 | 61 |
*/ |
62 | 62 |
function db_escape_string($string) |
63 | 63 |
{ |
64 |
- global $db; |
|
64 |
+ global $_db; |
|
65 | 65 |
__ensure_connected(); |
66 |
- $quoted = $db->quote($string); |
|
66 |
+ $quoted = $_db->quote($string); |
|
67 | 67 |
// entferne die quotes, damit wird es drop-in-Kompatibel zu db_escape_string() |
68 | 68 |
$ret = substr($quoted, 1, -1); |
69 | 69 |
return $ret; |
... | ... |
@@ -72,9 +72,9 @@ function db_escape_string($string) |
72 | 72 |
|
73 | 73 |
function db_insert_id() |
74 | 74 |
{ |
75 |
- global $db; |
|
75 |
+ global $_db; |
|
76 | 76 |
__ensure_connected(); |
77 |
- return $db->lastInsertId(); |
|
77 |
+ return $_db->lastInsertId(); |
|
78 | 78 |
} |
79 | 79 |
|
80 | 80 |
|
... | ... |
@@ -84,14 +84,14 @@ function __ensure_connected() |
84 | 84 |
Dieses Kontrukt ist vermultich noch schlimmer als ein normales singleton |
85 | 85 |
aber es hilft uns in unserem prozeduralen Kontext |
86 | 86 |
*/ |
87 |
- global $db; |
|
88 |
- if (! isset($db)) { |
|
87 |
+ global $_db; |
|
88 |
+ if (! isset($_db)) { |
|
89 | 89 |
try { |
90 | 90 |
DEBUG("Neue Datenbankverbindung!"); |
91 |
- $db = new DB(); |
|
92 |
- $db->query("SET NAMES utf8"); |
|
93 |
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
94 |
- $db->setAttribute(PDO::ATTR_AUTOCOMMIT, true); |
|
91 |
+ $_db = new DB(); |
|
92 |
+ $_db->query("SET NAMES utf8"); |
|
93 |
+ $_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
94 |
+ $_db->setAttribute(PDO::ATTR_AUTOCOMMIT, true); |
|
95 | 95 |
} catch (PDOException $e) { |
96 | 96 |
global $debugmode; |
97 | 97 |
if ($debugmode) { |
... | ... |
@@ -106,14 +106,14 @@ function __ensure_connected() |
106 | 106 |
|
107 | 107 |
function db_query($stmt, $params = NULL) |
108 | 108 |
{ |
109 |
- global $db; |
|
109 |
+ global $_db; |
|
110 | 110 |
__ensure_connected(); |
111 | 111 |
DEBUG($stmt); |
112 | 112 |
if ($params) { |
113 | 113 |
DEBUG($params); |
114 | 114 |
} |
115 | 115 |
try { |
116 |
- $result = $db->query($stmt, $params); |
|
116 |
+ $result = $_db->query($stmt, $params); |
|
117 | 117 |
DEBUG('=> '.$result->rowCount().' rows'); |
118 | 118 |
} catch (PDOException $e) { |
119 | 119 |
global $debugmode; |
120 | 120 |