diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-07-31 22:14:26 -0400 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-07-31 22:14:26 -0400 |
| commit | a052a791b553c770ef407f91b697bef7a62df5b1 (patch) | |
| tree | f49b8edf930f6d27fd14db4970107f128b02b992 /inc/database.php | |
| parent | 232f4ff8680e81dbee3902c01af6c702555fbc0f (diff) | |
Add optional database table prefix (issue #118; see issue comments for details)
Diffstat (limited to 'inc/database.php')
| -rw-r--r-- | inc/database.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/inc/database.php b/inc/database.php index 3dc0f0ce..7be001ea 100644 --- a/inc/database.php +++ b/inc/database.php @@ -87,6 +87,8 @@ function mysql_version() { function prepare($query) { global $pdo, $debug, $config; + $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + sql_open(); if ($config['debug']) @@ -98,6 +100,8 @@ function prepare($query) { function query($query) { global $pdo, $debug, $config; + $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + sql_open(); if ($config['debug']) { |
