/** * Generate the SQL for a query on the model * @param array $params Parameter array * @param \PDO $db Database connection to use, default db * @return string */ public static function _genSQL($params = array(), &$db = FALSE) { // Set select if (!isset($params['select'])) { $params['select'] = '*'; } // Set from if (!isset($params['from'])) { $params['from'] = '`' . static::$dbTable . '`'; } // Get database slave for read if ($db === FALSE) { $db =& self::_getDbSlave(); } if (!$db instanceof \PDO) { throw new Exception('Invalid or no database resource set'); } // Return value return $db->genSQL($params); }