}
}
- if (!self::$connected && function_exists('mysql_connect')) {
- self::$driver = 'mysql';
- self::$db = mysql_connect($serveraddr, $user, $pass);
- if (self::$db && mysql_select_db($db, self::$db)) {
- self::$connected = true;
-
- if (isset($a->config["system"]["db_charset"])) {
- mysql_set_charset($a->config["system"]["db_charset"], self::$db);
- }
- }
- }
-
// No suitable SQL driver was found.
if (!self::$connected) {
self::$db = null;
case 'mysqli':
self::$_server_info = self::$db->server_info;
break;
- case 'mysql':
- self::$_server_info = mysql_get_server_info(self::$db);
- break;
}
}
return self::$_server_info;
return substr(@self::$db->quote($str, PDO::PARAM_STR), 1, -1);
case 'mysqli':
return @self::$db->real_escape_string($str);
- case 'mysql':
- return @mysql_real_escape_string($str,self::$db);
}
}
case 'mysqli':
$connected = self::$db->ping();
break;
- case 'mysql':
- $connected = mysql_ping(self::$db);
- break;
}
return $connected;
}
self::$affected_rows = $retval->affected_rows;
}
break;
- case 'mysql':
- // For the old "mysql" functions we cannot use prepared statements
- $retval = mysql_query(self::replace_parameters($sql, $args), self::$db);
- if (mysql_errno(self::$db)) {
- self::$error = mysql_error(self::$db);
- self::$errorno = mysql_errno(self::$db);
- } else {
- self::$affected_rows = mysql_affected_rows($retval);
-
- // Due to missing mysql_* support this here wasn't tested at all
- // See here: http://php.net/manual/en/function.mysql-num-rows.php
- if (self::$affected_rows <= 0) {
- self::$affected_rows = mysql_num_rows($retval);
- }
- }
- break;
}
// We are having an own error logging in the function "e"
return $stmt->columnCount();
case 'mysqli':
return $stmt->field_count;
- case 'mysql':
- return mysql_affected_rows($stmt);
}
return 0;
}
return $stmt->rowCount();
case 'mysqli':
return $stmt->num_rows;
- case 'mysql':
- return mysql_num_rows($stmt);
}
return 0;
}
$columns[$fields[$param]->name] = $col;
}
return $columns;
- case 'mysql':
- return mysql_fetch_array($stmt, MYSQL_ASSOC);
}
}
case 'mysqli':
$id = self::$db->insert_id;
break;
- case 'mysql':
- $id = mysql_insert_id(self::$db);
- break;
}
return $id;
}
case 'pdo':
return $stmt->closeCursor();
case 'mysqli':
- return $stmt->free_result();
+ $stmt->free_result();
return $stmt->close();
- case 'mysql':
- return mysql_free_result($stmt);
}
}
}