this is based on calsyslab project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

604 lines
23 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. __author__ = 'DarkWeb'
  2. import psycopg2
  3. import traceback
  4. from Forums.Utilities.utilities import *
  5. from dateutil.relativedelta import relativedelta, FR
  6. def connectDataBase():
  7. from Forums.Initialization.forums_mining import config
  8. try:
  9. ip = config.get('PostgreSQL', 'ip')
  10. username = config.get('PostgreSQL', 'username')
  11. password = config.get('PostgreSQL', 'password')
  12. database = config.get('PostgreSQL', 'database')
  13. return psycopg2.connect(host=ip, user=username, password=password, dbname=database)
  14. except:
  15. print ("Data base " + config.get('PostgreSQL', 'database') + " not found.")
  16. raise SystemExit
  17. def verifyForum(cur, nameForum):
  18. try:
  19. cur.execute("lock table forums IN ACCESS EXCLUSIVE MODE")
  20. cur.execute("select forum_id from forums where name_forum = %(nameForum)s limit 1", {'nameForum': nameForum})
  21. recset = cur.fetchall()
  22. if recset:
  23. return recset[0]['forum_id']
  24. else:
  25. return 0
  26. except:
  27. trace = traceback.format_exc()
  28. print (trace)
  29. def verifyTopic(cur, forumId, authorId, titleTopic):
  30. try:
  31. cur.execute("lock table topics IN ACCESS EXCLUSIVE MODE")
  32. cur.execute("select topic_id from topics where forum_id = %(forumId)s and author_id = %(authorId)s and title_topic = %(titleTopic)s limit 1",
  33. {'forumId': forumId, 'authorId': authorId, 'titleTopic': titleTopic})
  34. recset = cur.fetchall()
  35. if recset:
  36. return recset[0]['topic_id']
  37. else:
  38. return 0
  39. except:
  40. trace = traceback.format_exc()
  41. print (trace)
  42. def verifyPost(cur, topicId, userId, dateAdded):
  43. try:
  44. cur.execute("lock table posts IN ACCESS EXCLUSIVE MODE")
  45. cur.execute("select post_id from posts where topic_id = %(topicId)s and "
  46. "user_id = %(userId)s and dateadded_post = %(dateAdded)s limit 1", {'topicId': topicId,
  47. 'userId': userId,
  48. 'dateAdded': dateAdded})
  49. recset = cur.fetchall()
  50. if recset:
  51. return recset[0]['post_id']
  52. else:
  53. return 0
  54. except:
  55. trace = traceback.format_exc()
  56. print (trace)
  57. def verifyUser(cur, nameUser, forumId):
  58. try:
  59. cur.execute("lock table users IN ACCESS EXCLUSIVE MODE")
  60. cur.execute("select user_id from users where name_user = %(nameUser)s and forum_id = %(forumId)s limit 1",
  61. {'nameUser': nameUser, 'forumId': forumId})
  62. recset = cur.fetchall()
  63. if recset:
  64. return recset[0]['user_id']
  65. else:
  66. return 0
  67. except:
  68. trace = traceback.format_exc()
  69. print (trace)
  70. def getLastForum(cur):
  71. try:
  72. cur.execute("select forum_id from forums order by forum_id desc limit 1")
  73. recset = cur.fetchall()
  74. if recset:
  75. return recset[0]['forum_id']
  76. else:
  77. return 0
  78. except:
  79. trace = traceback.format_exc()
  80. print (trace)
  81. def getLastTopic(cur):
  82. try:
  83. cur.execute("select topic_id from topics order by topic_id desc limit 1")
  84. recset = cur.fetchall()
  85. if recset:
  86. return recset[0]['topic_id']
  87. else:
  88. return 0
  89. except:
  90. trace = traceback.format_exc()
  91. print (trace)
  92. def getLastUser(cur):
  93. try:
  94. cur.execute("select user_id from users order by user_id desc limit 1")
  95. recset = cur.fetchall()
  96. if recset:
  97. return recset[0]['user_id']
  98. else:
  99. return 0
  100. except:
  101. trace = traceback.format_exc()
  102. print (trace)
  103. def getLastUserVersion(cur, userId):
  104. try:
  105. cur.execute("select version_user from users_history where user_id = %(userId)s order by version_user desc limit 1", {'userId': userId})
  106. recset = cur.fetchall()
  107. if recset:
  108. return recset[0]['version_user']
  109. else:
  110. return 0
  111. except:
  112. trace = traceback.format_exc()
  113. print (trace)
  114. def getLastTopicVersion(cur, topicId):
  115. try:
  116. cur.execute("select version_topic from topics_history where topic_id = %(topicId)s order by version_topic desc limit 1", {'topicId': topicId})
  117. recset = cur.fetchall()
  118. if recset:
  119. return recset[0]['version_topic']
  120. else:
  121. return 0
  122. except:
  123. trace = traceback.format_exc()
  124. print (trace)
  125. def getLastPostVersion(cur, postId):
  126. try:
  127. cur.execute("select version_post from posts_history where post_id = %(postId)s order by version_post desc limit 1", {'postId': postId})
  128. recset = cur.fetchall()
  129. if recset:
  130. return recset[0]['version_post']
  131. else:
  132. return 0
  133. except:
  134. trace = traceback.format_exc()
  135. print (trace)
  136. def getLastPost(cur):
  137. try:
  138. cur.execute("select post_id from posts order by post_id desc limit 1")
  139. recset = cur.fetchall()
  140. if recset:
  141. return recset[0]['post_id']
  142. else:
  143. return 0
  144. except:
  145. trace = traceback.format_exc()
  146. print (trace)
  147. def create_forum(cur, row, url):
  148. forumId = verifyForum(cur, row[0])
  149. if not forumId:
  150. forumId = int(getLastForum(cur) + 1)
  151. sql = "Insert into forums (forum_id, name_forum, url_forum, dateinserted_forum) Values (%s, %s, %s, %s)"
  152. recset = [forumId, row[0], url, row[8]]
  153. cur.execute(sql, recset)
  154. return forumId
  155. def create_topic(cur, forumId, row, authorId):
  156. topicId = verifyTopic(cur, forumId, authorId, row[3])
  157. if not topicId:
  158. topicId = int(getLastTopic(cur) + 1)
  159. newTopic = True
  160. else:
  161. newTopic = False
  162. if newTopic:
  163. sql = "Insert into topics (topic_id, forum_id, author_id, title_topic, board_topic, views_topic, posts_topic, " \
  164. "href_topic, dateadded_topic, dateinserted_topic, classification_topic) Values (%s, %s, %s, %s, %s, %s, " \
  165. "%s, %s, %s, %s, %s)"
  166. recset = [topicId, forumId, authorId,
  167. row[3], row[1],
  168. row[4] if row[4] != '-1' else None,
  169. row[5] if row[5] != '-1' else None,
  170. row[6] if row[6] != '-1' else None,
  171. row[7] if row[7] != '-1' else None,
  172. row[8],
  173. row[19]]
  174. cur.execute(sql, recset)
  175. else:
  176. # Tracking potential topic changes
  177. sql = "select * from topics where topic_Id = %(topicId)s"
  178. cur.execute(sql, {'topicId': topicId})
  179. recset = cur.fetchall()
  180. if (str(recset[0]['board_topic']) != str(row[1]) or
  181. str(recset[0]['views_topic']) != str(row[4] if row[4] != '-1' else None) or # there was a change in the topic information
  182. str(recset[0]['posts_topic']) != str(row[5] if row[5] != '-1' else None)):
  183. topicVersionId = int(getLastTopicVersion(cur, topicId) + 1)
  184. sql = "Insert into topics_history (topic_id, version_topic, forum_id, author_id, title_topic, board_topic, views_topic, posts_topic, " \
  185. "href_topic, dateadded_topic, dateinserted_topic, classification_topic) Values (%s, %s, %s, %s, %s, " \
  186. "%s, %s, %s, %s, %s, %s, %s)"
  187. recset = [topicId, topicVersionId, forumId, authorId,
  188. recset[0]['title_topic'],
  189. recset[0]['board_topic'],
  190. recset[0]['views_topic'],
  191. recset[0]['posts_topic'],
  192. recset[0]['href_topic'],
  193. recset[0]['dateadded_topic'],
  194. recset[0]['dateinserted_topic'],
  195. recset[0]['classification_topic']]
  196. cur.execute(sql, recset)
  197. sql = "Update topics set board_topic = %(board_topic)s, views_topic = %(views_topic)s, posts_topic = %(posts_topic)s, " \
  198. "dateinserted_topic = %(dateinserted_topic)s where topic_id = %(topicId)s"
  199. cur.execute(sql, {'board_topic': row[1],
  200. 'views_topic': row[4] if row[4] != '-1' else None,
  201. 'posts_topic': row[5] if row[5] != '-1' else None,
  202. 'dateinserted_topic': row[8],
  203. 'topicId': topicId})
  204. return topicId
  205. def create_author(cur, row, forumId):
  206. userId = verifyUser(cur, row[2], forumId)
  207. if not userId:
  208. userId = int(getLastUser(cur) + 1)
  209. sql = "Insert into users (user_id, forum_id, name_user, status_user, reputation_user, interest_user, " \
  210. "signature_user, image_user, dateinserted_user) Values (%s, %s, %s, %s, %s, %s, %s, %s, %s)"
  211. recset = [userId, forumId,
  212. row[2], 'Nan', 'Nan', 'Nan', 'Nan', 'Nan', #telling the create_user function to not track changes here
  213. row[8]]
  214. cur.execute(sql, recset)
  215. return userId
  216. def create_user(cur, row, forumId, index):
  217. userId = verifyUser(cur, row[10][index], forumId)
  218. if not userId:
  219. userId = int(getLastUser(cur) + 1)
  220. newUser = True
  221. else:
  222. newUser = False
  223. if newUser:
  224. sql = "Insert into users (user_id, forum_id, name_user, status_user, reputation_user, interest_user, " \
  225. "signature_user, image_user, dateinserted_user) Values (%s, %s, %s, %s, %s, %s, %s, %s, %s)"
  226. recset = [userId, forumId,
  227. row[10][index],
  228. row[11][index] if row[11][index] != '-1' else None,
  229. row[12][index] if row[12][index] != '-1' else None,
  230. row[13][index] if row[13][index] != '-1' else None,
  231. row[14][index] if row[14][index] != '-1' else None,
  232. row[9][index] if row[9][index] != '-1' else None,
  233. row[8]]
  234. cur.execute(sql, recset)
  235. else:
  236. # Tracking potential user changes
  237. sql = "select * from users where user_id = %(userId)s"
  238. cur.execute(sql, {'userId': userId})
  239. recset = cur.fetchall()
  240. #decode_decrypt_image_in_base64(recset[0]['image_user'])
  241. if (str(recset[0]['status_user']) != str(row[11][index] if row[11][index] != '-1' else None) or
  242. str(recset[0]['reputation_user']) != str(row[12][index] if row[12][index] != '-1' else None) or
  243. str(recset[0]['interest_user']) != str(row[13][index] if row[13][index] != '-1' else None) or
  244. str(recset[0]['signature_user']) != str(row[14][index] if row[14][index] != '-1' else None) or
  245. str(recset[0]['image_user']) != str(row[9][index] if row[9][index] != '-1' else None)): # there was a change in the user information
  246. if (str(recset[0]['status_user']) != 'Nan' or
  247. str(recset[0]['reputation_user']) != 'Nan' or
  248. str(recset[0]['interest_user']) != 'Nan' or
  249. str(recset[0]['signature_user']) != 'Nan' or
  250. str(recset[0]['image_user']) != 'Nan'):
  251. userVersionId = int(getLastUserVersion(cur, userId) + 1)
  252. sql = "Insert into users_history (user_id, version_user, forum_id, name_user, status_user, reputation_user, interest_user, " \
  253. "signature_user, image_user, dateinserted_user) Values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
  254. recset = [userId, userVersionId, forumId,
  255. recset[0]['name_user'],
  256. recset[0]['status_user'],
  257. recset[0]['reputation_user'],
  258. recset[0]['interest_user'],
  259. recset[0]['signature_user'],
  260. recset[0]['image_user'],
  261. recset[0]['dateinserted_user']]
  262. cur.execute(sql, recset)
  263. sql = "Update users set status_user = %(status_user)s, reputation_user = %(reputation_user)s, " \
  264. "interest_user = %(interest_user)s, signature_user = %(signature_user)s, image_user = %(image_user)s, " \
  265. "dateinserted_user = %(dateinserted_user)s where user_id = %(userId)s"
  266. cur.execute(sql, {'status_user': row[11][index] if row[11][index] != '-1' else None,
  267. 'reputation_user': row[12][index] if row[12][index] != '-1' else None,
  268. 'interest_user': row[13][index] if row[13][index] != '-1' else None,
  269. 'signature_user': row[14][index] if row[14][index] != '-1' else None,
  270. 'image_user': row[9][index] if row[9][index] != '-1' else None,
  271. 'dateinserted_user': row[8] if row[8] != '-1' else None,
  272. 'userId': userId})
  273. return userId
  274. def create_posts(cur, row, forumId, topicId):
  275. if row[10] != "-1":
  276. for i in range(len(row[10])):
  277. userId = create_user(cur, row, forumId, i)
  278. postId = verifyPost(cur, topicId, userId, row[17][i])
  279. if not postId:
  280. postId = int(getLastPost(cur) + 1)
  281. sql = "Insert into posts (post_id, topic_id, user_id, content_post, feedback_post, image_post," \
  282. "dateadded_post, dateinserted_post) Values (%s, %s, %s, %s, %s, %s, %s, %s)"
  283. recset = [postId, topicId, userId,
  284. row[15][i] if row[15][i] != '-1' else None,
  285. row[16][i] if row[16][i] != '-1' else None,
  286. row[18][i] if row[18][i] != '-1' else None,
  287. row[17][i] if row[17][i] != '-1' else None,
  288. row[8]]
  289. cur.execute(sql, recset)
  290. else:
  291. # Tracking potential post changes
  292. sql = "select * from posts where post_id = %(postId)s"
  293. cur.execute(sql, {'postId': postId})
  294. recset = cur.fetchall()
  295. if (str(recset[0]['content_post']) != str(row[15][i]) or
  296. str(recset[0]['feedback_post']) != str(row[16][i] if row[16][i] != '-1' else None) or
  297. str(recset[0]['image_post']) != str(row[18][i] if row[18][i] != '-1' else None)): # there was a change in the post information
  298. #decode_decrypt_image_in_base64(recset[0]['image_post'])
  299. postVersionId = int(getLastPostVersion(cur, postId) + 1)
  300. sql = "Insert into posts_history (post_id, version_post, topic_id, user_id, content_post, feedback_post, " \
  301. "image_post, dateadded_post, dateinserted_post) Values (%s, %s, %s, %s, %s, %s, %s, %s, %s)"
  302. recset = [postId, postVersionId, topicId, userId,
  303. recset[0]['content_post'],
  304. recset[0]['feedback_post'],
  305. recset[0]['image_post'],
  306. recset[0]['dateadded_post'],
  307. recset[0]['dateinserted_post']]
  308. cur.execute(sql, recset)
  309. sql = "Update posts set content_post = %(content_post)s, feedback_post = %(feedback_post)s, " \
  310. "image_post = %(image_post)s, dateinserted_post = %(dateinserted_post)s where post_id = %(postId)s"
  311. cur.execute(sql, {'content_post': row[15][i] if row[15][i] != '-1' else None,
  312. 'feedback_post': row[16][i] if row[16][i] != '-1' else None,
  313. 'image_post': row[18][i] if row[18][i] != '-1' else None,
  314. 'dateinserted_post': row[8],
  315. 'postId': postId})
  316. def create_status(cur, forumId, date, listings, descriptions, status):
  317. date = datetime.strptime(date, "%m%d%Y")
  318. # getting last Fridays a reference date
  319. date_reference = date + relativedelta(weekday=FR(-1))
  320. # checking if status already exists
  321. sql = "select * from forums_status where forum_id = %(forum_id)s and date_inserted = %(date_inserted)s"
  322. cur.execute(sql, {'forum_id': forumId, 'date_inserted': date})
  323. recset = cur.fetchall()
  324. if recset:
  325. sql = "Update forums_status set listings = %(listings)s, descriptions = %(descriptions)s, status = %(status)s, date_reference = %(date_reference)s " \
  326. "where forum_id = %(forum_id)s and date_inserted = %(date_inserted)s"
  327. recset = {'listings': listings, 'descriptions': descriptions, 'status': status, 'date_reference': date_reference, 'forum_id': forumId, 'date_inserted': date}
  328. else:
  329. sql = "Insert into forums_status (forum_id, date_inserted, listings, descriptions, status, date_reference) Values (%s, %s, %s, %s, %s, %s)"
  330. recset = [forumId, date, listings, descriptions, status, date_reference]
  331. cur.execute(sql, recset)
  332. def create_database(cur, con):
  333. try:
  334. sql = "create table forums (forum_id integer NOT NULL, name_forum character varying(255) NOT NULL, url_forum " \
  335. "character varying(255) NOT null, dateinserted_forum timestamp(6) with time zone NOT NULL, " \
  336. "constraint forums_pk primary key (forum_id))"
  337. cur.execute(sql)
  338. sql = "create unique index unique_forum ON forums USING btree (name_forum ASC NULLS LAST)"
  339. cur.execute(sql)
  340. sql = "Create table forums_status (forum_id integer NOT NULL, date_inserted date NOT NULL, " \
  341. "listings integer NOT NULL, descriptions integer NOT NULL, status bit(1) NOT NULL, date_reference date NOT NULL, " \
  342. "constraint forums_status_pk PRIMARY KEY (forum_id, date_inserted), " \
  343. "constraint forums_status_fk FOREIGN KEY (forum_id) REFERENCES forums (forum_id))"
  344. cur.execute(sql)
  345. sql = "create table users (user_id integer NOT NULL, forum_id integer NOT NULL, name_user character varying(" \
  346. "255) NOT NULL, status_user character varying(255) null, reputation_user character varying(255) null, " \
  347. "interest_user character varying(5000) null, signature_user character varying(1000) null, " \
  348. "image_user character varying(10000000) null, dateinserted_user timestamp(6) with time zone NOT NULL, " \
  349. "constraint users_pk primary key (user_id), " \
  350. "constraint users_forum_id_fk foreign key (forum_id) references forums (forum_id))"
  351. cur.execute(sql)
  352. sql = "create unique index unique_user ON users USING btree (forum_id ASC NULLS LAST, name_user ASC NULLS LAST)"
  353. cur.execute(sql)
  354. sql = "create table users_history(user_id integer NOT NULL, version_user integer not null, forum_id integer NOT NULL, " \
  355. "name_user character varying(255) NOT NULL, status_user character varying(255) null, " \
  356. "reputation_user character varying(255) null, interest_user character varying(5000) null, " \
  357. "signature_user character varying(1000) null, image_user character varying(10000000) null, " \
  358. "dateinserted_user timestamp(6) with time zone NOT NULL, " \
  359. "constraint users_history_pk primary key (user_id, version_user), " \
  360. "constraint users_history_user_id_fk foreign key (user_id) references users (user_id), " \
  361. "constraint users_history_forum_id_fk foreign key (forum_id) references forums (forum_id))"
  362. cur.execute(sql)
  363. sql = "create table topics(topic_id integer NOT NULL, forum_id integer NOT NULL, author_id integer NOT NULL, " \
  364. "title_topic character varying(255) NOT NULL, board_topic character varying(255) NOT NULL, views_topic integer null, " \
  365. "posts_topic integer null, href_topic character varying(255) NOT null, dateadded_topic timestamp(6) with time zone null, " \
  366. "dateinserted_topic timestamp(6) with time zone NOT NULL, classification_topic double precision NOT NULL, " \
  367. "constraint topics_pk primary key (topic_id), " \
  368. "constraint topics_author_id_fk foreign key (author_id) references users (user_id), " \
  369. "constraint topics_forum_id_fk foreign key (forum_id) references forums (forum_id))"
  370. cur.execute(sql)
  371. sql = "create unique index unique_topic ON topics USING btree (forum_id ASC NULLS LAST, author_id ASC NULLS LAST, " \
  372. "title_topic ASC NULLS LAST)"
  373. cur.execute(sql)
  374. sql = "create table topics_history(topic_id integer NOT NULL, version_topic integer not null, forum_id integer NOT NULL, " \
  375. "author_id integer NOT NULL, title_topic character varying(255) NOT NULL, board_topic character varying(255) NOT NULL, " \
  376. "views_topic integer null, posts_topic integer null, href_topic character varying(255) NOT null, " \
  377. "dateadded_topic timestamp(6) with time zone null, dateinserted_topic timestamp(6) with time zone NOT NULL, " \
  378. "classification_topic double precision NOT NULL, " \
  379. "constraint topics_history_pk primary key (topic_id, version_topic), " \
  380. "constraint topics_history_topic_id_fk foreign key (topic_id) references topics (topic_id), " \
  381. "constraint topics_history_author_id_f foreign key (author_id) references users (user_id), " \
  382. "constraint topics_history_board_id_fk foreign key (forum_id) references forums (forum_id))"
  383. cur.execute(sql)
  384. sql = "create table posts(post_id integer NOT NULL, topic_id integer NOT NULL, " \
  385. "user_id integer NOT NULL, content_post character varying(100000) NOT null, feedback_post integer null, " \
  386. "image_post character varying(10000000) null, dateadded_post timestamp(6) with time zone NOT NULL, " \
  387. "dateinserted_post timestamp(6) with time zone NOT NULL, " \
  388. "constraint posts_pk primary key (post_id), " \
  389. "constraint posts_user_id_fk foreign key (user_id) references users (user_id), " \
  390. "constraint posts_topic_id_fk foreign key (topic_id) references topics (topic_id))"
  391. cur.execute(sql)
  392. sql = "create unique index unique_post ON posts USING btree (topic_id ASC NULLS LAST, user_id ASC NULLS LAST, " \
  393. "dateadded_post ASC NULLS LAST)"
  394. cur.execute(sql)
  395. sql = "create table posts_history(post_id integer NOT NULL, version_post integer not null, topic_id integer NOT NULL, " \
  396. "user_id integer NOT NULL, content_post character varying(100000) NOT null, feedback_post integer null, " \
  397. "image_post character varying(10000000) null, dateadded_post timestamp(6) with time zone NOT NULL, " \
  398. "dateinserted_post timestamp(6) with time zone NOT NULL, " \
  399. "constraint posts_history_pk primary key (post_id, version_post), " \
  400. "constraint posts_history_user_id_fk foreign key (user_id) references users (user_id), " \
  401. "constraint posts_history_topic_id_fk foreign key (topic_id) references topics (topic_id), " \
  402. "constraint posts_history_post_id_fk foreign key (post_id) references posts (post_id))"
  403. cur.execute(sql)
  404. con.commit()
  405. except:
  406. con.rollback()
  407. trace = traceback.format_exc()
  408. if (trace.find("already exists")==-1):
  409. print ("There was a problem during the database creation." )
  410. raise SystemExit