Escaping confusion with Python 3 + MySQL

Νίκος Βέργος me.on.nzt at gmail.com
Sun Mar 26 23:04:31 EDT 2017


Τη Δευτέρα, 27 Μαρτίου 2017 - 6:00:34 π.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Mon, Mar 27, 2017 at 1:52 PM, Νίκος Βέργος <me.on.nzt at gmail.com> wrote:
> > Its NOT that i have not read it exactly, but for some strange reason i was under the belief that the way i had syntactically typed the UPDATE query was correctly and more consistent and similar to thr INSERT query and it was prefered to me over the other one.
> >
> > UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"
> >
> > Its still a mystery to em whay this fails syntactically when at the same time INSERT works like that.
> >
> > We give each columnn a specific value i don't see why it must only be written as UPDATE visitors SET a=1, b=2, c=3 ... WHERE host LIKE %s.
> >
> > i knew that would work, but the first way although proven syntactically wrong seems so right .....
> 
> It'd be even more logical to write:
> 
> UPDATE visitors INCREMENT visits WHERE host CONTAINS %s;
> 
> I should just use that syntax, and if it doesn't work, I'm going to
> post onto a mailing list until it magically starts working. It's NOT
> that I haven't read the docs - I'm just going to wilfully ignore them.
> 
> Okay, I'm done now.
> 
> ChrisA

Okey i have taken my lesson.
I should have written it as the doc suggested instead of being persistent on finding what was worng in the way i had written it....


More information about the Python-list mailing list