Skip to content

Commit

Permalink
fix a error in sqlite sync mode
Browse files Browse the repository at this point in the history
  • Loading branch information
DrAbcOfficial committed Aug 16, 2023
1 parent 386fb36 commit f95cfe6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/source/CASSQLite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ int CASSQLite::ExecSync(CString* sql, void* arrayOut, CString* errMsg){
else if (!m_bAviliable)
return 1;
int iReturn = 0;
char* zErrMsg = NULL;
char** pResult = NULL;
char* zErrMsg = nullptr;
char** pResult = nullptr;
int nRow = 0;
int nColumn = 0;
iReturn = SQLite3_GetTable(m_pDatabase, sql->c_str(), &pResult, &nRow, &nColumn, &zErrMsg);
Expand All @@ -99,11 +99,12 @@ int CASSQLite::ExecSync(CString* sql, void* arrayOut, CString* errMsg){
asITypeInfo* strInfo = engine->GetTypeInfoByName("string");

int iIndex = 0;
for (int i = 0; i < nRow; i++){
for (int i = 0; i <= nRow; i++){
void* ary = engine->CreateScriptObject(aryInfo);
for (int j = 0; j < nColumn; j++){
CString* val = static_cast<CString*>(engine->CreateScriptObject(strInfo));
val->assign(pResult[iIndex], strlen(pResult[iIndex]));
char* res = pResult[i * nColumn + j];
val->assign(res, strlen(res));
ctx->Prepare(funcAryInsert);
ctx->SetObject(ary);
ctx->SetArgObject(0, val);
Expand Down

0 comments on commit f95cfe6

Please sign in to comment.