lReturnedRows is one of the function arguments, so that is fine. I have made some progress though and that is that this problem only occurs with this particular table, called SQL. It is a table that logs all the SQL statements that run in my app. When I instead make this for example sqlite_master there is no problem ever. No idea though why this table would cause a problem. Could it be that one of the items in that table is a reserved word?
CREATE TABLE 'SQL' ([STATEMENT_COUNT] INTEGER, [DB] TEXT, [QUERY_TIME] TEXT, [QUERY_LENGTH] REAL, [QUERY] TEXT) Any other ideas what could be wrong with this table? I could mail a db with that table if that would be helpful. RBS -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 02 February 2007 13:51 To: sqlite-users@sqlite.org Subject: RE: [sqlite] How do I know sqlite_get_table is finished I'll admit I'm not much of a C expert, so I'd say Guy has a much better handle on that part than I do. As far as your code goes I only had one thought, and forgive me if this is just my ignorance of VBA. I didn't see a declaration for lReturnedRows anywhere. If you don't declare a variable, what is the value of that variable if it's used before you explicitly assign a value? The reason I ask is because you only assign a value to lReturnedRows if the length of the error message is 0, and you only set the error flag if lReturnedRows = 0. Do you need to do: If Len(strError) = 0 then Else lReturnedRows = 0 End If Don't know if this would really make a difference, and sorry if it's just a waste of time, but I thought I'd suggest it. -- Eric Pankoke Founder / Lead Developer Point Of Light Software http://www.polsoftware.com/ -------------- Original message ---------------------- From: [EMAIL PROTECTED] > Thanks for looking at that. > The crash can happen at the actual call to sqlite_get_table or it can > happen when I assign the resulting array to the wrapper function, so when > I do: GetFromDB = arr > > Yes, I would be interested in making a boolean (optional) argument in > sqlite_get_table that can leave out the field headers. I haven't tried > to compile myself yet, but I do have VC6, so it should be OK. > > Still, I don't understand why this crashes. > > RBS > > > At 07:44 2/2/2007 +0000, you wrote: > >>Sure, here it is: > > > > <snip> > > > > Looking at the C code published at > > http://www.tannertech.net/sqlite3vb/index.htm , it seems very risky - > > there > > are a lot of places it can fail to allocate memory (for example), and the > > use of some variables looks like it could randomly crash at any time... > > but > > I didn't test it, just looked at it. > > > > As far as I can understand the problem, it happens around this line: > > arr = GetFromDB(strSQL, lRows, strError, lDBHandle, strDB) > > > > Are you seeing a crash on the actual call to sqlite_get_table or only > > after > > it (when you try to use the results)? > > > > If you compiled the SQLite3VB.dll on your own, I can probably make some > > suggestions about fixing the C code of sqlite_get_table implementation, > > and > > maybe even some improvments (for example, a boolean flag to allow you to > > request the results array without the column headers, which I remember you > > asking about), and returning the number of rows immediately instead of in > > another function (which is somewhat dangerous), etc.). > > You should also probably consider using some kind of wrapper around > > sqlite3_exec in addition to sqlite3_get_table so you will be able to run > > commands (like pragma) without going through sqlite_get_table. > > > > > > Guy > > > > > > > > ---------------------------------------------------------------------------- - > > To unsubscribe, send email to [EMAIL PROTECTED] > > ---------------------------------------------------------------------------- - > > > > > > > > > > > ---------------------------------------------------------------------------- - > To unsubscribe, send email to [EMAIL PROTECTED] > ---------------------------------------------------------------------------- - > ---------------------------------------------------------------------------- - To unsubscribe, send email to [EMAIL PROTECTED] ---------------------------------------------------------------------------- - ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------