SQLite Problem

Peter Haworth pete at lcsql.com
Sat Mar 14 16:24:36 EDT 2015


Interesting, hadn't thought about the speed aspect, thanks Ralph.

I've taken to using PRAGMA table_info to get column names these days
although if you're caching the names, probably doesn't matter.  But the
problem I found had to do with using revDatabaseColumnNamed on a cursor
that didn't include all the columns in the table.  Worked around that by
giving the printf expression an alias in the SELECT statement.  I'll
probably enter a QCC report at some point although with all the activity on
7 and 8, I doubt it will be very high on the priority list.

I've also taken to getting my own list of table names by querying the
sqlite_master table directly.  That way, I can distinguish between tables
and views since the sqlite_master has a type column. revDatabaseTableNames
return tables and views which depending on your application might be OK but
for things like my SQLiteAdmin program, I need separate lists.

On Sat, Mar 14, 2015 at 11:06 AM Ralph DiMola <rdimola at evergreeninfo.net>
wrote:

> If found that revDatabaseColumnaNames() is beyond all belief extremely
> slow(better part of a second). A SQLite update program sped up better than
> 10 times when I cached the column names.
>
> SQLite
> Windows XP
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
>
> -----Original Message-----
> From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On
> Behalf
> Of Dr. Hawkins
> Sent: Saturday, March 14, 2015 12:47 PM
> To: How to use LiveCode
> Subject: Re: SQLite Problem
>
> On Thu, Mar 12, 2015 at 10:21 AM, Peter Haworth <pete at lcsql.com> wrote:
>
> > No errors on that.  Subsequently I use revDatabaseColumnNames to get
> > the column names followed by a loop using revDatabaseColumnNamed to
> > get the column values.  The latter returns an error indicating that
> printf('%6.2f'
> > and ,Value are invalid column names.
> >
> > It appears that the comma in the printf command confuses Livecode. If
> > I use
> > sqlite3 with .mode column and .headings and issue the same statement,
> > it uses the printf function as the column heading.
> >
>
> I have found relying on revDatabaseColumnaNames() and
> revDatabaseTableNames() unreliable--tablenames so much so that I've written
> my own function twice for postgres, as livecode's misses tables
> sporadically.
>
> OK, columnNames may be guilt by association.  And it looks like this has
> only bitten on postgres, as the switch uses revDatabaseTableNames() for
> sqlite.
>
>
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list