Skip to content

Commit

Permalink
FIX: MYSQL syntax of insert and create statements
Browse files Browse the repository at this point in the history
  • Loading branch information
d-Rickyy-b committed Jan 6, 2019
1 parent b22e7de commit 6ae6508
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pastepwn/database/mysqldb.py
Expand Up @@ -26,22 +26,22 @@ def __init__(self, ip="127.0.0.1", port=27017, dbname="pastepwn", username=None,
self.logger.debug("Connected to database!")

def _create_tables(self):
self.cursor.execute("""CREATE TABLE 'pastes' (
'key' TEXT NOT NULL UNIQUE,
'title' TEXT,
'user' TEXT,
'size' INTEGER,
'date' INTEGER,
'expire' INTEGER,
'scrape_url' TEXT,
'full_url' TEXT,
'body' TEXT,
PRIMARY KEY('key'))""")
self.cursor.execute("""CREATE TABLE IF NOT EXISTS `pastes` (
`key` TEXT NOT NULL UNIQUE,
`title` TEXT,
`user` TEXT,
`size` INTEGER,
`date` INTEGER,
`expire` INTEGER,
`scrape_url` TEXT,
`full_url` TEXT,
`body` TEXT,
PRIMARY KEY(`key`));""")
self.db.commit()

def _insert_data(self, paste):
self.cursor.execute("INSERT INTO pastes (key, title, user, size, date, expire, syntax, scrape_url, full_url, body) "
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
self.cursor.execute("INSERT INTO `pastes` (`key`, `title`, `user`, `size`, `date`, `expire`, `syntax`, `scrape_url`, `full_url`, `body`) "
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s);",
(paste.key,
paste.title,
paste.user,
Expand Down

0 comments on commit 6ae6508

Please sign in to comment.