Ticket #293: patch-prefixed-sql-tables.patch
| File patch-prefixed-sql-tables.patch, 3.9 kB (added by Julien, 1 year ago) |
|---|
-
lib/jelix/db/jDbConnection.class.php
old new 3 3 * @package jelix 4 4 * @subpackage db 5 5 * @author Laurent Jouanneau 6 * @contributor 6 * @contributor Julien Issler 7 7 * @copyright 2005-2006 Laurent Jouanneau 8 * @copyright 2007 Julien Issler 8 9 * 9 10 * This class was get originally from the Copix project (CopixDbConnection, Copix 2.3dev20050901, http://www.copix.org) 10 11 * However only few lines of code are still copyrighted 2001-2005 CopixTeam (LGPL licence). … … 119 120 return "'".$this->_quote ($text)."'"; 120 121 } 121 122 123 /** 124 * Prefix the given table with the prefix specified in the connection's profile 125 * If there's no prefix for the connection's profile, return the table's name unchanged. 126 * 127 * @param string $table the table's name 128 * @return string the prefixed table's name 129 * @author Julien Issler 130 **/ 131 public function prefixTable($table_name){ 132 if(!isset($this->profil['table_prefix'])) 133 return $table_name; 134 return $this->profil['table_prefix'].$table_name; 135 } 136 122 137 /** 123 138 * sets the autocommit state 124 139 * @param boolean state the status of autocommit -
lib/jelix/dao/jDaoParser.class.php
old new 160 160 } 161 161 162 162 $infos['fields'] = array (); 163 164 $infos['realname'] = '\'.$this->_conn->profil[\'table_prefix\'].\''.$infos['realname']; 165 163 166 $this->_tables[$infos['name']] = $infos; 164 167 168 165 169 return $infos; 166 170 } 167 171 -
lib/jelix/dao/jDaoGenerator.class.php
old new 3 3 * @package jelix 4 4 * @subpackage dao 5 5 * @author Croes GĂ©rald, Laurent Jouanneau 6 * @contributor Laurent Jouanneau 6 * @contributor Laurent Jouanneau, Julien Issler 7 7 * @contributor Bastien Jaillot (bug fix) 8 8 * @copyright 2001-2005 CopixTeam, 2005-2006 Laurent Jouanneau 9 * @copyright 2007 Julien Issler 9 10 * This class was get originally from the Copix project (CopixDAOGeneratorV1, Copix 2.3dev20050901, http://www.copix.org) 10 11 * Few lines of code are still copyrighted 2001-2005 CopixTeam (LGPL licence). 11 12 * Initial authors of this Copix class are Gerald Croes and Laurent Jouanneau, … … 101 102 $src[] = ' protected $_tables = '.var_export($tables, true).';'; 102 103 $src[] = ' protected $_primaryTable = \''.$this->_datasParser->getPrimaryTable().'\';'; 103 104 $src[] = ' protected $_selectClause=\''.$sqlSelectClause.'\';'; 104 $src[] = ' protected $_fromClause =\''.$sqlFromClause.'\';';105 $src[] = ' protected $_fromClause;'; 105 106 $src[] = ' protected $_whereClause=\''.$sqlWhereClause.'\';'; 106 107 $src[] = ' protected $_DaoRecordClassName=\''.$this->_DaoRecordClassName.'\';'; 107 108 $src[] = ' public static $_properties = '.var_export($properties, true).';'; 108 109 $src[] = ' public static $_pkFields = array('.$this->_writeFieldNamesWith ($start = '\'', $end='\'', $beetween = ',', $pkFields).');'; 109 110 111 112 $src[] = ' public function __construct($conn){'; 113 $src[] = ' parent::__construct($conn);'; 114 $src[] = ' if(!isset($this->_conn->profil[\'table_prefix\'])) $this->_conn->profil[\'table_prefix\']=\'\';'; 115 $src[] = ' $this->_fromClause=\''.$sqlFromClause.'\';'; 116 $src[] = ' }'; 117 110 118 // cannot put this methods directly into jDaoBase because of a php bug on static methods/properties 111 119 $src[] = ' public function getProperties() { return self::$_properties; }'; 112 120 $src[] = ' public function getPrimaryKeyNames() { return self::$_pkFields;}';
