From 46af817cb058e2eecd89081af4a40075426a32ef Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 9 Jul 2006 16:23:57 +0000 Subject: - tackle some usability issues - fix bug #3147 - added the lock-images made by SHS` - fixed MSSQL errors (adding the correct ESCAPE sequence) git-svn-id: file:///svn/phpbb/trunk@6161 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index ad8e0a01da..ccc038075e 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -84,6 +84,16 @@ class dbal_postgres extends dbal return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); } + /** + * Version information about used database + */ + function sql_server_info() + { + $version = @pg_version($this->db_connect_id); + + return 'PostgresSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''; + } + /** * SQL Transaction * @access: private -- cgit v1.2.1 From 3a883600e8fa7ef59f7db003a296ec49346d9ae8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 14 Jul 2006 22:23:44 +0000 Subject: fixing a typo in postgres dbal git-svn-id: file:///svn/phpbb/trunk@6179 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index ccc038075e..f20bd2c4df 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -91,7 +91,7 @@ class dbal_postgres extends dbal { $version = @pg_version($this->db_connect_id); - return 'PostgresSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''; + return 'PostgresSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''); } /** -- cgit v1.2.1 From 0bc61ae76c99358173aa0f2acdf11b2388aa39fe Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 15 Jul 2006 10:31:51 +0000 Subject: - Some profile stuff :D - Some DB stuff :D git-svn-id: file:///svn/phpbb/trunk@6180 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index f20bd2c4df..3a8e52f78d 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -91,7 +91,7 @@ class dbal_postgres extends dbal { $version = @pg_version($this->db_connect_id); - return 'PostgresSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''); + return 'PostgreSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''); } /** -- cgit v1.2.1 From 09081e410fc015c71dbd460aeafade42d7070b78 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 1 Aug 2006 16:14:14 +0000 Subject: - acm_file uses an index pointer to the current row instead of shifting the result array now [Bug #2451] - all dbals adjusted to use the cache in sql_fetchfield, sql_rowseek, sql_numrows and sql_freeresult [Bug #2451] - use include_once for dbal.php to at least theoretically allow connections to multiple databases at once - added a space to an SQL query [Bug #3506] - detailed information on adding friends/foes [Bugs #2509, #2499] - e modifier stands for evil, so I removed it ;-) - corrected progress_bar image filename in imageset.cfg [Bug #3374] git-svn-id: file:///svn/phpbb/trunk@6225 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index 3a8e52f78d..c928a936d9 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -22,7 +22,7 @@ if (!defined('SQL_LAYER')) { define('SQL_LAYER', 'postgres'); - include($phpbb_root_path . 'includes/db/dbal.' . $phpEx); + include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); /** * PostgreSQL Database Abstraction Layer @@ -120,6 +120,12 @@ class dbal_postgres extends dbal /** * Base query method + * + * @param string $query Contains the SQL query which shall be executed + * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache + * @return mixed When casted to bool the returned value returns true on success and false on failure + * + * @access public */ function sql_query($query = '', $cache_ttl = 0) { @@ -212,11 +218,18 @@ class dbal_postgres extends dbal */ function sql_numrows($query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; } + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_numrows($query_id); + } + return ($query_id) ? @pg_num_rows($query_id) : false; } @@ -254,6 +267,8 @@ class dbal_postgres extends dbal */ function sql_fetchfield($field, $rownum = false, $query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; @@ -266,6 +281,11 @@ class dbal_postgres extends dbal $this->sql_rowseek($rownum, $query_id); } + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_fetchfield($query_id, $field); + } + $row = $this->sql_fetchrow($query_id); return isset($row[$field]) ? $row[$field] : false; } @@ -279,11 +299,18 @@ class dbal_postgres extends dbal */ function sql_rowseek($rownum, $query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; } + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_rowseek($query_id, $rownum); + } + return ($query_id) ? @pg_result_seek($query_id, $rownum) : false; } @@ -321,11 +348,18 @@ class dbal_postgres extends dbal */ function sql_freeresult($query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; } + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_freeresult($query_id); + } + if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); -- cgit v1.2.1 From 2f901a520326b4d6941ef18fcfce0a9d5ef9cea5 Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 6 Aug 2006 05:52:41 +0000 Subject: This should end some issues we have been having regarding the proper binary encoding of stuff. :D Acyd Burn: quit breaking the schema :P git-svn-id: file:///svn/phpbb/trunk@6238 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index c928a936d9..03fd5c17ce 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -258,7 +258,16 @@ class dbal_postgres extends dbal return $cache->sql_fetchrow($query_id); } - return ($query_id) ? @pg_fetch_assoc($query_id, NULL) : false; + $row = @pg_fetch_assoc($query_id, null); + if ($row) + { + foreach ($row as $key => $value) + { + $row[$key] = (strpos($key, 'bitfield') === false) ? $value : pg_unescape_bytea($value); + } + } + + return ($query_id) ? $row : false; } /** @@ -378,6 +387,14 @@ class dbal_postgres extends dbal return @pg_escape_string($msg); } + /** + * Escape string used in sql query + */ + function sql_escape_binary($msg) + { + return "'" . @pg_escape_bytea($msg) . "'"; + } + /** * return sql error array * @access: private -- cgit v1.2.1 From ed69b27cb649066d193e941d4415913c8e95f59a Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 6 Aug 2006 18:18:02 +0000 Subject: *** empty log message *** git-svn-id: file:///svn/phpbb/trunk@6244 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index 03fd5c17ce..68dc396232 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -89,9 +89,18 @@ class dbal_postgres extends dbal */ function sql_server_info() { - $version = @pg_version($this->db_connect_id); - - return 'PostgreSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''); + if (version_compare(phpversion(), '5.0.0', '>=')) + { + $version = @pg_version($this->db_connect_id); + return 'PostgreSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''); + } + else + { + $query_id = @pg_query($this->db_connect_id, 'select version()'); + $row = @pg_fetch_assoc($query_id, null); + $version = $row['version']; + return ((!empty($version)) ? ' ' . $version : ''); + } } /** -- cgit v1.2.1 From 86f3d738a0efbf5c50bdf112841aba2c8b859e85 Mon Sep 17 00:00:00 2001 From: David M Date: Fri, 11 Aug 2006 21:52:46 +0000 Subject: so.... what does this thing do? well, the super fast, ultra efficient, massively huge BBCode handling system was implemented differently on each DBMS. Although this provided the best performance, the solution was a bit hacky. So what does this new thing do? We use base64 encoding to make everything nice and shiny, it turns into nice, safe characters that we can just jam into varchars on essentially any database. This has two implications: we must decode every bitfield we get AND we have slightly fewer IDs to work with. It goes down from 2040 BBCodes to 1512. We lose like a quarter of them :P P.S. I hope nothing broke :P git-svn-id: file:///svn/phpbb/trunk@6263 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/postgres.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'phpBB/includes/db/postgres.php') diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index 68dc396232..1836952346 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -396,14 +396,6 @@ class dbal_postgres extends dbal return @pg_escape_string($msg); } - /** - * Escape string used in sql query - */ - function sql_escape_binary($msg) - { - return "'" . @pg_escape_bytea($msg) . "'"; - } - /** * return sql error array * @access: private -- cgit v1.2.1