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

Next revision
Previous revision
v5:reference:adodb_default_metatype [2016/01/30 20:15] – created mnewnhamv5:reference:adodb_default_metatype [2023/11/05 01:17] (current) – [Usage] dregad
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
 ===== Usage ===== ===== Usage =====
-<code php> 
-/* 
-* Connecting to 
-DEFINE(ADODB_ASSOC_CASE,0); 
-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> 
- 
-or: 
-<code php> 
-DEFINE(ADODB_ASSOC_CASE,1); 
-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> 
- 
-or: 
  
 <code php> <code php>
-DEFINE(ADODB_ASSOC_CASE,3);+// Connecting to a postgreSql database 
 +DEFINE(ADODB_DEFAULT_METATYPE'C');
 require "adodb/adodb.inc.php"; require "adodb/adodb.inc.php";
  
-/+$db = NewADOConnection('postgres'); 
- connection assumed +// connection assumed
-*/+
  
-$SQL = "SELECT accountNo,accountName FROM table"; +$= $db->metaType('polygon'); 
-$data = $db->getAll($SQL); +print $m
-print_r($data)+// Unknown, returns: 'C'
-/+
- * 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.1454181311.txt.gz · Last modified: 2017/04/21 11:32 (external edit)