From 0838d4507a2f423bde4f2ceffcc809694196bde8 Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Tue, 7 May 2013 17:41:05 -0400 Subject: [PATCH 1/2] Fix NULL to nullptr for SQL queries --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d389cfcac..9724dec22 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6129,7 +6129,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " " WHERE tr.id IN (%s) " - " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT nullptr) OR (tr.must_learn & 0x3 = 0)) " + " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 100 ", CharacterID(), buf, containers); @@ -6184,7 +6184,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " " WHERE %s tr.trivial >= %u AND tr.trivial <= %u " - " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT nullptr) OR (tr.must_learn & 0x3 = 0)) " + " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 200 " From 059ecdb50b6373b1def84827efb09d8d45e9c7a6 Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Tue, 7 May 2013 18:20:09 -0400 Subject: [PATCH 2/2] Fix NULL to nullptr for SQL queries take 2 --- common/database.cpp | 8 ++++---- zone/mob.cpp | 4 ++-- zone/questmgr.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index c03ad97cf..8960a58e0 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -428,7 +428,7 @@ bool Database::ReserveName(uint32 account_id, char* name) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=nullptr", account_id, name), errbuf)) { + if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=NULL", account_id, name), errbuf)) { cerr << "Error in ReserveName query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; @@ -1196,9 +1196,9 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe { cerr << "Error in GetSafePoint query '" << query << "' " << errbuf << endl; cerr << "If it errors, run the following querys:\n"; - cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT nullptr;\n"; - cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT nullptr;\n"; - cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT nullptr DEFAULT '';\n"; + cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; + cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; + cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT NULL DEFAULT '';\n"; safe_delete_array(query); } diff --git a/zone/mob.cpp b/zone/mob.cpp index 6529a505a..6782a8826 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3784,12 +3784,12 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna char *query = 0; char errbuf[MYSQL_ERRMSG_SIZE]; - // Make duration string either "unix_timestamp(now()) + xxx" or "nullptr" + // Make duration string either "unix_timestamp(now()) + xxx" or "NULL" stringstream duration_ss; if (duration == INT_MAX) { - duration_ss << "nullptr"; + duration_ss << "NULL"; } else { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index bc7ac3f75..d29e99e87 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1241,11 +1241,11 @@ int QuestManager::InsertQuestGlobal( char *query = 0; char errbuf[MYSQL_ERRMSG_SIZE]; - // Make duration string either "unix_timestamp(now()) + xxx" or "nullptr" + // Make duration string either "unix_timestamp(now()) + xxx" or "NULL" stringstream duration_ss; if (duration == INT_MAX) { - duration_ss << "nullptr"; + duration_ss << "NULL"; } else {