Hi there are 3 functions as described in SQLite homepage help

********************
int sqlite_compile(
  sqlite *db,              /* The open database */
  const char *zSql,        /* SQL statement to be compiled */
  const char **pzTail,     /* OUT: uncompiled tail of zSql */
  sqlite_vm **ppVm,        /* OUT: the virtual machine to execute zSql */
  char **pzErrmsg          /* OUT: Error message. */
);

int sqlite_step(
  sqlite_vm *pVm,          /* The virtual machine to execute */
  int *pN,                 /* OUT: Number of columns in result */
  const char ***pazValue,  /* OUT: Column data */
  const char ***pazColName /* OUT: Column names and datatypes */
);

int sqlite_finalize(
  sqlite_vm *pVm,          /* The virtual machine to be finalized */
  char **pzErrMsg          /* OUT: Error message */
);
********************

I've rewrote it this way:


********************
type
        PSQLite=type pointer;

var
        SQLite:PSQLite;

sqlite_compile:function(ASQLite:PSQLite; ASql:pChar; var ASqlTail:Pointer;
var ASqlVM:PSQLite; var AErrMsg: pChar):integer; cdecl;
sqlite_step:function(ASqlVM:PSQLite; AColumnCount:PInteger; var
AColumnValues: Pointer; var AColumnNames: Pointer):integer; cdecl;
sqlite_finalize:function(ASqlVM:PSQLite; var AErrMsg: pChar):integer; cdecl;
********************

I'm using it this way:

********************
procedure TForm1.Button4Click(Sender: TObject);
var tail:Pointer;
    SqlVM:PSQLite;
    res:integer;
    cc:PInteger;
    cv,cn:pointer;
begin
  res:=sqlite_compile(SQLite,pChar('select * from aa;'),tail,SqlVM,ErrMsg);
  if sqlite_step(SqlVM,cc,cv,cn)=SQLITE_ROW then
  begin
  end;
  if sqlite_step(SqlVM,cc,cv,cn)=SQLITE_ROW then
  begin
  end;
  if sqlite_step(SqlVM,cc,cv,cn)=SQLITE_ROW then
  begin
  end;
  sqlite_finalize(SqlVM,ErrMsg);
end;
********************

when I call sqlite_step onetime, everything works OK, byt when I call it
multipletime times (as above) then error occures: "acces violation at
address 673E8B76 in module 'sqlite.dll'. Write of address 0043D4Fs". I have
version 2.8.6 for Windows.

Bronislav Klucka


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to