Helpers and methods relating to DML tables.
Copyright: | 2019 Andrew Nicols <andrew@nicols.co.uk> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 133 lines (4 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
table:: (5 methods):
__construct()
get_from_sql()
get_fieldlist()
get_field_select()
extract_from_result()
__construct(string $tablename, string $tablealias, string $fieldprefix) X-Ref |
Constructor for the table class. param: string $tablename The name of the table that this instance represents. param: string $tablealias The alias to use when selecting the table param: string $fieldprefix The prefix to use when selecting fields. |
get_from_sql() X-Ref |
Get the from TABLE ALIAS part of the FROM/JOIN string. return: string |
get_fieldlist() X-Ref |
Get the list of fields in a table for use in preloading fields. return: array The list of columns in a table. The array key is the column name with an applied prefix. |
get_field_select() X-Ref |
Get the SELECT SQL to select a set of columns for this table. This function is intended to be used in combination with extract_from_result(). return: string The SQL to use in the SELECT |
extract_from_result(stdClass $result) X-Ref |
Extract fields from the specified result. The fields are removed from the original object. This function is intended to be used in combination with get_field_select(). param: stdClass $result The result retrieved from the database with fields to be extracted return: stdClass The extracted result |