diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-10-30 18:59:09 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-10-30 18:59:09 +0000 |
| commit | 0a4f369681c7bf28c49fe9e9435b2c6ea0fd4915 (patch) | |
| tree | c693d0afc3b71c163ee188e4f89f0051f317404f /phpBB/db/mysql.php | |
| parent | 9273252cfce207445c0abf999fd8637b1d448603 (diff) | |
| download | forums-0a4f369681c7bf28c49fe9e9435b2c6ea0fd4915.tar forums-0a4f369681c7bf28c49fe9e9435b2c6ea0fd4915.tar.gz forums-0a4f369681c7bf28c49fe9e9435b2c6ea0fd4915.tar.bz2 forums-0a4f369681c7bf28c49fe9e9435b2c6ea0fd4915.tar.xz forums-0a4f369681c7bf28c49fe9e9435b2c6ea0fd4915.zip | |
Dumped sql_query_array, replaced with build_array, posting updates, fixed quoting in mysql layers, fulltext enabled ... speed/problem feedback welcome
git-svn-id: file:///svn/phpbb/trunk@2986 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/db/mysql.php')
| -rw-r--r-- | phpBB/db/mysql.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/phpBB/db/mysql.php b/phpBB/db/mysql.php index 1864fedfc2..fe2e93fee5 100644 --- a/phpBB/db/mysql.php +++ b/phpBB/db/mysql.php @@ -205,17 +205,17 @@ class sql_db } // Idea for this from Ikonboard - function sql_query_array($query = '', $assoc_ary = false) + function sql_build_array($query, $assoc_ary = false) { if (!is_array($assoc_ary)) { return false; } - if (preg_match('/^INSERT/', $query)) + $fields = array(); + $values = array(); + if ($query == 'INSERT') { - $fields = array(); - $values = array(); foreach ($assoc_ary as $key => $var) { $fields[] = $key; @@ -226,7 +226,7 @@ class sql_db } elseif (is_string($var)) { - $values[] = "'" . str_replace("'", "''", $var) . "'"; + $values[] = "'" . str_replace('\\\'', '\'\'', $var) . "'"; } else { @@ -236,7 +236,7 @@ class sql_db $query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; } - else + else if ($query == 'UPDATE') { $values = array(); foreach ($assoc_ary as $key => $var) @@ -247,18 +247,16 @@ class sql_db } elseif (is_string($var)) { - $values[] = "$key = '" . str_replace("'", "''", $var) . "'"; + $values[] = "$key = '" . str_replace('\\\'', '\'\'', $var) . "'"; } else { $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; } } - - $query = preg_replace('/^(.*? SET )(.*?)$/is', '\1' . implode(', ', $values) . ' \2', $query); } - return $this->sql_query($query); + return implode(', ', $values); } // |
