self::$connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
self::$connected = true;
} catch (PDOException $e) {
self::$connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
self::$connected = true;
} catch (PDOException $e) {
switch (self::$driver) {
case 'pdo':
return substr(@self::$connection->quote($str, PDO::PARAM_STR), 1, -1);
switch (self::$driver) {
case 'pdo':
return substr(@self::$connection->quote($str, PDO::PARAM_STR), 1, -1);
* @usage Example: $r = p("SELECT * FROM `item` WHERE `guid` = ?", $guid);
*
* Please only use it with complicated queries.
* @usage Example: $r = p("SELECT * FROM `item` WHERE `guid` = ?", $guid);
*
* Please only use it with complicated queries.
- * Please use dba::delete, dba::insert, dba::update, ... instead
+ * Please use DBA::delete, DBA::insert, DBA::update, ... instead
*
* @param string $sql SQL statement
* @return boolean Was the query successfull? False is returned only if an error occurred
*
* @param string $sql SQL statement
* @return boolean Was the query successfull? False is returned only if an error occurred
- * $data = dba::select($table, $fields, $condition, $params);
+ * $data = DBA::select($table, $fields, $condition, $params);
*/
public static function select($table, array $fields = [], array $condition = [], array $params = [])
{
*/
public static function select($table, array $fields = [], array $condition = [], array $params = [])
{
* or:
* $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr'];
*
* or:
* $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr'];
*
/* Workaround for MySQL Bug #64791.
* Never mix data types inside any IN() condition.
* In case of mixed types, cast all as string.
/* Workaround for MySQL Bug #64791.
* Never mix data types inside any IN() condition.
* In case of mixed types, cast all as string.
case 'mysqli':
// MySQLi offers both a mysqli_stmt and a mysqli_result class.
// We should be careful not to assume the object type of $stmt
case 'mysqli':
// MySQLi offers both a mysqli_stmt and a mysqli_result class.
// We should be careful not to assume the object type of $stmt