F #1792: Greatly improve concurrency by: Remove big lock on pool control class. Increase number of MySQL connections (new configuration variable). Make all parser reentrants. This commit also simplifies the pool references.

(cherry picked from commit a3d3ceb771034794c4fb453dcd9aaff64c53baed)
This commit is contained in:
Ruben S. Montero committed 2018-03-17 23:35:21 +01:00
1 parent a3d4d35340
commit 37222d65dc
140 files changed
+6346 -3582

No files matched your search

+74 -5
View File
@@ -82,6 +82,80 @@ int PoolObjectSQL::select(SqlDB *db)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int PoolObjectSQL::select_oid(SqlDB *db, const char * _table,
const string& _name, int _uid)
{
char * sql_name = db->escape_str(_name.c_str());
if ( sql_name == 0 )
{
return -1;
}
ostringstream oss;
oss << "SELECT oid FROM " << _table << " WHERE name = '" << sql_name << "'";
if ( _uid != -1 )
{
oss << " AND uid = " << _uid;
}
int bd_oid = -1;
single_cb<int> oid_cb;
oid_cb.set_callback(&bd_oid);
int rc = db->exec_rd(oss, &oid_cb);
oid_cb.unset_callback();
db->free_str(sql_name);
if (rc != 0)
{
return -1;
}
return bd_oid;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int PoolObjectSQL::exist(SqlDB *db, const char * _table, int _oid)
{
if ( _oid < 0 )
{
return -1;
}
ostringstream oss;
oss << "SELECT oid FROM " << _table << " WHERE oid = '" << _oid << "'";
int bd_oid = -1;
single_cb<int> oid_cb;
oid_cb.set_callback(&bd_oid);
int rc = db->exec_rd(oss, &oid_cb);
oid_cb.unset_callback();
if (rc != 0)
{
return -1;
}
return bd_oid;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int PoolObjectSQL::select(SqlDB *db, const string& _name, int _uid)
{
ostringstream oss;
@@ -135,11 +209,6 @@ int PoolObjectSQL::drop(SqlDB *db)
rc = db->exec_wr(oss);
if ( rc == 0 )
{
set_valid(false);
}
return rc;
}