2001-03-10 11:07:52 +00:00
|
|
|
<?php
|
2003-07-10 17:46:44 +00:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
function db_prefix_tables($sql) {
|
|
|
|
global $db_prefix;
|
|
|
|
|
2003-08-26 06:44:37 +00:00
|
|
|
if (is_array($db_prefix)) {
|
|
|
|
$prefix = $db_prefix["default"];
|
|
|
|
foreach ($db_prefix as $key => $val) {
|
|
|
|
if ($key !== "default") {
|
|
|
|
$sql = strtr($sql, array("{". $key. "}" => $val. $key));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$prefix = $db_prefix;
|
|
|
|
}
|
|
|
|
return strtr($sql, array("{" => $prefix, "}" => ""));
|
2003-07-10 17:46:44 +00:00
|
|
|
}
|
2000-06-11 13:28:26 +00:00
|
|
|
|
2001-10-31 20:33:23 +00:00
|
|
|
$db_type = substr($db_url, 0, strpos($db_url, "://"));
|
2000-09-26 07:34:33 +00:00
|
|
|
|
2001-11-05 22:59:11 +00:00
|
|
|
if ($db_type == "mysql") {
|
|
|
|
include_once "includes/database.mysql.inc";
|
2000-06-22 18:18:06 +00:00
|
|
|
}
|
2001-10-31 20:33:23 +00:00
|
|
|
else {
|
|
|
|
include_once "includes/database.pear.inc";
|
2001-03-03 22:59:11 +00:00
|
|
|
}
|
|
|
|
|
2001-10-31 20:33:23 +00:00
|
|
|
db_connect($db_url);
|
2001-10-09 21:01:47 +00:00
|
|
|
|
2003-10-01 05:18:03 +00:00
|
|
|
|
2003-07-10 17:46:44 +00:00
|
|
|
?>
|