81 $this->UseLimit=
false;
83 $this->LastRow=array();
84 $this->CurrentRow=array();
93 function OpenDb($DBSystem,$DBUser=
"",$DBPasswd=
"")
97 $this->txtError=
'Database already open';
100 $this->SaveUser=$DBUser;
101 $this->SavePasswd=$DBPasswd;
114 $this->txtError=
'Database already open';
117 if(($this->DbConn=odbc_connect($DBname,$this->SaveUser,$this->SavePasswd))===FALSE)
120 $this->txtError=
"Error during connection to the server ".$DBSystem;
133 $this->UseLimit=FALSE;
137 $this->txtError=
'No database open';
140 if(($this->DbResult=odbc_exec($this->DbConn,$sql))===
false)
143 $this->txtError=
"Error into sql statement. Sql string: ".$sql.
".Err:". odbc_errormsg() .
": " . mysql_error();
146 $this->CurrentRow[$this->DbResult]=1;
147 $this->LastQuery[$this->DbResult]=$sql;
148 return($this->DbResult);
163 if(($res=$this->
DbExecSql($select))===FALSE)
165 $this->UseLimit=TRUE;
167 $this->LimitStart=$start+1;
170 $this->LimitToEnd=$many;
173 $this->LimitToEnd=999999;
185 $nRows=odbc_num_rows($result);
204 if(odbc_fetch_into($result,$tmp,$max))
206 if(!odbc_fetch_into($result,$tmp,$min))
211 while(!(abs($gap)<1))
213 $corrente+=floor($gap);
214 if(!odbc_fetch_into($result,$tmp,$corrente))
216 $gap=($min-$corrente)/2;
225 odbc_fetch_into($result,$tmp,1);
235 $tmp=odbc_fetch_array($result,1);
248 $meta->name=odbc_field_name($result,$FieldNo+1);
249 $type=odbc_field_type($result,$FieldNo+1);
250 $meta->max_length=odbc_field_len($result,$FieldNo+1);
254 $meta->type=
'IGNORE';
273 $meta->type=
'DOUBLE';
294 $type=odbc_field_type($result,$FieldNo+1);
296 $txt=
'auto_increment';
311 if(!($es=odbc_free_result($result)))
312 $this->txtError=odbc_errormsg();
313 $this->LastRow[$result]=array();
325 $this->txtError=
'No database open';
328 if($this->UseLimit&&!$this->LimitToEnd)
332 $this->LastRow[$result]=odbc_fetch_array($result,$this->CurrentRow[$result]);
333 $this->CurrentRow[$result]++;
334 return($this->LastRow[$result]);
344 $this->txtError=
'No database open';
347 odbc_close($this->DbConn);
348 $this->Db_Open=
false;
366 foreach($row as $Key => $Value)
376 $fName.=
'['.$Key.
']';
377 $apice=$fieldsType[$Key][
'apice'];
378 $fValue.=$apice.$this->DBEscape($Value).$apice;
382 $OutText=
'('.$fName.
') VALUES ('.$fValue.
') ';
397 foreach($row as $Key => $Value)
399 if($c) $OutText.=
', ';
400 $apice=$fieldsType[$Key][
'apice'];
401 $OutText.=
'['.$Key.
'] = '.$apice.$this->DBEscape($Value).$apice.
' ';
416 return($FieldName.
' like \'%'.$pattern.
'%\'');
429 $quote=(bool)ini_get(
'magic_quotes_gpc');
431 $ret=str_replace(
"'",
"''",$value);
433 $ret=str_replace(
"\\",
"'",$value);
447 if($ValueType==
'DB_NUMBER')
448 return($FieldName.
' >= '.$ValueFrom.
' and '.$FieldName.
' <= '.$ValueTo);
450 return($FieldName.
' >= \''.$ValueFrom.
'\' and
'.$FieldName.' <= \
''.$ValueTo.
'\'');