From 3b11868b3aa56c83419d904435a5b7dfbf997063 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Tue, 22 Jan 2008 23:44:32 +0000 Subject: Added $this->db->dbprefix() to manually add database prefixes. --- system/database/DB_active_rec.php | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'system') diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 08213af5c..ba68e1e8f 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -7,8 +7,8 @@ * @package CodeIgniter * @author ExpressionEngine Dev Team * @copyright Copyright (c) 2006, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html - * @link http://codeigniter.com + * @license http://www.codeigniter.com/user_guide/license.html + * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ @@ -24,7 +24,7 @@ * @subpackage Drivers * @category Database * @author ExpressionEngine Dev Team - * @link http://codeigniter.com/user_guide/database/ + * @link http://www.codeigniter.com/user_guide/database/ */ class CI_DB_active_record extends CI_DB_driver { @@ -44,6 +44,27 @@ class CI_DB_active_record extends CI_DB_driver { var $ar_wherein = array(); var $ar_aliased_tables = array(); + /** + * DB Prefix + * + * Prepends a database prefix if one exists in configuration + * + * @access public + * @param string the table + * @return string + */ + function dbprefix($table = '') + { + if ($table == '') + { + $this->display_error('db_table_name_required'); + } + + return $this->dbprefix.$table; + } + + // -------------------------------------------------------------------- + /** * Select * -- cgit v1.2.3-24-g4f1b