dbsys.inc (mrbs-1.9.4) | : | dbsys.inc (mrbs-1.10.0) | ||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
// (Although in practice this means PostgreSQL at the moment, it's possible th at | // (Although in practice this means PostgreSQL at the moment, it's possible th at | |||
// in the future support for more databases may be added) | // in the future support for more databases may be added) | |||
if ($include_schema && (utf8_strpos($dbsys, 'mysql') === false) && isset($db_s chema)) | if ($include_schema && (utf8_strpos($dbsys, 'mysql') === false) && isset($db_s chema)) | |||
{ | { | |||
$result = $db_schema . '.' . $result; | $result = $db_schema . '.' . $result; | |||
} | } | |||
return $result; | return $result; | |||
} | } | |||
function get_table_short_name(string $table) : string | ||||
{ | ||||
global $db_tbl_prefix; | ||||
// Get everything after the last '.', ie strip off any database | ||||
// and schema names | ||||
if (false !== ($pos = strrpos($table, '.'))) | ||||
{ | ||||
$result = substr($table, $pos + 1); | ||||
} | ||||
else | ||||
{ | ||||
$result = $table; | ||||
} | ||||
// Strip the prefix off the table name | ||||
return utf8_substr($result, utf8_strlen($db_tbl_prefix)); | ||||
} | ||||
// Convenience wrapper function to provide access to a DB object for | // Convenience wrapper function to provide access to a DB object for | |||
// default MRBS database | // default MRBS database | |||
function db() | function db() | |||
{ | { | |||
static $db_obj = null; | static $db_obj = null; | |||
if (is_null($db_obj)) | if (is_null($db_obj)) | |||
{ | { | |||
global $db_persist, $db_host, $db_login, $db_password, | global $db_persist, $db_host, $db_login, $db_password, | |||
$db_database, $db_port, $dbsys; | $db_database, $db_port, $dbsys; | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 19 lines changed or added |