Hi,

I have a question for you.
I need use SQLite in my Excel application. Unfortunately from some 
reasons I'm forced to
use pure SQLite API without any VBA wrappers.

So, I've written following declarations in VBA module:

Type SQLite3
    ....
End Type

Declare Function sqlite3_open Lib "C:\sqlite3_engine.dll" (ByVal dbName 
as String, dbStruct as SQLite3)

The problem is I have no idea how to map sqlite3 struct into VBA code so 
I can't invoke opening function.
Could you give me some tips? Or may you have done it? Below I pasted 
sqlite3 struct definition from soruce code.

Thanks a lot,

mike

struct sqlite3 {
  sqlite3_vfs *pVfs;            /* OS Interface */
  int nDb;                      /* Number of backends currently in use */
  Db *aDb;                      /* All backends */
  int flags;                    /* Miscellanous flags. See below */
  int openFlags;                /* Flags passed to sqlite3_vfs.xOpen() */
  int errCode;                  /* Most recent error code (SQLITE_*) */
  int errMask;                  /* & result codes with this before 
returning */
  u8 autoCommit;                /* The auto-commit flag. */
  u8 temp_store;                /* 1: file 2: memory 0: default */
  u8 mallocFailed;              /* True if we have seen a malloc failure */
  signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */
  int nTable;                   /* Number of tables in the database */
  CollSeq *pDfltColl;           /* The default collating sequence 
(BINARY) */
  i64 lastRowid;                /* ROWID of most recent insert (see 
above) */
  i64 priorNewRowid;            /* Last randomly generated ROWID */
  int magic;                    /* Magic number for detect library misuse */
  int nChange;                  /* Value returned by sqlite3_changes() */
  int nTotalChange;             /* Value returned by 
sqlite3_total_changes() */
  sqlite3_mutex *mutex;         /* Connection mutex */
  struct sqlite3InitInfo {      /* Information used during initialization */
    int iDb;                    /* When back is being initialized */
    int newTnum;                /* Rootpage of table being initialized */
    u8 busy;                    /* TRUE if currently initializing */
  } init;
  int nExtension;               /* Number of loaded extensions */
  void **aExtension;            /* Array of shared libraray handles */
  struct Vdbe *pVdbe;           /* List of active virtual machines */
  int activeVdbeCnt;            /* Number of vdbes currently executing */
  void (*xTrace)(void*,const char*);        /* Trace function */
  void *pTraceArg;                          /* Argument to the trace 
function */
  void (*xProfile)(void*,const char*,u64);  /* Profiling function */
  void *pProfileArg;                        /* Argument to profile 
function */
  void *pCommitArg;                 /* Argument to xCommitCallback() */  
  int (*xCommitCallback)(void*);    /* Invoked at every commit. */
  void *pRollbackArg;               /* Argument to xRollbackCallback() */  
  void (*xRollbackCallback)(void*); /* Invoked at every commit. */
  void *pUpdateArg;
  void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);
  void *pCollNeededArg;
  sqlite3_value *pErr;          /* Most recent error message */
  char *zErrMsg;                /* Most recent error message (UTF-8 
encoded) */
  char *zErrMsg16;              /* Most recent error message (UTF-16 
encoded) */
  union {
    int isInterrupted;          /* True if sqlite3_interrupt has been 
called */
    double notUsed1;            /* Spacer */
  } u1;
#ifndef SQLITE_OMIT_AUTHORIZATION
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);
                                /* Access authorization function */
  void *pAuthArg;               /* 1st argument to the access auth 
function */
#endif
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  int (*xProgress)(void *);     /* The progress callback */
  void *pProgressArg;           /* Argument to the progress callback */
  int nProgressOps;             /* Number of opcodes for progress 
callback */
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  Hash aModule;                 /* populated by sqlite3_create_module() */
  Table *pVTab;                 /* vtab with active Connect/Create method */
  sqlite3_vtab **aVTrans;       /* Virtual tables with open transactions */
  int nVTrans;                  /* Allocated size of aVTrans */
#endif
  Hash aFunc;                   /* All functions that can be in SQL exprs */
  Hash aCollSeq;                /* All collating sequences */
  BusyHandler busyHandler;      /* Busy callback */
  int busyTimeout;              /* Busy handler timeout, in msec */
  Db aDbStatic[2];              /* Static space for the 2 default 
backends */
#ifdef SQLITE_SSE
  sqlite3_stmt *pFetch;         /* Used by SSE to fetch stored statements */
#endif
  u8 dfltLockMode;              /* Default locking-mode for attached dbs */
};

-- 
Michał Bartyzel
Projektant - Programista

Zespół ds. Projektów IT Equilibrium
FPL Sp. z o.o.

Rejestracja i dokumentacja / Registration & documentation:
Sąd Rejonowy dla Łodzi-Śródmieścia,
XX Wydział KRS, nr 0000075078;
kapitał zakładowy 100 170 PLN;
NIP 725-00-41-469.

Siedziba / Head office: Łódź 90-254, ul. Piramowicza 9
Kamienica Pod Aniołami
tel.  (042) 6 300 900  fax (042) 6 303 993

Biuro / Branch office:
Warszawa 02-703, ul. Bukowińska 24A
Rezydencja Pod Orłem
tel.  (022) 8 522 201  fax (022) 8 521 360

[EMAIL PROTECTED]
http://equilibrium.fpl.pl
________________________________________________________________________
Uwaga! Wiadomość ta przeznaczona jest jedynie dla osoby lub podmiotu,
który jest jej adresatem i zakazane
jest jej wszelkie przeglądanie, rozpowszechnianie czy wykorzystywanie
przez inne osoby czy podmioty niż adresat.
Jeśli otrzymałeś tę wiadomość przez pomyłkę, prosimy zawiadomić nadawcę
wysyłając informację zwrotną. Dziękujemy.

Note! This e-mail transmission is intended only for the use of the
individual or entity named above and may contain
information that is confidential,privileged, and exempt from disclosure
under applicable law. If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution, or use of any of the information contained in
this transmission is strictly PROHIBITED. If you have received this
transmission in error, please immediately notify me by
e-mail at the above address. Thank you.


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to