diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-22 13:00:07 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-22 13:00:07 +0000 |
commit | cccc3895cc0784458d730997186d3c0bc5db1539 (patch) | |
tree | c061a1573e26aaa1f41fbad1bc3d0e3d17ffb756 /src | |
parent | bb078eebb0bcfad5e7dd5fcd64700504b4056e67 (diff) |
Allocate id properly
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4509 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 10 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 6825f45c1..acfdf8214 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -222,7 +222,7 @@ class MySQLresult : public SQLresult rows = affected_rows; fieldlists.resize(rows); } - unsigned int field_count; + unsigned int field_count = 0; if (res) { MYSQL_ROW row; @@ -247,16 +247,16 @@ class MySQLresult : public SQLresult SQLfield sqlf(b, !row[field_count]); colnames.push_back(a); fieldlists[n].push_back(sqlf); + log(DEBUG,"Inc field count to %d",field_count+1); field_count++; } n++; } rows++; } - cols = mysql_num_fields(res); + cols = field_count; mysql_free_result(res); } - cols = field_count; log(DEBUG, "Created new MySQL result; %d rows, %d columns", rows, cols); } @@ -497,6 +497,8 @@ class SQLConnection : public classbase req.query.q = query; pthread_mutex_unlock(&queue_mutex); + log(DEBUG,"REQUEST ID: %d",req.id); + if (!mysql_real_query(&connection, req.query.q.data(), req.query.q.length())) { /* Successfull query */ @@ -744,8 +746,8 @@ class ModuleSQL : public Module if((iter = Connections.find(req->dbid)) != Connections.end()) { - iter->second->queue.push(*req); req->id = NewID(); + iter->second->queue.push(*req); returnval = SQLSUCCESS; } else diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 55a74152b..b8bdd57fa 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -262,6 +262,7 @@ class ModuleSQLLog : public Module virtual char* OnRequest(Request* request) { + log(DEBUG,"OnRequest in m_sqllog.so"); if(strcmp(SQLRESID, request->GetData()) == 0) { SQLresult* res; @@ -296,6 +297,7 @@ class ModuleSQLLog : public Module QueryInfo* i = new QueryInfo(nick, host, req.id, category); i->qs = FIND_SOURCE; active_queries[req.id] = i; + log(DEBUG,"Active query id %d",req.id); } else { |