Thanks Aaron.

I asked because my pysqlite code works outside of webpy but the
identical code doesn't within a webpy def statement.

**** outside of webpy this code works ****

con = sqlite3.connect(":memory:")  # create database/table in memory
cur = con.cursor()        # note: can use the nonstandard execute,
executemany and avoid using Cursor object
query = "CREATE TABLE db.table(field.a INTEGER, field.b TEXT)"
con.execute(query)
query = "INSERT INTO db.table(field.a, field.b) VALUES (?, ?)", data
con.executemany(query)
limit=25
for q in testData:
        query = "SELECT field.b FROM db.table WHERE field.b LIKE '%s'
LIMIT '%s'" %(q, limit)
                for row in con.execute(query):
                print row


**** this webpy code doesn't work ****

urls = (
 '/', 'index',
 '/act', 'getRESULTS,
)

class getRESULTS():
    def GET(self):
        entry = web.input()
        q = entry.q
        limit = entry.limit
        query = "SELECT field.b FROM db.table WHERE field.b LIKE '%s'
LIMIT '%s'" %(q, limit)
        for row in con.execute(query):
                print row

**********
The error is:

Traceback (most recent call last):
    for row in con.execute(query):
OperationalError: no such table: movies

localhost - - [11/Apr/2008 11:31:47] "GET /act?q=dog&limit=25 HTTP/
1.1" 200 -

Thanks for the help.

Dinesh


On Apr 11, 10:48 am, "Aaron Swartz" <[EMAIL PROTECTED]> wrote:
> >  I want to use pysqlite within webpy def statements.  Will there be
> >  problems with doing this or do I have to use db.py?
>
> You can use whichever you like.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to