Every character of a string becomes a binding

Chris Angelico rosuav at gmail.com
Fri Aug 21 21:03:25 EDT 2015


On Sat, Aug 22, 2015 at 10:47 AM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Fri, 21 Aug 2015 18:39:28 +0200, Cecil Westerhof <Cecil at decebal.nl>
> declaimed the following:
>
>>I have the following with sqlite3:
>>urls = c.execute('SELECT URL FROM LINKS WHERE URL = ?', url).fetchall()
>>
>         Well, for one complication... You are asking for the very information
> you are providing...
>
>         select URL field
>         where the URL field is equal to some value.
>
>         What do you really expect from that? If the table has multiple records
> with the same URL value, you will get multiple copies of the same URL.

More likely, it's a simple question: "Do you have this URL in your
links?". If you get back a single row, the answer is yes; if you get
back no rows, the answer is no.

ChrisA



More information about the Python-list mailing list