ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:adodb_default_metatype

Differences

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

Link to this comparison view

v5:reference:adodb_default_metatype [2016/01/30 20:15]
mnewnham created
v5:reference:adodb_default_metatype [2016/01/30 20:28] (current)
mnewnham
Line 4: Line 4:
 The constant must be declared **before** including ​ adodb.inc.php. It is not possible to change the default metatype during a procedure. ​ The constant must be declared **before** including ​ adodb.inc.php. It is not possible to change the default metatype during a procedure. ​
  
-The constant ''​ADODB_DEFAULT_METATYPE ''​ controls the returned metatype of an unknown field type . The default ​behavior ​for metaType ​is '​N'​.+The constant ''​ADODB_DEFAULT_METATYPE ''​ controls the returned metatype of an unknown field type . The default ​value for this constant ​is '​N'​.
  
 This constant is useful for example in geometry data types where there is no defined metaType in ADOdb This constant is useful for example in geometry data types where there is no defined metaType in ADOdb
Line 10: Line 10:
 <code php> <code php>
 /* /*
-* Connecting to +* Connecting to a postgreSql database
-DEFINE(ADODB_ASSOC_CASE,​0);​ +
-require "​adodb/​adodb.inc.php";​ +
- +
-/* +
- * connection assumed+
 */ */
- +DEFINE(ADODB_DEFAULT_METATYPE, 'C');
-$SQL = "​SELECT accountNo,​accountName FROM table";​ +
-$data = $db->​getAll($SQL); +
-print_r($data);​ +
-/* +
- * Response is: +
- ​[0]=>​array('​accountno'​=>​1, +
-            ​'accountname'=>'​The First Account'​ +
-            ), +
- ​[1]=>​array('​accountno'​=>​2,​ +
-            '​accountname'​=>'​The Second Account'​ +
-            ) +
-            )            +
- +
-*/ +
-</​code>​ +
- +
-or: +
-<code php> +
-DEFINE(ADODB_ASSOC_CASE,​1);+
 require "​adodb/​adodb.inc.php";​ require "​adodb/​adodb.inc.php";​
  
Line 42: Line 18:
  * connection assumed  * connection assumed
 */ */
 +$db = new adoConnection('​postgresql'​);​
  
-$SQL = "​SELECT accountNo,​accountName FROM table";​ +$= $db->metaType('​polygon'​); 
-$data = $db->getAll($SQL); +print $m;
-print_r($data);+
 /* /*
- Response is: +Unknownreturns: 'C'
- ​[0]=>​array('​ACCOUNTNO'​=>​1, +
-            '​ACCOUNTNAME'​=>'​The First Account'​ +
-            ), +
- ​[1]=>​array('​ACCOUNTNO'​=>​2,​ +
-            '​ACCOUNTNAME'​=>'​The Second Account'​ +
-            ) +
-            )            +
- +
-*/ +
-</​code>​ +
- +
-or: +
- +
-<code php> +
-DEFINE(ADODB_ASSOC_CASE,​3);​ +
-require "​adodb/​adodb.inc.php";​ +
- +
-/* +
- * connection assumed +
-*/ +
- +
-$SQL = "​SELECT accountNo,​accountName FROM table";​ +
-$data = $db->​getAll($SQL);​ +
-print_r($data);​ +
-/* +
- * Response is: +
- ​[0]=>​array('​accountNo'​=>​1,​ +
-            '​accountName'​=>'​The First Account'​ +
-            ), +
- ​[1]=>​array('​accountNo'​=>​2,​ +
-            '​accountName'​=>​'The Second Account' +
-            ) +
-            )            +
 */ */
 </​code>​ </​code>​
v5/reference/adodb_default_metatype.txt · Last modified: 2016/01/30 20:28 by mnewnham