Commit b3f6c9d2 authored by Pavel Vainerman's avatar Pavel Vainerman

(SQLite): исправил ошибку в обработке ответов (SQLiteResult)

parent f975ca5e
......@@ -337,6 +337,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%changelog
* Thu Oct 30 2014 Pavel Vainerman <pv@altlinux.ru> 1.8-alt1
- (IOBase): added the ability to override the basic settings using the prefix.
- (SQLiteInterface): fixed bug in SQLiteResult
* Mon Oct 20 2014 Pavel Vainerman <pv@altlinux.ru> 1.7-alt16
- fixed bug in UniXML::iteartor getPIntProp() for prop <= 0
......
......@@ -254,6 +254,13 @@ SQLiteResult::SQLiteResult( sqlite3_stmt* s, bool finalize )
do
{
int n = sqlite3_data_count(s);
if( n<=0 )
{
if( finalize )
sqlite3_finalize(s);
return;
}
COL c;
for( int i=0; i<n; i++ )
......@@ -264,6 +271,7 @@ SQLiteResult::SQLiteResult( sqlite3_stmt* s, bool finalize )
else
c.push_back("");
}
res.push_back(c);
}
while( sqlite3_step(s) == SQLITE_ROW );
......
......@@ -16,6 +16,47 @@ int main(int argc, char** argv)
cerr << "db connect error: " << db.error() << endl;
return 1;
}
#if 0
CREATE TABLE main_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
date date NOT NULL,
time time NOT NULL,
time_usec INTEGER NOT NULL,
sensor_id INTEGER NOT NULL,
value DOUBLE NOT NULL,
node INTEGER NOT NULL,
confirm INTEGER DEFAULT NULL
#endif
#if 0
bool fail = false;
db.query("BEGIN;");
for( int i=0; i<20; i++ )
{
stringstream qi;
qi << " INSERT INTO main_history VALUES(NULL,"
<< "date('now'), "
<< "date('now'), "
<< i << ","
<< i << ","
<< i << ","
<<"0,0);";
if( !db.insert(qi.str()) )
{
cerr << "db insert error: " << db.error() << endl;
fail = true;
break;
}
}
if( fail )
db.query("ROLLBACK;");
else
db.query("COMMIT;");
#endif
// ---------------------------------------
stringstream q;
q << "SELECT * from main_history";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment