ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:text

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:database:text [2019/12/31 08:57] – text driver is only half broken, example for ADOdb 5.20.15 peterddv5:database:text [2020/01/13 13:17] (current) – fix invalid tag specification dregad
Line 100: Line 100:
 $sql = 'select * from table'; $sql = 'select * from table';
  
 +// Does not work with PHP 5.3 or later, see workaround below
 $result = $db->execute($sql, false, "\$EMPNO==10005"); $result = $db->execute($sql, false, "\$EMPNO==10005");
  
Line 107: Line 108:
 </code> </code>
  
-===== Workaround for current ADOdb 5.20.15===== +===== Workaround =====
-<code php> +
-include 'adodb/adodb.inc.php';+
  
-$data = array( +For PHP 5.or laterthe following workaround can be used (tested with ADOdb 5.20.15).
-      0=>array(10001,'1953-09-02','Georgi','Facello','M','1986-06-26'), +
-      1=>array(10002,'1964-06-02','Bezalel','Simmel','F','1985-11-21'), +
-      2=>array(10003,'1959-12-03','Parto','Bamford','M','1986-08-28'), +
-      3=>array(10004,'1954-05-01','Christian','Koblick','M','1986-12-01'), +
-      4=>array(10005,'1955-01-21','Kyoichi','Maliniak', 'M','1989-09-12'), +
-      5=>array(10006,'1953-04-20','Anneke','Preusig','F','1989-06-02'+
-);+
  
-$cols = array('EMPNO','BIRTH_DATE','FIRST_NAME','LAST_NAME','SEX','HIRE_DATE'); +Replace the ''$result = $db->execute($sqlfalse"\$EMPNO==10005");'' statement in the above sample by the following code.
-$metaTypes array('I','D','C','C','C','D'); +
- +
-$db = ADONewConnection('text'); +
- +
-$db->connect($data$metaTypes, $cols); +
- +
-$sql = 'select * from table';+
  
 +<code php>
 $db->evalAll = "\$EMPNO==10005"; $db->evalAll = "\$EMPNO==10005";
 $result = $db->execute($sql); $result = $db->execute($sql);
 $db->evalAll = false; $db->evalAll = false;
 +</code>
  
-while ($r = $result->fetchRow()) { +{{tag>text deprecated}}
-  print_r($r); +
-} +
- +
-/* +
-Array +
-+
-    [0] => 10005 +
-    [1] => 1955-01-21 +
-    [2] => Kyoichi +
-    [3] => Maliniak +
-    [4] => M +
-    [5] => 1989-09-12 +
-+
-*/ +
-</code>+
v5/database/text.1577779074.txt.gz · Last modified: 2019/12/31 08:57 by peterdd