Refactors dbcon into a subsystem
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
. = list()
|
||||
if(!isnum(amount) || amount<1)
|
||||
return
|
||||
if (!GLOB.dbcon.Connect())
|
||||
if (!SSdbcore.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>"
|
||||
@@ -45,7 +45,7 @@
|
||||
if(prob(25))
|
||||
category = null
|
||||
var/c = category? " AND category='[sanitizeSQL(category)]'" :""
|
||||
var/DBQuery/query_get_random_books = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [amount];") // isdeleted copyright (c) not me
|
||||
var/datum/DBQuery/query_get_random_books = SSdbcore.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [amount];") // isdeleted copyright (c) not me
|
||||
if(query_get_random_books.Execute())
|
||||
while(query_get_random_books.NextRow())
|
||||
var/obj/item/weapon/book/B = new(location)
|
||||
|
||||
Reference in New Issue
Block a user