From e054cbbdb28a9b555faafd689282140c01d55b3e Mon Sep 17 00:00:00 2001 From: flaviojs Date: Thu, 16 Jun 2011 10:22:35 +0000 Subject: * Merges from charmerge: - Added DBMap::exists. (r14090) - Added sv_parse_next, a stepped version of sv_parse (delim-separated parser). (r14100 r14104) - Added missing fd check to do_close. (r14145) - Normalized, refactored and restructured some code (in preparation for shutdown/reconnect code). (r14145 r14150) - Changed the char select request code to allow the char-server to reject it. (player in map-server trying to go to char select) (r14150) - Added shutdown support to the servers. (incomplete) (r14152) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14851 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/db.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/common/db.h') diff --git a/src/common/db.h b/src/common/db.h index c1b224bcd..e02de2e08 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -359,6 +359,15 @@ struct DBMap { */ DBIterator* (*iterator)(DBMap* self); + /** + * Returns true if the entry exists. + * @param self Database + * @param key Key that identifies the entry + * @return true is the entry exists + * @protected + */ + bool (*exists)(DBMap* self, DBKey key); + /** * Get the data of the entry identifid by the key. * @param self Database @@ -580,6 +589,11 @@ struct DBMap { # define str2key(k) ((DBKey)(const char *)(k)) #endif /* not DB_MANUAL_CAST_TO_UNION */ +#define db_exists(db,k) ( (db)->exists((db),(k)) ) +#define idb_exists(db,k) ( (db)->exists((db),i2key(k)) ) +#define uidb_exists(db,k) ( (db)->exists((db),ui2key(k)) ) +#define strdb_exists(db,k) ( (db)->exists((db),str2key(k)) ) + #define db_get(db,k) ( (db)->get((db),(k)) ) #define idb_get(db,k) ( (db)->get((db),i2key(k)) ) #define uidb_get(db,k) ( (db)->get((db),ui2key(k)) ) -- cgit v1.2.3-70-g09d2