Last active
December 14, 2015 04:28
-
-
Save c0ldlimit/5028008 to your computer and use it in GitHub Desktop.
#sqlite3 #python Parameterized queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://zetcode.com/db/sqlitepythontutorial/ | |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| import sqlite3 as lite | |
| import sys | |
| uId = 1 | |
| uPrice = 62300 | |
| con = lite.connect('test.db') | |
| with con: | |
| cur = con.cursor() | |
| cur.execute("UPDATE Cars SET Price=? WHERE Id=?", (uPrice, uId)) | |
| con.commit() | |
| print "Number of rows updated: %d" % cur.rowcount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment