SQL backstage update

Since Aurora only has one SQL database, I've removed the old database
proc and object (dbcon_old). It'll make everything connect to the same
database, and be less of a hassle with the config files.
This commit is contained in:
skull132
2015-06-21 17:34:28 +03:00
parent 8b842a7be8
commit fce65e8e42
5 changed files with 18 additions and 75 deletions
+12 -12
View File
@@ -43,8 +43,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>
<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"}
if(1)
establish_old_db_connection()
if(!dbcon_old.IsConnected())
establish_db_connection()
if(!dbcon.IsConnected())
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font><BR>"
else if(!SQLquery)
dat += "<font color=red><b>ERROR</b>: Malformed search request. Please contact your system administrator for assistance.</font><BR>"
@@ -52,7 +52,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
dat += {"<table>
<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td>SS<sup>13</sup>BN</td></tr>"}
var/DBQuery/query = dbcon_old.NewQuery(SQLquery)
var/DBQuery/query = dbcon.NewQuery(SQLquery)
query.Execute()
while(query.NextRow())
@@ -189,15 +189,15 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"}
if(4)
dat += "<h3>External Archive</h3>"
establish_old_db_connection()
if(!dbcon_old.IsConnected())
establish_db_connection()
if(!dbcon.IsConnected())
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
else
dat += {"<A href='?src=\ref[src];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>
<table>
<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td></td></tr>"}
var/DBQuery/query = dbcon_old.NewQuery("SELECT id, author, title, category FROM library")
var/DBQuery/query = dbcon.NewQuery("SELECT id, author, title, category FROM library")
query.Execute()
while(query.NextRow())
@@ -332,8 +332,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if(scanner.cache.unique)
alert("This book has been rejected from the database. Aborting!")
else
establish_old_db_connection()
if(!dbcon_old.IsConnected())
establish_db_connection()
if(!dbcon.IsConnected())
alert("Connection to Archive has been severed. Aborting.")
else
/*
@@ -347,7 +347,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
var/sqlcontent = sanitizeSQL(scanner.cache.dat)
var/sqlcategory = sanitizeSQL(upload_category)
var/sqluploader = sanitizeSQL(usr.key)
var/DBQuery/query = dbcon_old.NewQuery("INSERT INTO library (author, title, content, category, uploadtime, uploader) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', Now(), '[sqluploader]')")
var/DBQuery/query = dbcon.NewQuery("INSERT INTO library (author, title, content, category, uploadtime, uploader) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', Now(), '[sqluploader]')")
if(!query.Execute())
usr << query.ErrorMsg()
else
@@ -356,8 +356,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if(href_list["targetid"])
var/sqlid = sanitizeSQL(href_list["targetid"])
establish_old_db_connection()
if(!dbcon_old.IsConnected())
establish_db_connection()
if(!dbcon.IsConnected())
alert("Connection to Archive has been severed. Aborting.")
if(bibledelay)
for (var/mob/V in hearers(src))
@@ -366,7 +366,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
bibledelay = 1
spawn(60)
bibledelay = 0
var/DBQuery/query = dbcon_old.NewQuery("SELECT * FROM library WHERE id=[sqlid]")
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM library WHERE id=[sqlid]")
query.Execute()
while(query.NextRow())