diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/database/index.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/database/metadata.rst (renamed from user_guide_src/source/database/fields.rst) | 70 | ||||
-rw-r--r-- | user_guide_src/source/database/table_data.rst | 31 |
3 files changed, 61 insertions, 43 deletions
diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index cfd624238..4612daf9d 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -17,8 +17,7 @@ patterns. The database functions offer clear, simple syntax. Query Helper Functions <helpers> Query Builder Class <query_builder> Transactions <transactions> - Table MetaData <table_data> - Field MetaData <fields> + Getting MetaData <metadata> Custom Function Calls <call_function> Query Caching <caching> Database Manipulation with Database Forge <forge> diff --git a/user_guide_src/source/database/fields.rst b/user_guide_src/source/database/metadata.rst index b706ace7d..b8be809b6 100644 --- a/user_guide_src/source/database/fields.rst +++ b/user_guide_src/source/database/metadata.rst @@ -1,9 +1,53 @@ -########## -Field Data -########## +################# +Database Metadata +################# -$this->db->list_fields() -========================= +************** +Table MetaData +************** + +These functions let you fetch table information. + +List the Tables in Your Database +================================ + +**$this->db->list_tables();** + +Returns an array containing the names of all the tables in the database +you are currently connected to. Example:: + + $tables = $this->db->list_tables(); + + foreach ($tables as $table) + { + echo $table; + } + + +Determine If a Table Exists +=========================== + +**$this->db->table_exists();** + +Sometimes it's helpful to know whether a particular table exists before +running an operation on it. Returns a boolean TRUE/FALSE. Usage example:: + + if ($this->db->table_exists('table_name')) + { + // some code... + } + +.. note:: Replace *table_name* with the name of the table you are looking for. + + +************** +Field MetaData +************** + +List the Fields in a Table +========================== + +**$this->db->list_fields()** Returns an array containing the field names. This query can be called two ways: @@ -28,8 +72,11 @@ calling the function from your query result object:: echo $field; } -$this->db->field_exists() -========================== + +Determine If a Field is Present in a Table +========================================== + +**$this->db->field_exists()** Sometimes it's helpful to know whether a particular field exists before performing an action. Returns a boolean TRUE/FALSE. Usage example:: @@ -43,8 +90,11 @@ performing an action. Returns a boolean TRUE/FALSE. Usage example:: for, and replace *table_name* with the name of the table you are looking for. -$this->db->field_data() -======================== + +Retrieve Field Metadata +======================= + +**$this->db->field_data()** Returns an array of objects containing field information. @@ -77,4 +127,4 @@ database: - name - column name - max_length - maximum length of the column - primary_key - 1 if the column is a primary key -- type - the type of the column
\ No newline at end of file +- type - the type of the column diff --git a/user_guide_src/source/database/table_data.rst b/user_guide_src/source/database/table_data.rst deleted file mode 100644 index 744a05154..000000000 --- a/user_guide_src/source/database/table_data.rst +++ /dev/null @@ -1,31 +0,0 @@ -########## -Table Data -########## - -These functions let you fetch table information. - -$this->db->list_tables(); -========================== - -Returns an array containing the names of all the tables in the database -you are currently connected to. Example:: - - $tables = $this->db->list_tables(); - - foreach ($tables as $table) - { - echo $table; - } - -$this->db->table_exists(); -=========================== - -Sometimes it's helpful to know whether a particular table exists before -running an operation on it. Returns a boolean TRUE/FALSE. Usage example:: - - if ($this->db->table_exists('table_name')) - { - // some code... - } - -.. note:: Replace *table_name* with the name of the table you are looking for. |