20 public static function getInstance($sConfig){
21 return self::_getInstance(__CLASS__,$sConfig);
24 public function findMany($tSql,$sClassRow){
25 $pRs=$this->query($this->
bind($tSql));
32 while($tRow=mysql_fetch_assoc($pRs)){
33 $oRow=
new $sClassRow($tRow);
38 public function findManySimple($tSql,$sClassRow){
39 $pRs=$this->query($this->
bind($tSql));
46 while($oRow=mysql_fetch_object($pRs)){
51 public function findOne($tSql,$sClassRow){
52 $pRs=$this->query($this->
bind($tSql));
58 $tRow=mysql_fetch_assoc($pRs);
59 $oRow=
new $sClassRow($tRow);
63 public function findOneSimple($tSql,$sClassRow){
64 $pRs=$this->query($this->
bind($tSql));
70 $oRow=mysql_fetch_object($pRs);
74 public function execute($tSql){
75 return $this->query($this->
bind($tSql));
78 public function update($sTable,$tProperty,$twhere){
79 $this->query(
'UPDATE '.$sTable.
' SET '.$this->getUpdateFromTab($tProperty).
' WHERE '.$this->getWhereFromTab($twhere));
81 public function insert($sTable,$tProperty){
82 $this->query(
'INSERT INTO '.$sTable.
' '.$this->getInsertFromTab($tProperty));
85 public function delete($sTable,$twhere){
86 $this->query(
'DELETE FROM '.$sTable.
' WHERE '.$this->getWhereFromTab($twhere));
89 public function getListColumn($sTable){
90 $pRs=$this->query(sgbd_syntax_mysql::getListColumn($sTable));
97 while($tRow=mysql_fetch_row($pRs)){
103 public function getListTable(){
104 $pRs=$this->query(sgbd_syntax_mysql::getListTable());
111 while($tRow=mysql_fetch_row($pRs)){
117 private function connect(){
118 if(empty($this->_pDb)){
119 if( ($this->_pDb=mysql_connect(
120 $this->_tConfig[$this->_sConfig.
'.hostname'],
121 $this->_tConfig[$this->_sConfig.
'.username'],
122 $this->_tConfig[$this->_sConfig.
'.password']
124 throw new Exception(
'Probleme connexion sql : '.mysql_error());
126 if( mysql_select_db($this->_tConfig[$this->_sConfig.
'.database'],$this->_pDb) ==
false){
127 $sMsg=
'Probleme selection de la base : '.$this->_tConfig[$this->_sConfig.
'.database'].
' '.mysql_error();
128 throw new Exception($sMsg);
133 public function getLastInsertId(){
134 $pRs=$this->query(sgbd_syntax_mysql::getLastInsertId());
139 $tRow=$pRs->fetch(PDO::FETCH_NUM);
140 return (
int)$tRow[0];
143 private function query($sReq){
146 return mysql_query($sReq);
148 public function quote($sVal){
149 return str_replace(
"\\",
'', str_replace(
"'",
'\'',
"'".$sVal.
"'"));
151 public function getWhereAll(){