ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:metaforeignkeys

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
Last revisionBoth sides next revision
dictionary:metaforeignkeys [2015/12/29 02:14] – [$upper] mnewnhamv5:dictionary:metaforeignkeys [2016/01/13 02:06] – ↷ Page moved from dictionary:metaforeignkeys to v5:dictionary:metaforeignkeys mnewnham
Line 19: Line 19:
 ==== $associative==== ==== $associative====
 If specified, returns the result in associative mode. If ADODB_FETCH_MODE is already associative, then this parameter is discarded. Some drivers ignore this parameter. If specified, returns the result in associative mode. If ADODB_FETCH_MODE is already associative, then this parameter is discarded. Some drivers ignore this parameter.
 +===== Return Value =====
 +The method returns an array of data:
 +  *  the main key represents the foreign table that the key associated with.
 +  * The values of the key are either a key=>value pair, the key being the column name of the source table and the value being the column name of the foreign table if the request is ''associative'', or a numeric key with value being the same data represented as ''local column'' + '=' + ''foreign column''.
 +
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
 /* /*
- * Connection to DB2 Sample database+ * Connection to MySql Employees Sample database
 */ */
-$p = $db->metaForeignKeys('ACT');+$db->setFetchMode(ADODB_FETCH_NUM); 
 + 
 +$p = $db->metaForeignKeys('dept_emp');
 print_r($p); print_r($p);
 /* /*
  * prints  * prints
-Array( +Array 
-  [ACT] => RPAA +
-  ) +    [employees] => Array 
-*/+        ( 
 +            [0] => emp_no=emp_no 
 +        )
  
-/* +    [departments] => Array 
- * Change the metaCase option to lowercase +        ( 
- */+            [0] => dept_no=dept_no 
 +        )
  
-$db->setMetaCasing($db::METACASE_LOWER); +
-$p = $db->metaForeignKeys('ACT');+*/ 
 +</code> 
 +==== Same Code In Associative Mode ==== 
 +<code php> 
 +$db->setFetchMode(ADODB_FETCH_ASSOC); 
 + 
 +$p = $db->metaForeignKeys('dept_emp');
 print_r($p); print_r($p);
 /* /*
  * prints  * prints
-Array( +Array 
-  [act] => rpaa +
-  )+    [employees] => Array 
 +        ( 
 +            [emp_no]=>emp_no 
 +        ) 
 + 
 +    [departments] => Array 
 +        ( 
 +            [dept_no]=>dept_no 
 +        ) 
 + 
 +)
 */ */
 </code> </code>
  
v5/dictionary/metaforeignkeys.txt · Last modified: 2021/11/08 17:44 by dregad