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
v5:dictionary:metaforeignkeys [2026/02/23 20:21] – [Explanation] mnewnhamv5:dictionary:metaforeignkeys [2026/02/26 00:40] (current) – [Return Value] dregad
Line 22: Line 22:
 The method returns an array of data: The method returns an array of data:
   * The main key represents the foreign table that the key associated with.   * 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''.+  * 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''.
  
 ===== Explanation ===== ===== Explanation =====
-A table **//parent_table//** has a foreign key that references **//foreign_table//**. **//parent_table//** has 2 columns **//parent_id//** and **//parent_type//**. These 2 columns reference corresponding columns in **//foreign_table//**, **//id//** and **//type//**. metaForignKeys() presents this data in the following way:+A table **//parent_table//** has a foreign key that references **//foreign_table//**. **//parent_table//** has 2 columns **//parent_id//** and **//parent_type//**. These 2 columns reference corresponding columns in **//foreign_table//**, **//foreign_id//** and **//foreign_type//**. ''metaForeignKeys('parent_table')'' presents this data in the following way:
 ==== Associative Mode ====  ==== Associative Mode ==== 
 <code php> <code php>
 [ [
     ['foreign_table'] [     ['foreign_table'] [
-        ['parent_id'] => 'id', +        ['parent_id'] => 'foreign_id', 
-        ['parent_type'] => 'type'+        ['parent_type'] => 'foreign_type'
     ]     ]
 ] ]
Line 39: Line 41:
 [ [
     ['foreign_table'] => [     ['foreign_table'] => [
-        [0] => 'parent_id=id', +        [0] => 'parent_id=foreign_id', 
-        [1] => 'parent_type=type'+        [1] => 'parent_type=foreign_type'
     ]     ]
 ] ]
v5/dictionary/metaforeignkeys.1771874516.txt.gz · Last modified: by mnewnham