prepare($sql); $stmt->bindParam(':input_file', $input_file, PDO::PARAM_STR); $stmt->execute(); $servers = $stmt->fetchAll(PDO::FETCH_ASSOC); return $servers; } //---------------------------------------------------------------------------- // Private functions. /** * Get a connection to the database. The resulting PDO object is statically * cached. * * @return * A database connection (through PDO), or FALSE in case of failure. */ function _cdn_advanced_get_db_connection() { static $db; $synced_files_db = variable_get(CDN_ADVANCED_SYNCED_FILES_DB_VARIABLE, FALSE); if ($synced_files_db === FALSE || !file_exists($synced_files_db) || filesize($synced_files_db) == 0) { $db = FALSE; } elseif (!isset($db)) { try { $db = new PDO('sqlite:' . variable_get(CDN_ADVANCED_SYNCED_FILES_DB_VARIABLE, '')); } catch (PDOException $e) { watchdog('cdn', "Could not open synced files DB: %error.", array('%error' => $e)); $db = FALSE; } } return $db; }