Public Member Functions | |
| __construct ( $inDatabase, $inUser=NULL, $inPassword=NULL, $inDriver='mysql', $inHost='127.0.0.1', $inPort=NULL) | |
| get_tz_entities ( $in_id_list) | |
| get_tz_ids ( $in_lng, $in_lat) | |
| get_tz_polygons ($in_id_list) | |
| reset_database () | |
| store_entity ( $inEntity) | |
Static Public Member Functions | |
| static | _array_flatten ( $inArray) |
Public Attributes | |
| $pdo_instance | |
Protected Attributes | |
| $_load_table | |
| Destination for schema creation and polygon inserts; updater subclasses can stage a new load. | |
Static Private Member Functions | |
| static | _sort_by_domainSize ($in_A, $in_B) |
Private Attributes | |
| $_init_sql | |
This class manages interactions between the server and the database.
Definition at line 37 of file LGV_TZ_Lookup_Database.class.php.
| LGV_TZ_Lookup_Database::__construct | ( | $inDatabase, | |
| $inUser = NULL, | |||
| $inPassword = NULL, | |||
| $inDriver = 'mysql', | |||
| $inHost = '127.0.0.1', | |||
| $inPort = NULL ) |
The constructor.
| $inDatabase | database name (required) |
| $inUser | database user, optional |
| $inPassword | database password, optional |
| $inDriver | database server type (optional, default is 'mysql') |
| $inHost | database server host (optional, default is 127.0.0.1) |
| $inPort | database TCP port (optional, defaults to 3306 for mysql, 5432 for pgsql) |
Definition at line 57 of file LGV_TZ_Lookup_Database.class.php.
References pdo_instance.
|
static |
This is a simple "brute force" array flattener. It rounds the values to six significant digits, as well.
| $inArray | The multi-dimensional array to be squished. |
Definition at line 138 of file LGV_TZ_Lookup_Database.class.php.
Referenced by store_entity().
|
staticprivate |
This is a sort callback that sorts, so the smaller domain gets put first.
| $in_A | The first entity |
| $in_B | The second entity |
Definition at line 113 of file LGV_TZ_Lookup_Database.class.php.
| LGV_TZ_Lookup_Database::get_tz_entities | ( | $in_id_list | ) |
| $in_id_list | A list of IDs for the rows we want to check. |
Definition at line 183 of file LGV_TZ_Lookup_Database.class.php.
References pdo_instance.
| LGV_TZ_Lookup_Database::get_tz_ids | ( | $in_lng, | |
| $in_lat ) |
This queries the database, and returns the TZ IDs.
| $in_lng | The longitude |
| $in_lat | The latitude |
Definition at line 166 of file LGV_TZ_Lookup_Database.class.php.
References pdo_instance.
| LGV_TZ_Lookup_Database::get_tz_polygons | ( | $in_id_list | ) |
Yield the existing binary polygons without unpacking them. Primary-key order makes first-match precedence explicit, matching the existing MySQL primary-key candidate scan.
Reimplemented in DemoTrackedDatabase, and TrackingDatabase.
Definition at line 220 of file LGV_TZ_Lookup_Database.class.php.
References pdo_instance.
| LGV_TZ_Lookup_Database::reset_database | ( | ) |
This replaces the loader's destination table and its indexes for the configured database driver.
Reimplemented in SQLiteDatabase.
Definition at line 233 of file LGV_TZ_Lookup_Database.class.php.
References pdo_instance.
| LGV_TZ_Lookup_Database::store_entity | ( | $inEntity | ) |
This uses our PDO instance to save the entity as a table row.
| $inEntity | The entity to be saved into the database. |
Definition at line 149 of file LGV_TZ_Lookup_Database.class.php.
References _array_flatten(), and pdo_instance.
|
private |
The statements that initialize this connection's MySQL or PostgreSQL schema.
Definition at line 42 of file LGV_TZ_Lookup_Database.class.php.
|
protected |
Definition at line 45 of file LGV_TZ_Lookup_Database.class.php.
| LGV_TZ_Lookup_Database::$pdo_instance |
This has our PDO connection to our database.
Definition at line 51 of file LGV_TZ_Lookup_Database.class.php.