Hi !
I'm trying to compile a sqlite3.lib from the source (www.sqlite.org), but when i use "l2inc" i got nothing....and the lib is only 22k !
Please help me i'm getting mad :dazzled:. I have tried many way to compile but none work (like i want to) :P
For infos i want to make something like a package for RadAsm like the one for GDI+ :clap:.....
Best Regard
Ernest33
Hi
Maybe the method used here is what you are looking for.
http://www.phpmvc.net/asm/
(http://www.phpmvc.net/asm/%3Cbr%20/%3E)
See the xml-parser example.
KetilO
If you download and extract the ZIP file version and then run vctoolkit and cd to the dir. Then do;
> cl /MD *.c
...
> link -lib /NODEFAULTLIB /OUT:sqlite.lib *.obj
Ignore any errors involving tcl files cause you don't want them (I presume).
ernest33,
Enclosed is the DLL they release plus an import library and an include file for MASM. Let us know how it works.
[attachment deleted by admin]
Hi Hutch,
I created an include file with PROTOs.
[attachment deleted by admin]
Vortex, how comes that your def2inc tool trims the first character of each line. Hutch, for what reason files inc & lib eventually have two "L" letters (supposed be sqlite not sqllite). Because of these reasons it doesn't work at all. No-one is forced to answer, I rebuilt lib and inc files myself. Just wanted to state that sqlite3 is great.
There is the same problem with Hutch's import library, now I realised this fact. I extracted the PROTOs from this lib.
I uploaded my version (with some EQU's) of lib&inc, I'm just writing an app with sqlite3, this works for sure.
[attachment deleted by admin]
Nice work :U
I reduced the size of the import library from 68.2 Kb to 23.4 Kb
[attachment deleted by admin]
:clap: You are the boss :bg works OK
The trick is to convert your include file to import library with inc2lib.
Nice work. :)
Anyone have a demo handy for us SQL noobs? :bg
I hope it will be a dictionary... Now my little prog is capable to create new data base, create table and insert some text into them. It is a matter of time... After I add some more features (searching etc.) I'll be glad to share my knowledge (sourcecode).
OK my little app, I hope not to early...
How it works:
1) The main db (in my case "moby_dic.db") is created or opened (if already...) (CREATE TABLE statement) which consist of 4 columns (fields);
2) U write some text into first 4 edit-boxes and press Enter button - now one record is saved (INSERT statement);
3) U write some text in 5-th edit-box (perform a search by whole word you entered in first edit-box - SELECT statement);
For clarity a MessageBox will appear in each step.
Hope you'll like it...
[attachment deleted by admin]
ramguru,
Thanks! Another tool for my toolbox. I'll be playing with this today.
farrier
This is the last update of the demo... If there will be one in future, it will be not very soon. Now my app supports unicode, shows total number of records. If some-one is interested in conversion between unicode and utf8, yuo can find the routines in source...
[attachment deleted by admin]
Nice Job Ramguru. Nice skining example too. :)
Edit: There is a new version of the sqlite dll available, get it from http://www.sqlite.org/
Edit2: Actually here's a freshly built package with libs and inc. (Partial courtesy of Erol's Lib2Inc.) The MobyDic example compiles fine with these libs, but this has otherwise not been tested so consider it beta software.
[attachment deleted by admin]
Thank for this sqlite lib/ibc/dll combo.
Now i can write a simple app reading tables from mdb or sqlite database.
I read many docs about that but i ask your opinions (i'm a noob in database apps).
access mdb pros: popular fileformat, easy to use with odbc, some self-repair feature (redundant format?)
acces mdb cons: no transactions (commit/rollback), nonfree acces runtime needed
sqlite pros: free, robust, transactions, odbc driver (in alpha stage)
sqlite cons: some missing SQL-92 functions
What will happens if database get corrupted, all data will lost?
Which is better, all tables in one file or split database into more files and attach them into one virtual database ? (sqlite3 can do that)
Here is my sample sqlite code (if someone need i will post more)
;
; Get column names to dest listview
;
SQLite3_GetColumns proc uses edi hStmt:DWORD,hDest:DWORD,lpColW:DWORD,iStart:DWORD
LOCAL nCol:DWORD
LOCAL lvc:LV_COLUMN
invoke sqlite3_step,hStmt
invoke SQLite3_CheckError
invoke sqlite3_column_count,hStmt
mov maxCol,eax
mov eax,iStart
mov nCol,eax
mov edi,lpColW
.while eax!=maxCol
invoke sqlite3_column_name,hStmt,nCol
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH+LVCF_FMT
mov lvc.pszText,eax
mov eax,[edi]
mov lvc.lx,eax
add edi,4
mov lvc.fmt,LVCFMT_LEFT
invoke sqlite3_column_type,hStmt,nCol
invoke SendMessage,hDest, LVM_INSERTCOLUMN,nCol,addr lvc
inc nCol
mov eax,nCol
.endw
invoke sqlite3_reset,hStmt
invoke SQLite3_CheckError
ret
SQLite3_GetColumns endp
SQLite3_Get1RowLV proc uses ebx hStmt:DWORD,hDest:DWORD,iStart:DWORD
LOCAL lvi:LV_ITEM
LOCAL nCol:DWORD
mov eax,iStart
mov nCol,eax
.while eax!=maxCol
invoke sqlite3_column_text,hStmt,nCol
mov ebx,nCol
.if ebx==iStart
push eax
pop lvi.pszText
mov lvi.imask, LVIF_TEXT
push ActRow
pop lvi.iItem
push ActRow
pop lvi.lParam
mov lvi.iSubItem,0
invoke SendMessage,hDest,LVM_INSERTITEM, 0,addr lvi
.else
push eax
pop lvi.pszText
push nCol
pop lvi.iSubItem
.if iStart==1
dec lvi.iSubItem
.endif
invoke SendMessage,hDest,LVM_SETITEM, 0,addr lvi
.endif
inc nCol
mov eax,nCol
.endw
inc ActRow
ret
SQLite3_Get1RowLV endp
SQLite3_GetAllRowLV proc hStmt:DWORD,hDest:DWORD,iStart:DWORD
mov ActRow,0
invoke sqlite3_step,hStmt
.while eax==SQLITE_ROW
invoke SQLite3_Get1RowLV,hStmt,hDest,iStart
invoke sqlite3_step,hStmt
.endw
push ActRow
pop maxRow
ret
SQLite3_GetAllRowLV endp
SQLite3_GetTableLV proc lpTable:DWORD,hDest:DWORD,lpColW:DWORD,iStart:DWORD
LOCAL buffer[256]:BYTE
LOCAL hStmt:DWORD
invoke lstrcpy,addr buffer,StrAddr ( "SELECT * FROM " )
invoke lstrcat,addr buffer,lpTable
invoke sqlite3_prepare,hDB,addr buffer,-1,addr hStmt,NULL
invoke SQLite3_CheckError
invoke SQLite3_GetColumns,hStmt,hDest,lpColW,iStart
invoke SQLite3_GetAllRowLV,hStmt,hDest,iStart
invoke sqlite3_reset,hStmt
invoke SQLite3_CheckError
invoke sqlite3_finalize,hStmt
invoke SQLite3_CheckError
mov eax,hDest
mov lvsort.handle,eax
mov lvsort.direction,FALSE ; false = forward/ true = rev
mov lvsort.column,0
mov lvsort.stype,1 ; 1 = text
invoke SendMessage, hDest, LVM_SORTITEMSEX, addr lvsort, addr LVSortProc
ret
SQLite3_GetTableLV endp
Here's the latest stable SQLite 3.4.2 .DLL and includes, plus a console-mode testbed app illustrating many SQLite commands and features with customizable error reporting and even a nifty hand-made SQL3 icon. The .inc, .def, and .lib files were made with Erol's DLL2INC and Pelle's POLIB utility. Comments welcome. :U
Quote from: AMD XP 2500+ console window
SQLite3 Sample Application by MCJ 2007
DB File: SQLiteTest.db
Press a key to open/create database.
...Done.
Press a key to query SQLite_Master.
table, Table1, Table1, 2, CREATE TABLE 'Table1'(
[ID] int PRIMARY KEY
,[Name] varchar
,[Handle] varchar
,[Likes] varchar
,[Dislikes] varchar
)
table, sqlite_stat1, sqlite_stat1, 4, CREATE TABLE sqlite_stat1(tbl,idx,stat)
Press a key to show Table1 contents...
Edit: minor optimizations.
[attachment deleted by admin]
Hi Mark,
Thanks for the example.
I rebuilt the import library with def2lib.exe Could you try this new version of sqlite3.lib on your system?
def2lib sqlite3.def
[attachment deleted by admin]
Sure, I reassembled the project with this .lib and it works. To thoroughly test any .lib however, more than three exports should be tested. :P
The new .lib is 230 bytes smaller. Curious, do you think there is much of a difference in the two?
It seems like "DEF2LIB" is only one step away from "DLL2LIB." :wink
Hi Mark,
The new import library does not have any debug sections, this is why it's smaller. Coding a dll2lib to create import libraries from DLLs is possible but such a tool would have very limited functionnality because DLLs does not contain any information about the number of parameters passed to each exported function.
i have attached a chm which can be used as a reference
QuoteThis page defined the C-language interface to SQLite. This page is intended as a reference to what SQLite is suppose to do. This is not a tutorial. This page is designed to be precise, not easy to read.
This page contains all C-language interface information in a single HTML file. The same information is also available broken out into lots of small pages for easier viewing, if you prefer.
The content on this document is extracted from comments in the source code.
[attachment deleted by admin]
Sameer,
Thanks for putting all this information together in one very useful file. It will help me, as I am using SQLite more and more.
I appreciate this!
farrier
Hi Farrier & Vortex,
Any chance of converting the C native connector for MYSQL to an ASM Lib and Inc ? I have played around with
the OBDC connector in the past - I was able to successfully connect to the DBase and do simple queries - but the
more complex SQL API calls effectively made me loose interest (wildcard bind etc.). I understand the C native
connector greatly reduces speed and complexity.
Thanx
Draakie
Draakie,
I started to try MySQL--just sold for 1 BILLLLion dollars to Sun--but I gave up when I started using SQLite. It does everyhthing I need, is small fast and open!
farrier
Hi Farrier,
"....is small fast and open"
Unfortunately for my needs, that's the problem. I need something that can do replication, huge databases, backup & roll-back,
web hosting support etc. Thus MySQL. Hope you can still help though..... :U
Draakie
Thanks to Erol for the DEF2LIB utility, here's a newer SQLite DLL v3.5.4 and .def/.inc/.lib files.
[attachment deleted by admin]
These need to be added to the sqlite3.inc file:
SQLITE_OPEN_READONLY equ 00000001h
SQLITE_OPEN_READWRITE equ 00000002h
SQLITE_OPEN_CREATE equ 00000004h
SQLITE_OPEN_DELETEONCLOSE equ 00000008h
SQLITE_OPEN_EXCLUSIVE equ 00000010h
SQLITE_OPEN_MAIN_DB equ 00000100h
SQLITE_OPEN_TEMP_DB equ 00000200h
SQLITE_OPEN_TRANSIENT_DB equ 00000400h
SQLITE_OPEN_MAIN_JOURNAL equ 00000800h
SQLITE_OPEN_TEMP_JOURNAL equ 00001000h
SQLITE_OPEN_SUBJOURNAL equ 00002000h
SQLITE_OPEN_MASTER_JOURNAL equ 00004000h
And this... first person to convert it to masm-syntax gets a cookie! :toothy
typedef struct sqlite3_vfs sqlite3_vfs;
struct sqlite3_vfs {
int iVersion; /* Structure version number */
int szOsFile; /* Size of subclassed sqlite3_file */
int mxPathname; /* Maximum file pathname length */
sqlite3_vfs *pNext; /* Next registered VFS */
const char *zName; /* Name of this virtual file system */
void *pAppData; /* Pointer to application-specific data */
int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
int flags, int *pOutFlags);
int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
int (*xAccess)(sqlite3_vfs*, const char *zName, int flags);
int (*xGetTempname)(sqlite3_vfs*, int nOut, char *zOut);
int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
void *(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol);
void (*xDlClose)(sqlite3_vfs*, void*);
int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
int (*xSleep)(sqlite3_vfs*, int microseconds);
int (*xCurrentTime)(sqlite3_vfs*, double*);
/* New fields may be appended in figure versions. The iVersion
** value will increment whenever this happens. */
};
It's a structure like this.
sqlite3_vfs STRUCT
iVersion DWORD ? ;/* Structure version number */
szOsFile DWORD ? ;/* Size of subclassed sqlite3_file */
mxPathname DWORD ? ;/* Maximum file pathname length */
pNext DWORD ? ;/* Next registered VFS */
zName DWORD ? ;/* Name of this virtual file system */
pAppData DWORD ? ;/* Pointer to application-specific data */
func1 DWORD ?
func2 DWORD ?
func3 DWORD ?
func4 DWORD ?
func5 DWORD ?
func6 DWORD ?
func7 DWORD ?
func8 DWORD ?
func9 DWORD ?
func10 DWORD ?
func11 DWORD ?
func12 DWORD ?
sqlite3_vfs ENDS
func1, func2, func3... are pointers to functions.
Yay, a cookie for you. (Wow it's been 10 months?) :bg
Hahaha. 10 months is a long time. I work with SQLite in a lot of my projects so I'm used to the API now :green
Have you guys got an updated version of the files?
Thanks