Re: Subtle Syntax Error
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <OF879772FA.28B8B939-ON8525724A.006A5CE7-8525724A.006A7E80@bankofny.com> |
Your line should look like this:
self.appData.cur.execute("delete from subpolicy where subpol_name = '" +
gone + "'")
Or
self.appData.cur.execute("delete from subpolicy where subpol_name = ?",
(gone,))
That should also work, then you don't have to worry about SQL
injections.
Thanks,
Greg Givler
Information Technology
Lockwood®
10 Valley Stream Parkway
Malvern, PA 19355
Phone: (484) 605-4826
Email: [email protected]
Rich Shepard
<rshepard@appl-ecosys To: [email protected]
.com> cc:
Sent by: Subject: [pysqlite] Subtle Syntax Error
pysqlite-bounces@list
s.initd.org
12/20/2006 12:52 PM
Please respond to
Rich Shepard; Please
respond to "For users
of the pysqlite
database module."
I must have a syntax error when trying to delete a row from table.
Here's
the function:
def OnSubPolDel(self, event):
hilite = self.polTree.GetSelection()
gone = self.polTree.GetItemText(hilite)
self.polTree.Delete(hilite)
self.appData.cur.execute("delete from subpolicy where subpol_name =
'gone'")
The selected item in the tree control is removed from view, but not
from
the database.
I've looked again at Mike Owens' SQLite book, and the syntax works
with
the explicit subpol_name when I test it from within the sqlite3 shell,
but
not with the variable name.
It must be a very simple issue that I've missed, and I'd greatly
appreciate a pointer to what I've done incorrectly.
TIA,
Rich
--
Richard B. Shepard, Ph.D. | The Environmental
Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax:
503-667-8863
_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please call the help desk at ext 4850
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________