Moves some stuff that belongs in dbcore to dbcore (#24145)

* Moves some stuff that belongs in dbcore to dbcore

* Wew garbage

* Ree

* Fixed
This commit is contained in:
Cyberboss
2017-02-19 14:21:53 +13:00
committed by oranges
parent 9fbd95320a
commit 2d424cf6be
15 changed files with 64 additions and 105 deletions
+4 -8
View File
@@ -43,8 +43,7 @@
dat += "<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>"
dat += "<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"
if(1)
establish_db_connection()
if(!dbcon.IsConnected())
if (!dbcon.Connect())
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>"
@@ -135,8 +134,7 @@ var/global/list/datum/cachedbook/cachedbooks // List of our cached book datums
/proc/load_library_db_to_cache()
if(cachedbooks)
return
establish_db_connection()
if(!dbcon.IsConnected())
if(!dbcon.Connect())
return
cachedbooks = list()
var/DBQuery/query = dbcon.NewQuery("SELECT id, author, title, category FROM [format_table_name("library")] WHERE isnull(deleted)")
@@ -408,8 +406,7 @@ var/global/list/datum/cachedbook/cachedbooks // List of our cached book datums
if(scanner.cache)
var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort")
if(choice == "Confirm")
establish_db_connection()
if(!dbcon.IsConnected())
if (!dbcon.Connect())
alert("Connection to Archive has been severed. Aborting.")
else
@@ -446,8 +443,7 @@ var/global/list/datum/cachedbook/cachedbooks // List of our cached book datums
if(href_list["targetid"])
var/sqlid = sanitizeSQL(href_list["targetid"])
establish_db_connection()
if(!dbcon.IsConnected())
if (!dbcon.Connect())
alert("Connection to Archive has been severed. Aborting.")
if(cooldown > world.time)
say("Printer unavailable. Please allow a short time before attempting to print.")
+1 -1
View File
@@ -34,7 +34,7 @@
. = list()
if(!isnum(amount) || amount<1)
return
if(!establish_db_connection())
if (!dbcon.Connect())
if(fail_loud || prob(5))
var/obj/item/weapon/paper/P = new(location)
P.info = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>"