summaryrefslogtreecommitdiff
path: root/includes/database.mysql.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-05-12 14:36:43 +0000
committerDries Buytaert <dries@buytaert.net>2005-05-12 14:36:43 +0000
commitf2d200f51e7753d13aa33646f8787b1b94e83490 (patch)
tree7bfe65f2afa7aef155e42b86b62fa98eb0d7fe5d /includes/database.mysql.inc
parent2b7f504dc8defc1a76d08a75d6e366ee988f6990 (diff)
downloadbrdo-f2d200f51e7753d13aa33646f8787b1b94e83490.tar.gz
brdo-f2d200f51e7753d13aa33646f8787b1b94e83490.tar.bz2
- Patch #19442 by chx: cache_set sometimes failed.
TODO: this patch lets us clean up more code in code! Let's have a look at this ...
Diffstat (limited to 'includes/database.mysql.inc')
-rw-r--r--includes/database.mysql.inc11
1 files changed, 9 insertions, 2 deletions
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
index 20edf814a..5fb934328 100644
--- a/includes/database.mysql.inc
+++ b/includes/database.mysql.inc
@@ -28,7 +28,14 @@ function db_connect($url) {
$url['host'] = $url['host'] .':'. $url['port'];
}
- $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE) or die(mysql_error());
+ // - TRUE makes mysql_connect() always open a new link, even if
+ // mysql_connect() was called before with the same parameters.
+ // This is important if you are using two databases on the same
+ // server.
+ // - 2 means CLIENT_FOUND_ROWS: return the number of found
+ // (matched) rows, not the number of affected rows.
+ $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE, 2) or die(mysql_error());
+
mysql_select_db(substr($url['path'], 1)) or die('unable to select database');
return $connection;
@@ -239,4 +246,4 @@ function db_escape_string($text) {
* @} End of "ingroup database".
*/
-?> \ No newline at end of file
+?>