diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2009-01-21 17:04:17 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-01-21 17:04:17 +0000 |
| commit | 578beb75ef0b63680ffd9fdb216df87d4cf098d5 (patch) | |
| tree | 48572987f688559e88667eefb286b62918dc06e3 /phpBB/includes/db/dbal.php | |
| parent | 9f060eba6eb8f2e54f5c26cc23c4f82eee7903b8 (diff) | |
| download | forums-578beb75ef0b63680ffd9fdb216df87d4cf098d5.tar forums-578beb75ef0b63680ffd9fdb216df87d4cf098d5.tar.gz forums-578beb75ef0b63680ffd9fdb216df87d4cf098d5.tar.bz2 forums-578beb75ef0b63680ffd9fdb216df87d4cf098d5.tar.xz forums-578beb75ef0b63680ffd9fdb216df87d4cf098d5.zip | |
put sql_handle_data() into dbal and let DBMS who support this overwrite it. David: would be nice if you could have a look at it later. ;)
git-svn-id: file:///svn/phpbb/trunk@9285 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/dbal.php')
| -rw-r--r-- | phpBB/includes/db/dbal.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index e3588a9cd5..5e8e0c9fdd 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -357,8 +357,20 @@ abstract class phpbb_dbal * @param mixed $data The data to insert/update in an array (key == column, value == value) * @param string $where An optional where-statement * @access public + * @todo implement correctly by using types and only overwrite if DB supports prepared statements */ - abstract public function sql_handle_data($type, $table, $data, $where = ''); + public function sql_handle_data($type, $table, $data, $where = '') + { + if ($type === 'UPDATE') + { + $where = ($where) ? ' WHERE ' . $where : ''; + $this->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', $data) . $where); + } + else + { + $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $data)); + } + } /** * DB-specific base query method. Called by {@link phpbb_dbal::sql_query() sql_query()}. @@ -1080,7 +1092,10 @@ abstract class phpbb_dbal if (!$this->return_on_error) { - $message = 'SQL ERROR [ ' . $this->sql_layer . ' ]<br /><br />' . $this->sql_error_returned['message'] . ' [' . $this->sql_error_returned['code'] . ']'; + $sql_message = $this->sql_error_returned['message']; + $sql_code = $this->sql_error_returned['code']; + + $message = 'SQL ERROR [ ' . $this->sql_layer . ' ]' . (($sql_message) ? '<br /><br />' . $sql_message : '') . (($sql_code) ? ' [' . $sql_code . ']' : ''); // Show complete SQL error and path to administrators only // Additionally show complete error on installation or if extended debug mode is enabled |
