The problem is that sqlite3_exec() is doing several steps and its difficult
to isolate which of those steps could be the failure point.

For testing purposes, it would help if you instead used sqlite3_prepare(),
sqlite3_step() and sqlite3_finalize() on the "Select" statement.  That way
you're using a lower-level API and can isolate exactly which API call is
returning an error.

Robert


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Nelson
Sent: Saturday, August 02, 2008 3:19 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Resources for newbies.

callback is being called when i get a query match... i think the problem is
in
the data and i've re posted it here... it only has a few records, and my app
gets error with 'select * from Event;'

this is a link to the database
http://www.savoysoft.com/EvtMgrRequestx05A

you have all given me more help then i deserve... very appreciative
thanks

On Sat, Aug 2, 2008 at 5:17 PM, Robert Simpson <[EMAIL PROTECTED]>wrote:

> Nothing stands out ... is your callback being called at all?  What's it
> look
> like?
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of David Nelson
> Sent: Saturday, August 02, 2008 2:00 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Resources for newbies.
>
> here's the create code:
>            if( sqlite3_exec( m_pdbData,
>            "create table Event( Key TEXT[unique], DateTime DATE, Event
> blob, MotionData1 blob, MotionData2 blob, MotionData3 blob, MotionData4
> blob, MotionData5 blob, MotionData6 blob, MotionData7 blob, MotionData8
> blob, MotionData9 blob, MotionData10 blob, MotionData11 blob, MotionData12
> blob, MotionData13 blob, MotionData14 blob, MotionData15 blob,
MotionData16
> blob, PRIMARY KEY (Key) );", &Callback, this, &lpszErr ) != 0 )
>  (have also used TEXT instead of blob)
>
> here I add a record:
>                strSql.Format( "insert or replace into Event values( '%s',
> '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
> '%s', '%s', '%s', '%s', '%s', '%s' );",
>                    strKey, szSQLDateTime, strArgs + " /t " + szDateTime,
>                  m_strMotionData[0],
>                  m_strMotionData[1],
>                  m_strMotionData[2],
>                  m_strMotionData[3],
>                  m_strMotionData[4],
>                  m_strMotionData[5],
>                  m_strMotionData[6],
>                  m_strMotionData[7],
>                  m_strMotionData[8],
>                  m_strMotionData[9],
>                  m_strMotionData[10],
>                  m_strMotionData[11],
>                  m_strMotionData[12],
>                  m_strMotionData[13],
>                  m_strMotionData[14],
>                  m_strMotionData[15]
>                   );
>             sqlite3_open( m_strFile, &m_pdbData );
>             sqlite3_exec( m_pdbData, strSql, &Callback, this, &lpszErr );
>              sqlite3_close( m_pdbData );
> (note m_strMotionData are strings -- small values work, and around 64
chars
> each the following query fails)
>
>
> here's the query:
>           sqlite3_open( m_strFile, &m_pdbData );
>           sqlite3_exec( m_pdbData, "select * from Event" , &Callback,
this,
> &lpszErr );
>            sqlite3_close( m_pdbData );
>
> err msg: "SQL logic error or bad database"
>
> thanks again,
> dave
>
>
> On Sat, Aug 2, 2008 at 4:44 PM, Robert Simpson <[EMAIL PROTECTED]
> >wrote:
>
> > Can we see the code you're using that's failing?
> >
> > Also, I'm unclear ... you're calling sqlite3_exec() to select the rows
as
> > well as insert them?
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of David Nelson
> > Sent: Saturday, August 02, 2008 1:04 PM
> > To: [EMAIL PROTECTED]; General Discussion of SQLite Database
> > Subject: Re: [sqlite] Resources for newbies.
> >
> > thanks for your efforts... much appreciated
> >
> > (I'm a C++ developer of many decades, so i know my way around
> > the client code... will keep debugging, must be simple/stupid problem)
> >
> > On Sat, Aug 2, 2008 at 3:59 PM, P Kishor <[EMAIL PROTECTED]> wrote:
> >
> > > On 8/2/08, David Nelson <[EMAIL PROTECTED]> wrote:
> > > > this is a link to the database
> > > >  http://www.savoysoft.com/EvtMgrRequestx05A
> > > >
> > >
> > >
> > > Works fine for me.
> > >
> > > I tried
> > >
> > > SELECT * FROM event WHERE event LIKE '%Vid%';
> > >
> > > and got a boatload of rows back.
> > >
> > > Has to be something wrong with your compilation. Rest assured, the
> > > problem is not with SQLite or with your db, but with your build of
> > > SQLite or with your program with which you are querying.
> > >
> > > Maybe some Windows folks will be able to help you.
> > >
> > > >
> > > >
> > > >  On Sat, Aug 2, 2008 at 3:03 PM, Robert Simpson <
> [EMAIL PROTECTED]
> > > >wrote:
> > > >
> > > >
> > > > > Can you give us a download link to the database?  Does your select
> > > >  > statement
> > > >  > fail in the sqlite3.exe command-line util?
> > > >  >
> > > >  > -----Original Message-----
> > > >  > From: [EMAIL PROTECTED]
> > > >  > [mailto:[EMAIL PROTECTED] On Behalf Of David
> Nelson
> > > >  > Sent: Saturday, August 02, 2008 11:44 AM
> > > >  > To: [EMAIL PROTECTED]; General Discussion of SQLite Database
> > > >  > Subject: Re: [sqlite] Resources for newbies.
> > > >  >
> > > >  > OK, P Kishor, here is my problem:
> > > >  >
> > > >  > Getting "logic error or bad data" when using largw data strings:
> > > >  >
> > > >  >
> > > >  > I create the database as follows:
> > > >  >    create table Event( Key TEXT[unique], DateTime DATE, Event
> TEXT,
> > > PRIMARY
> > > >  > KEY (Key) )
> > > >  >
> > > >  >
> > > >  > I add records to the database as follows:
> > > >  >    insert or replace into Event values( 'strKey', '07/25/2008
> > > 08:00:00',
> > > >  > 'data string' )
> > > >  >
> > > >  > And I query the database as follows:
> > > >  >    SELECT * FROM [Event]  WHERE    ([Event] LIKE "*foo*" AND
> [Event]
> > > LIKE
> > > >  > "*bar*") AND    [Date/Time] BETWEEN DateAdd("n",-5,Now()) AND
> Now()
> > > >  >
> > > >  >
> > > >  >
> > > >  > The query works fine when my inserted data strings are small,
like
> <
> > > 256
> > > >  > bytes.
> > > >  >
> > > >  > However, I get 'logic error' on the query if my data strings are
> > > largere,
> > > >  > like 2048 bytes.
> > > >  >
> > > >  >
> > > >  > Can someone explain what I need to do to support larger data
> > strings?
> > > >  >
> > > >  > (using C++ under Win/XP and amalgom version of sqlite compiled
> > > directly in
> > > >  > the app)
> > > >  >
> > > >  >
> > > >  >
> > > >  >
> > > >  > On Sat, Aug 2, 2008 at 2:39 PM, P Kishor <[EMAIL PROTECTED]>
> > wrote:
> > > >  >
> > > >  > > On 8/2/08, David Nelson <[EMAIL PROTECTED]> wrote:
> > > >  > > > Rich,
> > > >  > > >  Thanks for your response... I appreciate your suggested
> > > references.
> > > >  > > >
> > > >  > > >  The problem is that while I am an expert on some/many
things,
> > > SQLite
> > > >  > > >  and SQL in general is not among them.  Nor do I have a
strong
> > > interest
> > > >  > > >  in becoming an expert -- I simply have a simple logging
> > > application
> > > >  > > which
> > > >  > > >  has worked fine under Windows Access, but fails under SQLite
> > with
> > > an
> > > >  > > >  error message which is less than enlightening.
> > > >  > > >
> > > >  > > >  I was hoping to find an interactive blog where experts would
> > > enjoy
> > > >  > > helping
> > > >  > > >  newbies
> > > >  > > >  with specific suggestions.
> > > >  > >
> > > >  > > This *is* such an "interactive blog." This is the place where
> > > experts
> > > >  > > and non-experts enjoy helping experts and non-experts with
> > specific
> > > >  > > and generic suggestions.
> > > >  > >
> > > >  > > Just ask, and ye shall be rewarded.
> > > >  > >
> > > >  > >
> > > >  > > >
> > > >  > > >  Thanks again.
> > > >  > > >  dave
> > > >  > > >
> > > >  > > >  On Sat, Aug 2, 2008 at 10:03 AM, Rich Shepard <
> > > >  > [EMAIL PROTECTED]
> > > >  > > >wrote:
> > > >  > > >
> > > >  > > >
> > > >  > > >  > On Fri, 1 Aug 2008, David Nelson wrote:
> > > >  > > >  >
> > > >  > > >  > > You addressed Dwight's example, but not his question --
> > which
> > > is
> > > >  > > whether
> > > >  > > >  > > there is a resource for answering questions like this.
> > > >  > > >  >
> > > >  > > >  > dave,
> > > >  > > >  >
> > > >  > > >  >   I thought that my recommendation of Mike Owens' book was
> a
> > > pointer
> > > >  > > to a
> > > >  > > >  > reference that would answer questions such as this.
> > > >  > > >  >
> > > >  > > >  >   Regardless, here's another one: Rick van der Laan's
> > > "Introduction
> > > >  > to
> > > >  > > SQL,
> > > >  > > >  > 4th Edition." It is an outstanding introduction to DDL
> (Data
> > > >  > > Definition
> > > >  > > >  > Language; that is, how to design and normalize a database
> > > schema)
> > > >  > and
> > > >  > > DML
> > > >  > > >  > (Data Manipulation Language; that is, how to enter,
> retrieve,
> > > and
> > > >  > > alter
> > > >  > > >  > data
> > > >  > > >  > in tables).
> > > >  > > >  >
> > > >  > > >  >   And for those who want to refine their knowledge and
> > skills,
> > > I
> > > >  > > highly
> > > >  > > >  > reccomend any of Joe Celko's books. I read his columns in
> > Data
> > > Based
> > > >  > > >  > Advisor
> > > >  > > >  > in the 1980s and 1990s as well as his books. Last year I
> had
> > a
> > > need
> > > >  > to
> > > >  > > >  > better understand time-based queries so I wrote to him for
> > > pointers
> > > >  > to
> > > >  > > >  > resources. He recommended Rick's book.
> > > >  > > >  >
> > > >  > > >  >   As an aside, most dbms have datetime data types but do
> not
> > > fully
> > > >  > (or
> > > >  > > even
> > > >  > > >  > adequately) support time as presented in the SQL standard.
> > > Because
> > > >  > > most
> > > >  > > >  > business (and scientific) databases have a very strong
time
> > > element
> > > >  > > >  > associated with queries and reports this lack surprises
me.
> > > >  > > >  >
> > > >  > > >  >   Anyway, Dave, if that's not sufficient, please ask and
> I'll
> > > try to
> > > >  > > >  > provide
> > > >  > > >  > better answers.
> > > >  > > >  >
> > > >  > > >  > Rich
> > > >  > > >  >
> > > >  > > >  > --
> > > >  > > >  > Richard B. Shepard, Ph.D.               |  Integrity
> > > >  > >  Credibility
> > > >  > > >  > Applied Ecosystem Services, Inc.        |
> > Innovation
> > > >  > > >  > <http://www.appl-ecosys.com>     Voice: 503-667-4517
> >  Fax:
> > > >  > > >  > 503-667-8863
> > > >  > > >  > _______________________________________________
> > > >  > > >  > sqlite-users mailing list
> > > >  > > >  > sqlite-users@sqlite.org
> > > >  > > >  >
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >  > > >  >
> > > >  > > >  _______________________________________________
> > > >  > > >  sqlite-users mailing list
> > > >  > > >  sqlite-users@sqlite.org
> > > >  > > >  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >  > > >
> > > >  > >
> > > >  > >
> > > >  > > --
> > > >  > > Puneet Kishor http://punkish.eidesis.org/
> > > >  > > Nelson Institute for Environmental Studies
> > > http://www.nelson.wisc.edu/
> > > >  > > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
> > > >  > > _______________________________________________
> > > >  > > sqlite-users mailing list
> > > >  > > sqlite-users@sqlite.org
> > > >  > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >  > >
> > > >  > _______________________________________________
> > > >  > sqlite-users mailing list
> > > >  > sqlite-users@sqlite.org
> > > >  > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >  >
> > > >  >
> > > >  > _______________________________________________
> > > >  > sqlite-users mailing list
> > > >  > sqlite-users@sqlite.org
> > > >  > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >  >
> > > >  _______________________________________________
> > > >  sqlite-users mailing list
> > > >  sqlite-users@sqlite.org
> > > >  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >
> > >
> > >
> > > --
> > > Puneet Kishor http://punkish.eidesis.org/
> > > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
> > > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
> > > _______________________________________________
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

Reply via email to