2019-02-21 16:14:35 +00:00
|
|
|
from cfg import config
|
2019-02-25 13:14:55 +00:00
|
|
|
import sql
|
2019-02-21 16:14:35 +00:00
|
|
|
|
|
|
|
def _get_page_id(title, connection):
|
|
|
|
cursor = connection.cursor()
|
2019-02-25 13:14:55 +00:00
|
|
|
cursor.execute(sql.statements["get_page_id"], (title,))
|
2019-02-21 16:14:35 +00:00
|
|
|
return cursor.fetchone()
|
|
|
|
|
|
|
|
def get_page_id(title, connection):
|
|
|
|
|
|
|
|
result = _get_page_id(title, connection)
|
|
|
|
if(result is not None):
|
|
|
|
return result[0]
|
|
|
|
|
|
|
|
cursor = connection.cursor()
|
2019-02-25 13:14:55 +00:00
|
|
|
cursor.execute(sql.statements["insert_page"], (title,))
|
2019-02-21 16:14:35 +00:00
|
|
|
return _get_page_id(title, connection)[0]
|
|
|
|
|
|
|
|
def get_page_title(page_id, connection):
|
|
|
|
cursor = connection.cursor()
|
2019-02-25 13:14:55 +00:00
|
|
|
cursor.execute(sql.statements["get_page_title"], (page_id,))
|
2019-02-21 16:14:35 +00:00
|
|
|
return cursor.fetchone()[0]
|
|
|
|
|