Τη Κυριακή, 26 Μαρτίου 2017 - 8:58:55 μ.μ. UTC+3, ο χρήστης alister έγραψε: > On Sun, 26 Mar 2017 07:43:51 -0700, Νίκος Βέργος wrote: > > > Τη Κυριακή, 26 Μαρτίου 2017 - 5:38:57 μ.μ. UTC+3, ο χρήστης alister > > έγραψε: > >> On Sun, 26 Mar 2017 07:24:49 -0700, Νίκος Βέργος wrote: > >> > >> > Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian > >> > έγραψε: > >> > > >> >> You need to change the placeholders back. The poster who told you to > >> >> replace them was misinformed. > >> > > >> > okey altered them back to > >> > > >> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, > >> > useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE > >> > host LIKE "%%s%" ''', > >> > > >> > > >> (pID, domain, ref, location, useros, > >> > > >> > > >> browser, lastvisit, domain) ) > >> > > >> > but now the problem is how to exact;y type the Where HOST like "%%%" > >> > > >> > I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character. > >> > >> > >> as a quick thought (untested) it is probably best to have %s as your > >> parameter for the Like clause & ad the sql wild-cards (% symbols) to > >> the data you pass in as I think the expansion of %s adds quote marks > >> which will certainly cause the sql parser issues. > > > > How do you propose writing that cur.execute statement Alister? > > > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, > >> > useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE > >> > host LIKE %s ''' > > but you will need to amend the data you pass so that the last element > has the surrounding % characters . > > > -- > T-1's congested due to porn traffic to the news server.
i have done so ith 3 different ways to prepare the string before sending it as an argument to update query as i mentioned in a previous post. Unfortunately all 3 ways weren't able to make the query work. -- https://mail.python.org/mailman/listinfo/python-list