Στις 2/11/2013 4:00 πμ, ο/η ru...@yahoo.com έγραψε:
On Friday, November 1, 2013 9:04:08 AM UTC-6, Ferrous Cranus wrote:
Rurpy can you help me please solve this?
is enum or set column types what needed here as proper columns to store
'download' list?
I'd help if I could but I don't use MySql and don't know anything
about its column types. All I could do it try to read about it
(which I don't have time for right now) and you know more about
it than me so you can probably figure it out more quickly.
Okey here is some improvement:
Splitting the statement in 3 steps to print it before actually executing iy.
=====
sql = '''INSERT INTO visitors (counterID, refs, host, city, useros,
browser, visits, downloads) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)''' %
(cID, refs, host, city, useros, browser, visits, downloads)
print repr(sql)
cur.execute(sql)
=====
This the real time values trying to be passed into MySQL table in python
script's runtime
=====
"INSERT INTO visitors (counterID, refs, host, city, useros, browser,
visits, downloads) VALUES (1, Χωρίς Referrer - Άμεσο Hit,
46-198-103-93.adsl.cyta.gr, Europe/Athens, Windows, Chrome, 13-11-02
10:31:29, [('Jobs.2013. WEBRip XViD juggs',),
('Pacific.Rim.2013.720p.BDRip.XviD.AC3-ELiTE',), ('Man of Steel 2013
BRRip XviD AC3-SANTi',), ('Now You See Me EXTENDED 2013 BRRip XviD
AC3-SANTi',), ('DAS EXPERIMENT (2001) 720p.BDRip.XVID.AC3',), ('Behind
the Candelabra 2013 BDrip XviD AC3',),
('The.Internship.2013.UNRATED.480p.BRRip.Xvid.AC3',), ('Man Of Tai 2013
WEBrip XVID AC3',), ('Star Trek Into Darkness 2013 BRRip XviD
AC3-SANTi',), ('ESCAPE PLAN (2013) CAM XViD UNiQUE',)])"
ProgrammingError(ProgrammingError(1064, "You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'Referrer - Άμεσο Hit,
46-198-103-93.adsl.cyta.gr, Europe/Athens, Windows, C' at line 1"),)
=====
The definition of 'visitro's table is as follows:
=====
create table visitors
(
counterID integer(5) not null,
host varchar(50) not null,
refs varchar(25) not null,
city varchar(20) not null,
userOS varchar(10) not null,
browser varchar(10) not null,
hits integer(5) not null default 1,
visits datetime not null,
download text not null,
foreign key (counterID) references counters(ID),
unique index (visits)
)ENGINE = MYISAM;
=====
It is possible to "just" use a VARCHAR or TEXT field and then add
anything you want to it, including a comma or semi-colon separated list.
--
https://mail.python.org/mailman/listinfo/python-list