this may be a good start for you - has the basic operations. all of the
queries work, but branko and justin helped me secure them. hopefully they
will give you a good place to build from.
also i was using mysql with this example - not sure if sqlite will make a
huge difference or not
hth

import web

render = web.template.render('templates/')

urls = (
    '/', 'index',
    '/add', 'add',
    '/edit', 'edit',
    '/update', 'update'
        )

app = web.application(urls, globals())

db = web.database(dbn='mysql', user='gmilby', pw='asdfasdf',
db='gmiasdfasdftu')

class index:
    def GET(self):
        #todos = db.select('todo') #webpy way
        todos = db.query('SELECT * FROM todo')  #db.query way
        return render.index(todos)

class add:
    def POST(self):
        i = web.input()
        #n = db.insert('todo', title=i.title) #original
        #n = db.query("INSERT INTO todo (title) VALUES ('%s')"%
str(i.title))
 n = db.query('''INSERT INTO todo (title) VALUES
($title)''',vars=i)#justin's way
        raise web.seeother('/')

class edit:
    def GET(self):
        i = web.input()
        #todo = db.select('todo', i, where="id = $id") #webpy way
        todo = db.query('''SELECT * FROM todo WHERE id=$id''', vars=i)
#db.query but protected
        return render.edit(todo)

class update:
    def POST(self):
        i = web.input()
        #db.update('todo', where="id=$id", vars={'id':i.id}, title=i.title)
#original
 #db.update('todo', title=i.title, id=i.id) #webpy way
#db.query("UPDATE todo SET title='%s' WHERE id=%s"% (i.title, i.id))#
db.query way
        db.query('''UPDATE todo SET title=$title WHERE id=$id''', vars=i)
#justin's way - uses db.query and prevents sql injection
        raise web.seeother('/')

if __name__ == "__main__": app.run()
-----------------------
Visit My Sites!
www.syrbot.com | My Site
www.attackr.com | Latest Blog Posts
www.superantispyware.com/superantispyware.html?rid=3971 Remove All The
Spyware - Not Just The Easy Ones!



On Mon, Mar 1, 2010 at 1:27 AM, Walter Pabon <[email protected]> wrote:

> Hi, sorry about my english, i am going to try to explain my problem.
>
> I am working on a little app for save, edit, del registers, all this
> are done, but i need to make a form or a simple textbox and button to
> looking for a specific register, so i am using sqlite as db, my
> question, Is there any example about it?. i'm gonna be grateful for
> any help. :)
>
>
> carefully
>
> ~ Walter Pabon
> http://waltico.utpinux.org
>
> --
> 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] <webpy%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>

-- 
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