disabled books ever using sql

This commit is contained in:
Tastyfish
2012-04-14 16:31:38 -04:00
parent 3f2b0e7eb7
commit f697c82919
2 changed files with 7 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
#define BOOK_VERSION_MIN 1 #define BOOK_VERSION_MIN 1
#define BOOK_VERSION_MAX 2 #define BOOK_VERSION_MAX 2
#define BOOK_PATH "data/books/" #define BOOK_PATH "data/books/"
#define BOOKS_USE_SQL 0 // no guarentee for this branch to work right with sql
var/global/datum/book_manager/book_mgr = new() var/global/datum/book_manager/book_mgr = new()
@@ -41,7 +42,7 @@ datum/book_manager/proc/freeid()
if(!isbn) if(!isbn)
return return
if(config.sql_enabled) if(BOOKS_USE_SQL && config.sql_enabled)
var/DBConnection/dbcon = new() var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
if(!dbcon.IsConnected()) if(!dbcon.IsConnected())

View File

@@ -2,17 +2,6 @@
// //
// Library SQL Configuration // Library SQL Configuration
// //
//*******************************
// Deprecated! See global.dm for new SQL config vars -- TLE
/*
#define SQL_ADDRESS ""
#define SQL_DB ""
#define SQL_PORT "3306"
#define SQL_LOGIN ""
#define SQL_PASS ""
*/
//******************************* //*******************************
// Requires Dantom.DB library ( http://www.byond.com/developer/Dantom/DB ) // Requires Dantom.DB library ( http://www.byond.com/developer/Dantom/DB )
@@ -499,7 +488,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
dat += "<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>" 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>" dat += "<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"
if(1) if(1)
if(config.sql_enabled) if(BOOKS_USE_SQL && config.sql_enabled)
var/DBConnection/dbcon = new() var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
if(!dbcon.IsConnected()) if(!dbcon.IsConnected())
@@ -563,7 +552,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
author = null author = null
author = dd_replacetext(author, "'", "''") author = dd_replacetext(author, "'", "''")
if(href_list["search"]) if(href_list["search"])
if(config.sql_enabled) if(BOOKS_USE_SQL && config.sql_enabled)
SQLquery = "SELECT author, title, category, id FROM library WHERE " SQLquery = "SELECT author, title, category, id FROM library WHERE "
if(category == "Any") if(category == "Any")
SQLquery += "author LIKE '%[author]%' AND title LIKE '%[title]%'" SQLquery += "author LIKE '%[author]%' AND title LIKE '%[title]%'"
@@ -659,7 +648,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
dat += "<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>" dat += "<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
if(4) if(4)
dat += "<h3>External Archive</h3>" dat += "<h3>External Archive</h3>"
if(config.sql_enabled) if(BOOKS_USE_SQL && config.sql_enabled)
var/DBConnection/dbcon = new() var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
if(!dbcon.IsConnected()) if(!dbcon.IsConnected())
@@ -821,7 +810,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if(scanner.cache) if(scanner.cache)
var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort") var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort")
if(choice == "Confirm") if(choice == "Confirm")
if(config.sql_enabled) if(BOOKS_USE_SQL && config.sql_enabled)
var/DBConnection/dbcon = new() var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
if(!dbcon.IsConnected()) if(!dbcon.IsConnected())
@@ -868,7 +857,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
log_game("[usr.name]/[usr.key] has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs") log_game("[usr.name]/[usr.key] has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs")
alert("Upload Complete.") alert("Upload Complete.")
if(href_list["targetid"]) if(href_list["targetid"])
if(config.sql_enabled) if(BOOKS_USE_SQL && config.sql_enabled)
var/sqlid = href_list["targetid"] var/sqlid = href_list["targetid"]
var/DBConnection/dbcon = new() var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]") dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")