[sqlite] SQLite3 API Reference omission
One thing I noticed in the API ref for sqlite3_bind_text() and sqlite3_bind_blob() is there's no info describing what the fourth arg is for. After some trial and error, I discovered it's to describe the length of the string/blob in the third arg (duh!) :-) -Clark
Re: [sqlite] Newbie API questions
--- Dennis Cote <[EMAIL PROTECTED]> wrote: > Jay Sprenkle wrote: > > >>[2] Looking at the sqlite3_bind_* APIs, I'm curious > about > >>the destructor functions, and the "special values", > >>SQLITE_STATIC, and SQLITE_TRANSIENT. Not being a C > >>programmer, these constants are a mystery to me. I > think > >>it'd be useful to use the sqlite3_bind_* APIs, but I > don't > >>have any clue what to do about the destructors. My > >>inclination is to use one of the special values, but I > >>don't think WinBatch is gonna understand. Wouldn't > these > >>just compile down to integers 0, or -1? Could I just > pass > >>them to the APIs as integers? > >> > >> > > > >These are defined using "#define". This is a text > substitution at compile > >time. If you look you'll see it's substituting integer > numbers for those > >name strings. It's done to make the code more readable. > Passing the > >appropriate integer value (taken from the #define) will > work just fine. > > > > > > > I will usually work just fine, but may fail for the same > reasons Henry > discussed about the sqlite structure handle. The > destructor argument to > the sqlite_bind calls are actually pointers, in this case > pointers to > functions. The special case values are replaced by the C > preprocessor > with expressions that cast the integer constants 0 and -1 > to the > required function pointer type. To call these APIs on a > machine with 64 > bit pointers and 32 bit integers you have the same issues > as with the > sqlite3 handle. You need to ensure that you pass a 64 bit > pointer to > these routines, passing integer values may not work. > > Dennis Cote > OK, good information from all. Thanks very much. It's helped me move on with the project. Obviously, this wrapper will be limited to 32 bit systems until WinBatch adds a function to read the 64 bit pointer from the buffer. Currently it maxes-out with a 32 bit read. I'll ask them about that. Short-term, I think I should be OK :-) -Clark
Re: [sqlite] What is SSE?
Wow, that is sure to cause some confusion with the instruction set! Just some friendly advice- is there a better name it could be given? On 5/27/05, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > On Fri, 2005-05-27 at 09:26 -0400, Ned Batchelder wrote: > > Every so often I check the CVS timeline > > (http://www.sqlite.org/cvstrac/timeline) to get a preview of the changes > > being checked in. It helps me know what to expect in upcoming releases. > > Lately Dan has been checking in stuff for "SSE". Do you mind if I ask: what > > is SSE? > > > > SSE is a proprietary extension for SQLite that allows SQLite to be > run on low-power, low-memory embedded devices. SSE separates the > SQL parser from the B-Tree backend. The parser runs on your development > platform and only the B-Tree backend needs to be put onto the > embedded device. This reduces the footprint of the library to > about 75KB, depending on what features you decide to leave out. > (Example: many embedded applications do not require the built-in > date/time functions which saves about 8KB.) > > SSE is proprietary. It is available by license only. It is designed > for use by embedded device manufacturers and is of little use to > open-source developers. The bulk of the SSE code is in a separate, > private source tree. But a few adjustments to the public domain > SQLite source base have needed to be made in order to properly > integrate SSE. It is those (relatively minor) adjustments that > you are seeing on the SQLite website. > -- > D. Richard Hipp <[EMAIL PROTECTED]> > > -- Cory Nelson http://www.int64.org
Re: [sqlite] Newbie API questions
Jay Sprenkle wrote: [2] Looking at the sqlite3_bind_* APIs, I'm curious about the destructor functions, and the "special values", SQLITE_STATIC, and SQLITE_TRANSIENT. Not being a C programmer, these constants are a mystery to me. I think it'd be useful to use the sqlite3_bind_* APIs, but I don't have any clue what to do about the destructors. My inclination is to use one of the special values, but I don't think WinBatch is gonna understand. Wouldn't these just compile down to integers 0, or -1? Could I just pass them to the APIs as integers? These are defined using "#define". This is a text substitution at compile time. If you look you'll see it's substituting integer numbers for those name strings. It's done to make the code more readable. Passing the appropriate integer value (taken from the #define) will work just fine. I will usually work just fine, but may fail for the same reasons Henry discussed about the sqlite structure handle. The destructor argument to the sqlite_bind calls are actually pointers, in this case pointers to functions. The special case values are replaced by the C preprocessor with expressions that cast the integer constants 0 and -1 to the required function pointer type. To call these APIs on a machine with 64 bit pointers and 32 bit integers you have the same issues as with the sqlite3 handle. You need to ensure that you pass a 64 bit pointer to these routines, passing integer values may not work. Dennis Cote
Re: [sqlite] how to list table making a view
Dennis Cote wrote: Noel Frankinet wrote: Lawrence Chitty wrote: You may be able to do this using the 'explain' statement for example, I have a view called 'myview'. Wrapping this into an sql select statement and proceeding this with explain e.g. > explain select null from myview gives a result set with the following:- addropcodep1p2p3 0ColumnName00null 1ColumnName10TEXT 2Integer00 3OpenRead1228mytable1 4VerifyCookie03016 5Integer00 6OpenRead217mytable2 7Rewind113 8Rewind212 9String00 10Callback10 11Next29 12Next18 13Close10 14Close20 15NullCallback10 16Halt00 All you need to do now is search through the result set for any opcode that is OpenRead, and the table name is in the p3 (last) column. As you can see, myview consists of mytable1 and mytable2 Thank you that's what I was looking for. Noel and Lawrence, You should note that this will only work if your sqlite library is compiled without NDEBUG defined (i.e. only in a debug build). In debug builds, the table names in the explain output are generated by taking the root page number that is actually stored in the compiled VM and looking up the corresponding table name in the sqlite_master table. Production builds (which are substantially faster) don't do this, they simply display the root page number. You can of course do the lookup in the sqlite_master table yourself, but I don't know if there is a good way to tell if you are using a debug or production build. You can't simply check if the table name is numeric because someone could create a table with a numeric name. Some of the pragmas, like parser_trace, don't work in production builds, but don't generate any errors either. If anyone knows how to tell if the sqlite library was built with NDEBUG defined, this could be made to work well enough. HTH Dennis Cote Thank you Dennis, so I'm back to my original question, is parsing the DDL from sqlite_master is a viable (good ?) option. Is there a way to do it with salite itself (there surely is way but can hook into it). Or should I rely on my homegrown half-backed SQL parser ? Regards -- Noël Frankinet Gistek Software SA http://www.gistek.net
RE: [sqlite] database disk image is malformed
On Fri, 27 May 2005, Drew, Stephen wrote: >Sorry for the lack of information. > >I'm using Windows 2000, the file is on a local drive with full access >permissions. I've done some checking on memory over the last few weeks, >but nothing conclusive so I will give this a go. > >The odd thing is it happens during a piece of functionality that is used >continuously, yet the error only surface occasionally, and the disk >image is no longer malformed when I restart the application. Why do you think the disk image is malformed? Do you get a SQLITE_CORRUPT error? What functionality are you using when you get the error? Is it always the same functionality and/or the same error? > >Thanks. >Steve > >-Original Message- >From: Christian Smith [mailto:[EMAIL PROTECTED] >Sent: 26 May 2005 17:34 >To: sqlite-users@sqlite.org >Subject: Re: [sqlite] database disk image is malformed > >On Thu, 26 May 2005, Drew, Stephen wrote: > >>Hello, >> >>Assuming there is no external interference, how could one cause this >>error to occur through embedded use of SQLite? And why, following a >>restart of my application, does it not happen again immediately? It >>seems most odd... >> >>Any clues would be most appreciated. This is SQLite 2.8.15. > > >Without details, it's difficult to say. What platform you running on? Is >the file on a network drive? Have you checked your application against >buffer overruns and stray pointers? > > >> >>Regards, >>Steve >> > > -- /"\ \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \
Re: [sqlite] What is SSE?
On Fri, 2005-05-27 at 09:26 -0400, Ned Batchelder wrote: > Every so often I check the CVS timeline > (http://www.sqlite.org/cvstrac/timeline) to get a preview of the changes > being checked in. It helps me know what to expect in upcoming releases. > Lately Dan has been checking in stuff for "SSE". Do you mind if I ask: what > is SSE? > SSE is a proprietary extension for SQLite that allows SQLite to be run on low-power, low-memory embedded devices. SSE separates the SQL parser from the B-Tree backend. The parser runs on your development platform and only the B-Tree backend needs to be put onto the embedded device. This reduces the footprint of the library to about 75KB, depending on what features you decide to leave out. (Example: many embedded applications do not require the built-in date/time functions which saves about 8KB.) SSE is proprietary. It is available by license only. It is designed for use by embedded device manufacturers and is of little use to open-source developers. The bulk of the SSE code is in a separate, private source tree. But a few adjustments to the public domain SQLite source base have needed to be made in order to properly integrate SSE. It is those (relatively minor) adjustments that you are seeing on the SQLite website. -- D. Richard Hipp <[EMAIL PROTECTED]>
[sqlite] What is SSE?
Every so often I check the CVS timeline (http://www.sqlite.org/cvstrac/timeline) to get a preview of the changes being checked in. It helps me know what to expect in upcoming releases. Lately Dan has been checking in stuff for "SSE". Do you mind if I ask: what is SSE? --Ned. http://nedbatchelder.com
RE: [sqlite] database disk image is malformed
Sorry for the lack of information. I'm using Windows 2000, the file is on a local drive with full access permissions. I've done some checking on memory over the last few weeks, but nothing conclusive so I will give this a go. The odd thing is it happens during a piece of functionality that is used continuously, yet the error only surface occasionally, and the disk image is no longer malformed when I restart the application. Thanks. Steve -Original Message- From: Christian Smith [mailto:[EMAIL PROTECTED] Sent: 26 May 2005 17:34 To: sqlite-users@sqlite.org Subject: Re: [sqlite] database disk image is malformed On Thu, 26 May 2005, Drew, Stephen wrote: >Hello, > >Assuming there is no external interference, how could one cause this >error to occur through embedded use of SQLite? And why, following a >restart of my application, does it not happen again immediately? It >seems most odd... > >Any clues would be most appreciated. This is SQLite 2.8.15. Without details, it's difficult to say. What platform you running on? Is the file on a network drive? Have you checked your application against buffer overruns and stray pointers? > >Regards, >Steve > -- /"\ \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \