Re: [sqlite] How to get PRIMARY KEY of newly INSERT INTO record
Cool! That worked. The VB6 wrapper has a LastInsertAutoID that I never paid attention / saw before. I will use the other SQL statement that you mentioned for the C/C++ stuff. Awesome! Thanks again :-), Sarah -- View this message in context: http://www.nabble.com/How-to-get-PRIMARY-KEY-of-newly-INSERT-INTO-record-tp23083322p23084501.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to get PRIMARY KEY of newly INSERT INTO record
Hi, I am using both VB6 and C/C++ to interface to a SQLITE3 database. If I execute a command that inserts a new record, such as: 'Set the various columns strUpdate = ", dataCol2, dataCol3, ..., dataColN" 'Create the SQL command. strSQLCommand = "INSERT INTO " + strDBTable + " VALUES (null" + strUpdate + ");" 'DATABASE: Execute the query. bSuccess = Me.DBConnection.Execute(strSQLCommand) I realize that I can issue a SELECT statement immediately afterwards, such as: SELECT IDPrimary FROM myTable ORDER BY IDPrimary DESC and that with some data comparison can yield me the primary key of the newly inserted record, but this method is slow, not very elegant, and if multiple people use the database at the same time, the result may not be accurate. QUESTION: How do I get the primary key of the newly inserted record? Is there some sort of handle that comes back to the newly inserted record? For whatever it is worth, I am using the dhRichclient library from thecommon.net as a VB6 wrapper, but that is meaningless, as I can use the sqlite library directly with C++ and I would still have the same question or write my own wrapper. I did a search on Google but could not find anything. :-( Thanks in advance, Sarah. -- View this message in context: http://www.nabble.com/How-to-get-PRIMARY-KEY-of-newly-INSERT-INTO-record-tp23083322p23083322.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] any data access and retrieval engine?
Hi, John Stanton I really really appreciate your warm help. That's great if you can send me the codes of B tree and B+ tree. Many thanks in advance. My requirements for data access are as follows: -all the data are stored in non-volatile memory instead of volatile memory -the footprint of the DARE should be better less than 100KB -when executing, the memory occupation should be better less than 20KB -no need for relational access, just key-value retrieval is ok -all the create, insert, update work can be done outside, however, pretty fast retrieval is needed If there is some open-source DARE(as excellent as SQLite) suitable for my platform, that will be great. Orelse, I would try to write a simple one. Sarah - Original Message - From: "John Stanton" <[EMAIL PROTECTED]> To: Sent: Monday, October 23, 2006 5:54 AM Subject: Re: [sqlite] any data access and retrieval engine? > Clay Dowling wrote: >> Sarah wrote: >> >>>Hi,all >>> >>>First of all, I want to thank all the guys on this mailing list for their >>>warm help. >>> >>>After 1 more month of work, I finally make SQLite work on my embedded >>>environment. SQLite is really great! Many thanks,Drh. >>> >>>But, due to the extremely heavy hardware constraints, I have to give up >>>SQLite finally. >>> >>>So I'm trying to find a much simpler data access and retrieval engine. >>> >>>Could anyone give me some help on this issue?(some guidance on how to make a >>>DARE or is there any open-source one available?) >>> >>>thanks in advance. >> >> >> The Berkeley DB engine and it's related engines might be suitable for >> your situation. They don't give relational access, but they do give >> fast key=>value retreival and that might be suitable. The SleepyCat DB >> engine from SleepyCat Software is probably the best, but for a >> commercial application the licensing fees mean that you have to be well >> funded and expect a good return on the product. >> >> Clay Dowling > Berkely DB is still quite bloated. What do you require for data access? > For an embedded system you might find something which matches your > needs very well and has a tiny footprint. > > I can give you some B* Tree code which is suitable for a high > performance simple and lightweight embedded application or some AVL tree > code which would suit a simpler smaller scale memory resident embedded > data access application. You would have to adapt it to your > application, but could expect to get your database access in 20K or less > of executable image. Of course you have no SQL. > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - >
[sqlite] any data access and retrieval engine?
Hi,all First of all, I want to thank all the guys on this mailing list for their warm help. After 1 more month of work, I finally make SQLite work on my embedded environment. SQLite is really great! Many thanks,Drh. But, due to the extremely heavy hardware constraints, I have to give up SQLite finally. So I'm trying to find a much simpler data access and retrieval engine. Could anyone give me some help on this issue?(some guidance on how to make a DARE or is there any open-source one available?) thanks in advance.
[sqlite] Can anyone recommend some ISAM db to me?
Hi, all After trying SQLite on my embedded platform, I feel that it's a little too complicated and time-consuming to my platform, especially the parsing. So, could someone recommend several ISAM ones to me?(I'm a newbie of database*^_^*)
[sqlite] about temp table
Hi,all I met some problem when executing the following test program in an embedded environment without os. It seems that temp table isn't created correctly. sqlite3_exec(db, "create table myt(age smallint)", NULL, NULL, NULL); Could someone explain 'the functionality of temp table and when it is created' for me? Or give me some links to the web page about temp table. If I define OMIT_TEMPTABLE, then what's the consequence? Thanks.
Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment
Hi, When you ported sqlite to your os-less ARM based platform, did you do any other changes to the sqlite source code? I'm facing new problems right now. the record cann't be inserted correctly when I execute the following statements. .. char * database = ":memory:"; sqlite3 * db; sqlite3_open(database, &db); sqlite3_exec(db, "create table myt(name varchar(30),age smallint)", NULL, NULL, NULL); sqlite3_exec(db, "insert into myt values('sarah',27)", NULL, NULL, NULL); sqlite3_exec(db, "select * from myt", NULL, NULL, NULL); sqlite3_close(db); .. The behavior is that , when executing "insert into myt values('sarah',27)", the program goes into the following statements in sqlite3RunParser() and returns SQLITE_NOMEM. How and why? .. abort_parse: if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){ if( lastTokenParsed!=TK_SEMI ){ sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse); pParse->zTail = &zSql[i]; } sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse); } sqlite3ParserFree(pEngine, sqlite3FreeX); if( sqlite3MallocFailed() ){ pParse->rc = SQLITE_NOMEM; } .. I totally have no idea of the principals of parser and how it works. Could someone tell me or give me some links? finally, a stupid question: should I add a semicolon at the end of the sql statement in sqlite3_exec(); Will that affect the execution of parser? a lot of thanks! - Original Message - From: "Barrass, Richard" <[EMAIL PROTECTED]> To: Sent: Tuesday, September 12, 2006 7:41 PM Subject: RE: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment Hi We have sqlite (v3.3.7) running on an os-less ARM based platform - we use MINGW cross compilers (GCC3.4.4) - from CodeSourcery. There was an issue earlier on that seems to be an issue with 64 bit support - we switched off the 64bit support in the compilation of the sqlite library and this for now has got the data base up and running on our platform. Richard -Original Message- From: Nuno Lucas [mailto:[EMAIL PROTECTED] Sent: 11 September 2006 21:12 To: sqlite-users@sqlite.org Subject: Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment [forgot to reply to the list] -- Forwarded message -- From: Nuno Lucas <[EMAIL PROTECTED]> Date: Sep 11, 2006 9:07 PM Subject: Re: Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment To: [EMAIL PROTECTED] On 9/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I don't think NULL callback and error pointer will be the reason. > Because I've seen this kind of usage in the list for several times. As I said earlier, I don't think this is the reason also. Just one more thing you could check. > Anyway, I'll try later and report the result to the list. > > If it is a misaligned-pointer problem, what can I do? > > I don't make any change to the sqlite source code, how should this > happen? I can run it correctly on PC(windows XP), why can't in an > embedded environment? I'm confused... You are aware they are completely different architectures, don't you? You also didn't specify what OS you are running, which could make it easier to get help from other experienced programmers for your platform (if you are using CodeWarrior I would guess it's not Windows CE). A misaligned-pointer can never occur on Windows (desktop editions, not Windows CE), because Windows only runs on the Intel x86 processor family, which mask that kind of things from you (although you usually have a performance hit). Basically it means you are accessing memory that is not aligned to the minimum granularity the processor supports (which depends on the processor and processor mode, but usually is 32 bits - 4 bytes - for 32-bits cpus, 64 bits - 8 bytes - for 64-bits cpus, etc). I don't know if that is your case, but I have seen it before on Windows CE (using a StrongArm processor) and because there aren't so many people using SQLite with those processors, the code path is not so much tested as the x86 case (which doesn't trigger a cpu exception, only a performance hit). It's up to you to confirm this is the case, but there are other things which can be wrong, like little/big endian problems, compiler bugs (recent platforms don't have so much testing as older ones), bad compiler/linker options, stack overflows (because in embedded systems you usually have a much lower default stack size), etc. Without more info that's all I can say. Regards, ~Nuno Lucas --
Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment
I've got the reason. That is because some stupid mistake I've made. During the execution of sqlite3Parser(), realloc() is called. Because here SQLite is running in an embedded environment without OS, so I need to wrap realloc() of my platform. I just wrapped malloc() and free(), but forgot this one. In my malloc() and free(), I have the mechanism to guarantee the alignment of 32-bits. Thank you very much for the help! - Original Message - From: "Barrass, Richard" <[EMAIL PROTECTED]> To: Sent: Tuesday, September 12, 2006 7:41 PM Subject: RE: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment Hi We have sqlite (v3.3.7) running on an os-less ARM based platform - we use MINGW cross compilers (GCC3.4.4) - from CodeSourcery. There was an issue earlier on that seems to be an issue with 64 bit support - we switched off the 64bit support in the compilation of the sqlite library and this for now has got the data base up and running on our platform. Richard -Original Message- From: Nuno Lucas [mailto:[EMAIL PROTECTED] Sent: 11 September 2006 21:12 To: sqlite-users@sqlite.org Subject: Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment [forgot to reply to the list] -- Forwarded message -- From: Nuno Lucas <[EMAIL PROTECTED]> Date: Sep 11, 2006 9:07 PM Subject: Re: Re: [sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment To: [EMAIL PROTECTED] On 9/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I don't think NULL callback and error pointer will be the reason. > Because I've seen this kind of usage in the list for several times. As I said earlier, I don't think this is the reason also. Just one more thing you could check. > Anyway, I'll try later and report the result to the list. > > If it is a misaligned-pointer problem, what can I do? > > I don't make any change to the sqlite source code, how should this > happen? I can run it correctly on PC(windows XP), why can't in an > embedded environment? I'm confused... You are aware they are completely different architectures, don't you? You also didn't specify what OS you are running, which could make it easier to get help from other experienced programmers for your platform (if you are using CodeWarrior I would guess it's not Windows CE). A misaligned-pointer can never occur on Windows (desktop editions, not Windows CE), because Windows only runs on the Intel x86 processor family, which mask that kind of things from you (although you usually have a performance hit). Basically it means you are accessing memory that is not aligned to the minimum granularity the processor supports (which depends on the processor and processor mode, but usually is 32 bits - 4 bytes - for 32-bits cpus, 64 bits - 8 bytes - for 64-bits cpus, etc). I don't know if that is your case, but I have seen it before on Windows CE (using a StrongArm processor) and because there aren't so many people using SQLite with those processors, the code path is not so much tested as the x86 case (which doesn't trigger a cpu exception, only a performance hit). It's up to you to confirm this is the case, but there are other things which can be wrong, like little/big endian problems, compiler bugs (recent platforms don't have so much testing as older ones), bad compiler/linker options, stack overflows (because in embedded systems you usually have a much lower default stack size), etc. Without more info that's all I can say. Regards, ~Nuno Lucas - To unsubscribe, send email to [EMAIL PROTECTED] - _ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment
plus, I'm using sqlite-source-3_3_5. I also find a wired phenomenon: When I trace into sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse); the next executed statement pointed by debugger does not match with the real one, It seems there are one or two lines space. That is to say, the debugger arrow doesn't point to the real statement which is going to be executed next. - Original Message ----- From: Sarah To: sqlite-users@sqlite.org Sent: Monday, September 11, 2006 7:22 PM Subject: met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment Hi,all During the execution of a test program in an embedded environment, after it goes into sqlite3_exec()-->sqlite3_prepare()-->sqlite3RunParser(&sParse, zSql, &zErrMsg), the debugger pops "the ARM7TDMI raised an exception,data abort" when the following sentence is executed(bold and underlined): ... abort_parse: ... sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse); ... After "data abort" happens, the debugger stops at assembly languages like this(pointed by an arrow): ... [0xbc38] pop {r3-r5} [0xbc08] pop {r3} [0x4718] bx r3 [0x6868] ldr r0,[r5,#4] [0x1c29] mov r1,r5 [0x2800] cmp r0,#0 [0xd018] beq 0x42fc4 ; (__Heap_Alloc + 0x5a) --> [0x6802] ldr r2,[r0,#0] [0x42a2] cmp r2,r4 [0xd311] bcc 0x42fbc ; (__Heap_Alloc + 0x52) [0x1c23] mov r3,r4 [0x6802] ldr r2,[r0,#0] ... When I trace into sqlite3Parser(),it seems like the error is caused by "yy_reduce(yypParser,yyact-YYNSTATE);" My test program is like this: { char * database = ":memory:"; sqlite3 * db; sqlite3_open(database, &db); sqlite3_exec(db, "create table myt(age smallint)", NULL, NULL, NULL); } sqlite3_open() runs successfully. And CPU type is ARM7TDMI, no operating system is used, such as linux. I'm totally confused. Please help me diagnose this error. Any little help will be appreciated. Sarah
[sqlite] met "ARM7TDMI raised an exception,data abort" when executing sqlite3Parser() in ARM environment
Hi,all During the execution of a test program in an embedded environment, after it goes into sqlite3_exec()-->sqlite3_prepare()-->sqlite3RunParser(&sParse, zSql, &zErrMsg), the debugger pops "the ARM7TDMI raised an exception,data abort" when the following sentence is executed(bold and underlined): ... abort_parse: ... sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse); ... After "data abort" happens, the debugger stops at assembly languages like this(pointed by an arrow): ... [0xbc38] pop {r3-r5} [0xbc08] pop {r3} [0x4718] bx r3 [0x6868] ldr r0,[r5,#4] [0x1c29] mov r1,r5 [0x2800] cmp r0,#0 [0xd018] beq 0x42fc4 ; (__Heap_Alloc + 0x5a) --> [0x6802] ldr r2,[r0,#0] [0x42a2] cmp r2,r4 [0xd311] bcc 0x42fbc ; (__Heap_Alloc + 0x52) [0x1c23] mov r3,r4 [0x6802] ldr r2,[r0,#0] ... When I trace into sqlite3Parser(),it seems like the error is caused by "yy_reduce(yypParser,yyact-YYNSTATE);" My test program is like this: { char * database = ":memory:"; sqlite3 * db; sqlite3_open(database, &db); sqlite3_exec(db, "create table myt(age smallint)", NULL, NULL, NULL); } sqlite3_open() runs successfully. And CPU type is ARM7TDMI, no operating system is used, such as linux. I'm totally confused. Please help me diagnose this error. Any little help will be appreciated. Sarah
Re: [sqlite] How to edit Makefile.linux-gcc to define those SQLITE_OMIT_*?
Hi, I've added the following lines in the Makefile.linux-gcc file: OPTS += -DSQLITE_OMIT_ALTERTABLE OPTS += -DSQLITE_OMIT_AUTHORIZATION OPTS += -DSQLITE_OMIT_AUTOVACUUM OPTS += -DSQLITE_OMIT_AUTOINCREMENT OPTS += -DSQLITE_OMIT_BLOB_LITERAL OPTS += -DSQLITE_OMIT_COMPLETE OPTS += -DSQLITE_OMIT_COMPOUND_SELECT OPTS += -DSQLITE_OMIT_CONFLICT_CLAUSE OPTS += -DSQLITE_OMIT_EXPLAIN OPTS += -DSQLITE_OMIT_FLOATING_POINT OPTS += -DSQLITE_OMIT_FOREIGN_KEY OPTS += -DSQLITE_OMIT_INTEGRITY_CHECK OPTS += -DSQLITE_OMIT_PAGER_PRAGMAS OPTS += -DSQLITE_OMIT_PRAGMA OPTS += -DSQLITE_OMIT_REINDEX OPTS += -DSQLITE_OMIT_SCHEMA_PRAGMAS OPTS += -DSQLITE_OMIT_SCHEMA_VERSION_PRAGMAS OPTS += -DSQLITE_OMIT_SUBQUERY OPTS += -DSQLITE_OMIT_TCL_VARIABLE OPTS += -DSQLITE_OMIT_TRIGGER OPTS += -DSQLITE_OMIT_DATETIME_FUNCS but the result is still the same. The footprint has not been changed. And during make, I noticed that these new-added -DSQLITE_OMIT_XX did not appeared in the command lines. Why? Is there any other file I need to update? Thanks in advance. - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Friday, August 25, 2006 6:35 PM Subject: Re: [sqlite] How to edit Makefile.linux-gcc to define those SQLITE_OMIT_*? "Sarah" <[EMAIL PROTECTED]> wrote: > Hi,all > > In order to define those SQLITE_OMIT_TRIGGER,SQLITE_OMIT_ALTERTABLE..., I > have to rebuild parse.c > from parse.y. So I took the following steps to do it under linux(Fedora 2). > > But by comparing the generated static library, I find that no difference has > been made > and the footprint is still the same. > > I'm not familiar with linux. So I guess the way I edit Makefile.linux-gcc is > wrong. > My steps are as follows: > 1.Edit Makefile.linux-gcc,add the following sentences directly into it: > -DSQLITE_OMIT_TRIGGER > -DSQLITE_OMIT_ALTERTABLE > -DSQLITE_OMIT_VIEW > -DSQLITE_OMIT_AUTHORIZATION Should be: OPTS += -DSQLITE_OMIT_TRIGGER and so forth. > ... > 2.run ..>../configure > 3.run ..>make > 4.generate lib, run ..>ar cr libsqlite.a *.o > 5.compare the footprint of generated sqlite.a with the one without defining > -DSQLITE_OMIT_* in Makefile.linux-gcc. > totally the same. > > Any help will be appreciated.. > > Sarah - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] How to edit Makefile.linux-gcc to define those SQLITE_OMIT_*?
Hi,all In order to define those SQLITE_OMIT_TRIGGER,SQLITE_OMIT_ALTERTABLE..., I have to rebuild parse.c from parse.y. So I took the following steps to do it under linux(Fedora 2). But by comparing the generated static library, I find that no difference has been made and the footprint is still the same. I'm not familiar with linux. So I guess the way I edit Makefile.linux-gcc is wrong. My steps are as follows: 1.Edit Makefile.linux-gcc,add the following sentences directly into it: -DSQLITE_OMIT_TRIGGER -DSQLITE_OMIT_ALTERTABLE -DSQLITE_OMIT_VIEW -DSQLITE_OMIT_AUTHORIZATION ... 2.run ..>../configure 3.run ..>make 4.generate lib, run ..>ar cr libsqlite.a *.o 5.compare the footprint of generated sqlite.a with the one without defining -DSQLITE_OMIT_* in Makefile.linux-gcc. totally the same. Any help will be appreciated.. Sarah
[sqlite] a problem met in tracing
Hi,everyone, I have ported SQLite to an embedded platform. When I debugged on this platform, I met following problems: 1. in process_input(), part of codes are like this: .. open_db(p); rc = sqlite3_exec(p->db, zSql, NULL, p, &zErrMsg); .. it's strange that, after sqlite3_exec executed, it didn't return back to process_input(), but returned to the next statement of sqlite3_exec() in function sqlite3InitCallback(). What's the possible reason for this? 2. What is the consequence of defining SQLITE_OMIT_DISKIO? that is to say, what the DISKIO do? 3.When I define #define SQLITE_OMIT_ALTERTABLE and #define SQLITE_OMIT_TRIGGER in my program, it caused a lot of compiling and linking errors, most of them comes form parse.o. How to fix these errors? Any guide will be appreciated.
[sqlite] why I can't find the implementation of functions in IoMethod structure?
Why I can't find the implementation of functions(xClose, xRead, xWrite, xSeek) in IoMethod in the whole SQLite project? Are these functions implemented in OS level? Can anyone help me?
Re: [sqlite] Another question about RAM
Can anyone give me some guide? - Original Message - From: "Sarah" <[EMAIL PROTECTED]> To: Sent: Thursday, July 27, 2006 3:47 PM Subject: [sqlite] Another question about RAM > Hi, all > > I want to build SQLite on the uc/os-II kernel in an embedded device. > > Because uc/os-II doesn't provide malloc(), free() to manage memory, instead, > it divides the memory into fixed-length blocks and provides OSMemGet() and > OSMemPut() to > get and put fixed-length memory block. > > In order to port SQLite, I have to wrap uc/os-II with a set of standard > memory management APIs(malloc, free...). > So I need to decide in advance that which 'fixed length' will be better. That > is to say, when using malloc() to > allocate memory in SQLite, how much memory is needed in most cases? what does > it depend on? > > Thanks. > >
[sqlite] Another question about RAM
Hi, all I want to build SQLite on the uc/os-II kernel in an embedded device. Because uc/os-II doesn't provide malloc(), free() to manage memory, instead, it divides the memory into fixed-length blocks and provides OSMemGet() and OSMemPut() to get and put fixed-length memory block. In order to port SQLite, I have to wrap uc/os-II with a set of standard memory management APIs(malloc, free...). So I need to decide in advance that which 'fixed length' will be better. That is to say, when using malloc() to allocate memory in SQLite, how much memory is needed in most cases? what does it depend on? Thanks.
[sqlite] How to configure to reduce the RAM consumption?
Hi, all I'm using SQLite in an embedded device with uc/os-II OS kernel. Due to the extremely limited RAM size, I have to config the SQLite somehow to reduce the RAM consumption as much as possible. I guess there are some actions I can take, for instance, to disable page cache, to use hard disk(here is EEPROM) as temp. Right? But how? Can anyone guide me? Any other action I can take besides above? By the way, if I don't need to use lock mechanism in my device, can I disable it? how? Thanks.
Re: [sqlite] How to port SQLite to a uc/os-II OS with customized file system?
Thank you for your advice. If I skip the functionality of file locking, that is to say, in my project, I do not need to use the functionality of file locking, then which approach will be easier for me to wrap my self-defined file system to a set of standard interfaces? One is to wrap it to fit os_win.c; The other one is to wrap it to fit os_unix.c; - Original Message - From: "Christian Smith" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 21, 2006 7:04 PM Subject: Re: [sqlite] How to port SQLite to a uc/os-II OS with customized file system? Ҷ uttered: > Hi,all > > I'm trying to bulid a database engine based on uc/os-II RTOS with my own > customized file system(similar with FAT16, but not exactly the same). I > find that SQLite is a good choice. > > I have read the SQLite source code for several days, but I still have no > idea where I should begin with. > > SQLite is a db engine totally based on disk file. So I guess most of my > future work should be to wrap my self-defined file system to have the > same interface as needed in os_win.c. Is it correct? > > Could anyone give me some advice? Implement the interface defined by "struct IoMethod" in os.h. Use the existing os_*.c as templates, yes. If you can provide a largely posix like interface to your file system, you could use os_unix.c largely unchanged. You might want to strip out the nightmare locking code, though:) > > Another question: > > Because my project will run in an embedded environment, so I have to > take care of the RAM consumption. I have went through the mail list, but > not found the description of minimum RAM usage. > > Could anyone tell me how much RAM is needed to run SQLite in an embedded > environment? That depends. SQLite can have functionality conditionally compiled out, reducing it's size. The front page (http://www.sqlite.org/) proclaims: "Small code footprint: less than 250KiB fully configured or less than 150KiB with optional features omitted." YMMV. Your best bet is to choose the features you don't need, compile up your target library, and measure the code size yourself. > > Thanks in advance! > > Best regards, > > Sarah Christian -- /"\ \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \