diff --git a/ConsoleApplicationTest/ConsoleApplicationTest.cpp b/ConsoleApplicationTest/ConsoleApplicationTest.cpp index 47dd30c..dd01042 100644 --- a/ConsoleApplicationTest/ConsoleApplicationTest.cpp +++ b/ConsoleApplicationTest/ConsoleApplicationTest.cpp @@ -7,7 +7,7 @@ int main() { Database* db = SQLit3::Ins().CreateDatabase(); - bool b = db->Open("F:\\1.db", "12345678", Database::SQLIT3_OPEN_DEFAULT); + bool b = db->Open("F:\\1.db", "", Database::SQLIT3_OPEN_DEFAULT); if (!b) { std::cout << "打开数据库失败"<< db->GetLastErrorCode() @@ -17,6 +17,9 @@ int main() b = db->Execute("select 1"); //b = db->ResetPassword("12345678"); + __int64 maxId = 0; + b = db->QueryInt64("SELECT MAX(id) FROM Url2FileCache", &maxId); + b = db->Execute("CREATE TABLE IF NOT EXISTS \"t1\" (\"a\" TEXT,\"b\" integer,\"c\" real);"); b = db->Execute("INSERT INTO \"main\".\"t1\" (\"a\", \"b\", \"c\") VALUES ('abc', 1, 2.0);"); __int64 changedRow = db->GetChangeRowCount(); diff --git a/SQLit3/SQLit3.cpp b/SQLit3/SQLit3.cpp index 85514bb..9deb74c 100644 --- a/SQLit3/SQLit3.cpp +++ b/SQLit3/SQLit3.cpp @@ -296,7 +296,7 @@ class DatabaseImp return false; SqlStatement::ReadStatus status = stmt->Next(); - if (status != SqlStatement::SQLIT3_READ_DONE || + if (status != SqlStatement::SQLIT3_READ_DONE && status != SqlStatement::SQLIT3_READ_HAS_ROW) { StatementFinalize(stmt); @@ -321,7 +321,7 @@ class DatabaseImp return false; SqlStatement::ReadStatus status = stmt->Next(); - if (status != SqlStatement::SQLIT3_READ_DONE || + if (status != SqlStatement::SQLIT3_READ_DONE && status != SqlStatement::SQLIT3_READ_HAS_ROW) { StatementFinalize(stmt); @@ -346,7 +346,7 @@ class DatabaseImp return false; SqlStatement::ReadStatus status = stmt->Next(); - if (status != SqlStatement::SQLIT3_READ_DONE || + if (status != SqlStatement::SQLIT3_READ_DONE && status != SqlStatement::SQLIT3_READ_HAS_ROW) { StatementFinalize(stmt); @@ -371,7 +371,7 @@ class DatabaseImp return false; SqlStatement::ReadStatus status = stmt->Next(); - if (status != SqlStatement::SQLIT3_READ_DONE || + if (status != SqlStatement::SQLIT3_READ_DONE && status != SqlStatement::SQLIT3_READ_HAS_ROW) { StatementFinalize(stmt); @@ -405,7 +405,7 @@ class DatabaseImp return false; SqlStatement::ReadStatus status = stmt->Next(); - if (status != SqlStatement::SQLIT3_READ_DONE || + if (status != SqlStatement::SQLIT3_READ_DONE && status != SqlStatement::SQLIT3_READ_HAS_ROW) { StatementFinalize(stmt); @@ -439,7 +439,7 @@ class DatabaseImp return false; SqlStatement::ReadStatus status = stmt->Next(); - if (status != SqlStatement::SQLIT3_READ_DONE || + if (status != SqlStatement::SQLIT3_READ_DONE && status != SqlStatement::SQLIT3_READ_HAS_ROW) { StatementFinalize(stmt);