I encounter a big problem with a simple query. Here is the query

SELECT LTRIM(RTRIM(_Libelle)) FROM LibLogInf WHERE ((_Index = 3) AND (_Langue = 
1))

When I run it from SqLiteExpertPro there is no problem and I get my result.
Into my program I get a NULL pointer.

The table is defined like this :

CREATE TABLE "LibLogInf" (
[_Index] INTEGER COLLATE BINARY DEFAULT (0), 
[_Langue] INTEGER COLLATE BINARY DEFAULT (0), 
[_Libelle] VARCHAR(255) COLLATE BINARY, 
CONSTRAINT [sqlite_autoindex_LibLogInf_1] PRIMARY KEY ([_Index], [_Langue]));

Here is the program code in assembly language :

SqLite_GetText PROC __hSql:HANDLE,__lpszQuery:LPSTR,__lpszResult:LPSTR
LOCAL _lpSQLStatment:DWord
LOCAL _lpszErrorMessage:LPSTR

lea edx,_lpszErrorMessage
lea eax,_lpSQLStatment

mov DWord Ptr [edx],0
mov DWord Ptr [eax],0

INVOKE sqlite3_prepare_v2,__hSql,__lpszQuery,-1,eax,edx

test eax,eax
jz @Success

xor eax,eax

stc
ret

ALIGN 16

@Success :

INVOKE sqlite3_step,_lpSQLStatment

cmp eax,SQLITE_ROW
je @ReadyToGetData

cmp eax,SQLITE_DONE
je @ReadyToGetData

INVOKE sqlite3_finalize,_lpSQLStatment

mov edx,__lpszResult
xor eax,eax
mov [edx],eax

stc
ret

ALIGN 16

@ReadyToGetData :

INVOKE sqlite3_column_text,_lpSQLStatment,0
cmp __lpszResult,NULL
jne @CopyString

xor eax,eax

stc
ret

ALIGN 16

@CopyString :

test eax,eax
jnz @Copy

INVOKE sqlite3_finalize,_lpSQLStatment

mov eax,__lpszResult
mov Byte Ptr [eax],0

xor eax,eax

stc
ret

ALIGN 16

@Copy :

INVOKE lstrcpy,__lpszResult,eax
INVOKE sqlite3_finalize,_lpSQLStatment

mov eax,__lpszResult

clc
ret
SqLite_GetText ENDP

Can someone help me ?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to