Localize MySQL.Localize option to Facebook build only
This extension to the mysql php-api relies on internal libmysqlclient functions which are deprecated from normal MySQL builds. Just turn it off and use fallback behavior instead.
Esse commit está contido em:
@@ -240,7 +240,9 @@ std::vector<std::string> RuntimeOption::ProxyPatterns;
|
||||
bool RuntimeOption::AlwaysUseRelativePath = false;
|
||||
|
||||
bool RuntimeOption::MySQLReadOnly = false;
|
||||
#ifdef FACEBOOK
|
||||
bool RuntimeOption::MySQLLocalize = false;
|
||||
#endif
|
||||
int RuntimeOption::MySQLConnectTimeout = 1000;
|
||||
int RuntimeOption::MySQLReadTimeout = 1000;
|
||||
int RuntimeOption::MySQLWaitTimeout = -1;
|
||||
@@ -988,7 +990,9 @@ void RuntimeOption::Load(Hdf &config, StringVec *overwrites /* = NULL */,
|
||||
{
|
||||
Hdf mysql = config["MySQL"];
|
||||
MySQLReadOnly = mysql["ReadOnly"].getBool();
|
||||
#ifdef FACEBOOK
|
||||
MySQLLocalize = mysql["Localize"].getBool();
|
||||
#endif
|
||||
MySQLConnectTimeout = mysql["ConnectTimeout"].getInt32(1000);
|
||||
MySQLReadTimeout = mysql["ReadTimeout"].getInt32(1000);
|
||||
MySQLWaitTimeout = mysql["WaitTimeout"].getInt32(-1);
|
||||
|
||||
@@ -239,7 +239,9 @@ public:
|
||||
static bool AlwaysUseRelativePath;
|
||||
|
||||
static bool MySQLReadOnly;
|
||||
#ifdef FACEBOOK
|
||||
static bool MySQLLocalize; // whether to localize MySQL query results
|
||||
#endif
|
||||
static int MySQLConnectTimeout;
|
||||
static int MySQLReadTimeout;
|
||||
static int MySQLWaitTimeout;
|
||||
|
||||
@@ -830,6 +830,7 @@ Variant mysql_makevalue(CStrRef data, MYSQL_FIELD *mysql_field) {
|
||||
return data;
|
||||
}
|
||||
|
||||
#ifdef FACEBOOK
|
||||
extern "C" {
|
||||
struct MEM_ROOT;
|
||||
unsigned long cli_safe_read(MYSQL *);
|
||||
@@ -904,6 +905,7 @@ static Variant php_mysql_localize_result(MYSQL *mysql) {
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif // FACEBOOK
|
||||
|
||||
static Variant php_mysql_do_query_general(CStrRef query, CVarRef link_id,
|
||||
bool use_store, bool async_mode) {
|
||||
@@ -1039,9 +1041,17 @@ static Variant php_mysql_do_query_general(CStrRef query, CVarRef link_id,
|
||||
|
||||
MYSQL_RES *mysql_result;
|
||||
if (use_store) {
|
||||
#ifdef FACEBOOK
|
||||
// Facebook specific optimization which depends
|
||||
// on versions of MySQL which allow access to the
|
||||
// grotty internals of libmysqlclient
|
||||
//
|
||||
// If php_mysql_localize_result ever gets rewritten
|
||||
// to use standard APIs, this can be opened up to everyone.
|
||||
if (RuntimeOption::MySQLLocalize) {
|
||||
return php_mysql_localize_result(conn);
|
||||
}
|
||||
#endif
|
||||
mysql_result = mysql_store_result(conn);
|
||||
} else {
|
||||
mysql_result = mysql_use_result(conn);
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário