Re: DELETE Statement Apparently Not Working

[email protected]
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <OFE94624D1.196CC24C-ON85257369.0063A50B-85257369.0063F3AA@bankofny.com>
I would recommend that you look at your insert and deletes. 

We have the problem here at work all the time, Zero Length strings or 
trailing spaces being inserted into the Database instead of NULLs or 
stripped values. Causes problems with selects and updates and deletes as 
records that should be deleted or updated aren't and so on.

str(value).strip() is your friend and if your value is len(value) == 0: 
insert None/NULL. Just makes things much easier down the road.

The best part of str(value).strip() is that it will removed leading and 
trailing spaces while leaving internal spaces in a string alone.

Thanks,

Greg Givler
Information Technology
Lockwood®
10 Valley Stream Parkway
Malvern, PA 19355
Phone: (484) 605-4826
Email: [email protected]



Rich Shepard <[email protected]> 
Sent by: pysqlite-bounces-IAPFreCvJWPBWskQ1e/[email protected]
10/03/2007 09:56 AM
Please respond to
pysqlite list <pysqlite-IAPFreCvJWPBWskQ1e/[email protected]>


To
pysqlite list <pysqlite-IAPFreCvJWPBWskQ1e/[email protected]>
cc

Subject
Re: [pysqlite] DELETE Statement Apparently Not Working






On Tue, 2 Oct 2007, Adrian Klaver wrote:

> My concern is that there are spaces in the variable strings that aren't
> showing up in the print statements but are affecting the comparison to 
the
> values in the database.

Adrian,

   Ah, yes! Very subtle. I was tripped up before by an invisible trailing
space, but this time it was different.

   If there is no displayed value for the widget named vsub, the value is
blank, that is '', but apparently that's not what the pysqlite cursor saw.
Actually, I've no idea what it saw because printing the value of that 
widget
displayed nothing visible.

   However, by adding the following test I fixed the problem:

                 if len(self.vsub.GetValue()) == 1:
           self.vsub.SetValue('')

> http://initd.org/pub/software/pysqlite/doc/usage-guide.html
> See 1.4 Extensions and Caveats section on the Cursor class.

   I'll read that.

Thank you,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.        |         Accelerators(TM)
<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 
______________________________________________________________________

_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.