diff options
author | clyhtsuriva <clyhtsuriva@gmail.com> | 2020-05-15 08:05:04 +0200 |
---|---|---|
committer | clyhtsuriva <clyhtsuriva@gmail.com> | 2020-05-15 08:05:04 +0200 |
commit | 4c63e992258b31c90e910614bdfd62908f0f761c (patch) | |
tree | ec27351730116a7ae5a4d5e421ee2a49667222b6 | |
parent | c1347eb473140f0d9c2c578a6356698a1591eab9 (diff) |
respect syntaxe psycopg2
-rwxr-xr-x | analyse/insertpaq.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/analyse/insertpaq.py b/analyse/insertpaq.py index 1e9a397..60d4796 100755 --- a/analyse/insertpaq.py +++ b/analyse/insertpaq.py @@ -109,12 +109,17 @@ def connexionBD(): conn=connexionBD() cur=conn.cursor() -sql=""" -insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values ('{}','{}','{}','{}','{}','{}'); -insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values ('{}','{}','{}','{}','{}','{}'); -""".format(a,b,c,e,d,f,z,y,x,v,w,u) +#sql=""" +#insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values ('{}','{}','{}','{}','{}','{}'); +#insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values ('{}','{}','{}','{}','{}','{}'); +#""".format(a,b,c,e,d,f,z,y,x,v,w,u) -cur.execute(sql) -conn.commit() +cur.execute("INSERT INTO paquet (heure,protocole,ip_source,ip_destination,port_source,port_destination) VALUES (%s, %s, %s, %s, %s, %s)", + (a, b, c, e, d, f)) +cur.execute("INSERT INTO paquet (heure,protocole,ip_source,ip_destination,port_source,port_destination) VALUES (%s, %s, %s, %s, %s, %s)", + (z, y, x, v, w, u)) + +#cur.execute(sql) +conn.commit() conn.close() |