teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

書式の改善

2018/03/20 05:12

投稿

peromaron
peromaron

スコア7

title CHANGED
File without changes
body CHANGED
@@ -8,13 +8,15 @@
8
8
 
9
9
  ```
10
10
  エラーメッセージ
11
- ```
12
- mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '+= 1 where id = 1' at line 1
13
11
 
12
+ ```mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '+= 1 where id = 1' at line 1
13
+
14
14
  また、SQL文のどこが間違っているか調べるために直接SQL内にて打ってみた結果のエラー文になります。
15
15
  ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%d' at line 1
16
16
 
17
17
  ### 該当のソースコード
18
+
19
+ ```ここに言語を入力
18
20
  class Analysis:
19
21
  def __init__(self,analysis_id):
20
22
  #database接続
@@ -73,8 +75,9 @@
73
75
  #table virustotal_api_keysのuse_time,use_numbersにnow,use_number+1をして格納
74
76
  self.cursor.execute('update virustotal_api_keys set use_time = now(),use_numbers += 1 where id = %d' % (m+1))
75
77
 
76
- ### 試したこと
77
78
 
79
+ ```### 試したこと
80
+
78
81
  この中のSQL文を試したところやはり%dに対して全てエラーを吐いているような気がしました。
79
82
  %dには変数が入る予定です。
80
83
  エラー文を見る限り%d以外の似た書き方をしてくださいと言われています。

1

誤字

2018/03/20 05:12

投稿

peromaron
peromaron

スコア7

title CHANGED
@@ -1,1 +1,1 @@
1
- python3においての変数出力エラーについて
1
+ virustotal api python3においての変数出力エラーについて
body CHANGED
@@ -18,11 +18,11 @@
18
18
  class Analysis:
19
19
  def __init__(self,analysis_id):
20
20
  #database接続
21
- self.connect = mysql.connector.connect(user='root', password='', host='localhost', database='kaiseki_development', charset='utf8')
21
+ self.connect = mysql.connector.connect(user='root', password='', host='localhost', database='', charset='utf8')
22
22
  self.connect.autocommit = True
23
23
  self.cursor = self.connect.cursor(buffered=True)
24
24
  self.analysis_id = analysis_id
25
- self.cursor.execute('use kaiseki_development')
25
+ self.cursor.execute('use ')
26
26
 
27
27
 
28
28