Skip navigation.
Home
That which cannot be rendered in binary is by definition a delusion
 

Class Activerecord_table

This class governs all the saving and loading of data from the database.

Properties:

  • key_field: string. The name of the primary key.
  • eq: string. The equality verb for key comparison (either '=' or 'LIKE');
  • name: string. The name of the table.
  • schema: array. An array of stdClass column descriptions from the database. NOTE: all fields in the schema have their first letter capitalized. (at least they do on my dev system -- hopefully yours too...)

Methods:

  • insert(stdClass $pData): inserts a new record into the database.
  • update(stdClass $pData): updates an existing record in the database.
  • delete(var $record): deletes an existing record in the database.
  • fields($pQualified = FALSE): string[]. Returns an array of the names of the table fields. If $pQualified, will be annotated with the table name as in {leads}.`first_name`, {leads}.`last_name`.
  • filter_fields(stdClass $pFields): stdClass. Merges the fields passed in with the defaults in the schema and removes any fields that are not in the table.
  • find($pCriteria): Activerecord[] see the attached article on the sql system. Returns the records matching the criteria that can be either a SQL statement (string) or a nested array describing a SQL statement.
  • static get($pTable): Activerecord_table. A singleton factory that returns an object for a given table. Ensures that only one Activerecord_table exists per database table.
  • get_key($pKey): scalar. returns the Activerecord corresponding to the given key.
  • qualify_field($pField, $pAs = NULL): string. Returns a formal definition of a field with the table prefiix ({leads}.`last_name`) with an optional synonym from the second parameter.
  • query(string $pQuery, $return): var[]. given a SQL string, returns an array of data from the database, either in array, stdClass, or Activerecord form.

Post new comment

  • Allowed HTML tags: <a> <p> <span><small> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options