YAP  2.5
 All Data Structures Namespaces Files Functions Variables
CYap_db.php
Go to the documentation of this file.
1 <?PHP
10 /*
11  * +-------------------------------------------------------------------------+
12  * | Yap, Version 2.5.0 |
13  * +-------------------------------------------------------------------------+
14  * | Copyright (c) 2003-2013 Andrioli Darvin |
15  * | Email <darvin (inside) andrioli (dot) com> |
16  * | Web http://www.andrioli.com/en/yap.html |
17  * | Download http://www.phpclasses.org/browse.html/package/1391.html |
18  * | |
19  * +-------------------------------------------------------------------------+
20  * | This library is free software; you can redistribute it and/or modify |
21  * | it under the terms of the GNU Lesser General Public License as |
22  * | published by the Free Software Foundation; either version 2 of the |
23  * | License, or (at your option) any later version. |
24  * | |
25  * | This library is distributed in the hope that it will be useful, but |
26  * | WITHOUT ANY WARRANTY; without even the implied warranty of |
27  * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
28  * | Lesser General Public License for more details. |
29  * | |
30  * | You should have received a copy of the GNU Lesser General Public |
31  * | License along with this library; if not, write to the Free Software |
32  * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
33  * +-------------------------------------------------------------------------+
34  */
38 class CYapDB
39 {
40 var $DbConn;
67 function CYapDB()
68 {
69 $this->LastQuery=array();
70 $this->CurrentRow=array();
71 }
80 function OpenDB($Server,$User="",$Password="")
81 {
82 }
83 function SelectDb($DBname)
84 {
85 }
92 function DbExecSql($sql)
93 {
94 }
104 function QueryLimit($select,$start=0,$many=-1)
105 {
106 }
113 function DbGetNumRow($result)
114 {
115 }
122 function DbGetNumFields($result)
123 {
124 }
133 function DbFetchField($result,$FieldNo)
134 {
135 }
143 function DbFieldFlags($result,$FieldNo)
144 {
145 }
152 function DbFreeResult($result)
153 {
154 }
163 function DbEscape($value)
164 {
165 $quote=(bool)ini_get('magic_quotes_gpc');
166 if(!$quote)
167  $ret=addslashes($value);
168 else
169  $ret=$value;
170 return($ret);
171 }
177 function DbError()
178 {
179 return($this->txtError);
180 }
181 
182 
191 function DbaddSql($row,$fieldsType,$KeyField)
192 {
193 $Count=0;
194 $fName='';
195 $fValue='';
196 foreach($row as $Key => $Value)
197  {
198  // I Can't update the row key
199  if($Key!=$KeyField)
200  {
201  if($Count)
202  {
203  $fName.=', ';
204  $fValue.=', ';
205  }
206  $fName.=$Key;
207  $apice=$fieldsType[$Key]['apice'];
208  $fValue.=$apice.$this->DBEscape($Value).$apice;
209  $Count++;
210  }
211  }
212 $OutText='('.$fName.') VALUES ('.$fValue.') ';
213 return($OutText);
214 }
215 
223 function DbmodifySql($row,$fieldsType)
224 {
225 $OutText=' set ';
226 $c=0;
227 foreach($row as $Key => $Value)
228  {
229  if($c) $OutText.=', ';
230  $apice=$fieldsType[$Key]['apice'];
231  $OutText.=$Key.' = '.$apice.$this->DBEscape($Value).$apice.' ';
232  $c++;
233  }
234 return($OutText);
235 }
236 
245 function DbRegexCond($FieldName,$pattern)
246 {
247 }
257 function DbBetweenCond($FieldName,$ValueFrom,$ValueTo,$ValueType)
258 {
259 }
260 }
261 
262 /*
263  ****************
264  * CLASS META
265  ****************
266  */
271 class DbMeta
272 {
273 var $name;
274 var $table;
275 var $type;
278 }
279 
280 
281 ?>