summaryrefslogtreecommitdiff
path: root/src/map/mapreg_sql.c
AgeCommit message (Collapse)AuthorFilesLines
2018-05-312012-2018 !Maytichai Saowa1-1/+1
2017-11-18Pass the correct types and sizes to the StmtBind functionsHaru1-3/+3
Fixes #1531 (and other similar issues) Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported inter-server.conf to libconfigHaru1-7/+14
Ported to modern Hercules and cleaned up from Panikon's commits: 40f9ec33868e2240cab013308897898ed252b3e0, a9d646da19e25ab6fcf44dbd1ae7d90c30f6686c, 1aa8581a0aecbfd53e877686c399ffb731dcd75e, 72c645b015ae6130ca7d4309d0fb1413340e7f23, f8c906a0496b9acdae1d8244b1544fa03592061e, 51d88a58983c9552dfd1a0f059e5a031742aed61, 443684b3c77f4c32fe7877a7f8d62debf73b1e93, cf93eafef1f322cd1583226272b7d4008f562da4 Signed-off-by: Haru <haru@dotalux.com>
2016-04-04Add missing checks into mapreg_sql.cAndrei Karas1-0/+7
2016-03-20Dropped typedef from DBIteratorHaru1-3/+4
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedefs from union DBKey and struct DBDataHaru1-1/+2
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Removed unnecessary typedefs from sql.hHaru1-1/+1
- Sql -> struct Sql - SqlStmt -> struct SqlStmt - SqlDataType -> enum SqlDataType This is expected to improve compile time, by removing #include cycles (and forward declaring instead) Signed-off-by: Haru <haru@dotalux.com>
2016-02-19Fix all known warnings from compiler flags -Wformat*Andrei Karas1-4/+4
Add all missing -Wformat flags into configure.
2015-12-22Ensured 32+1 bytes for all buffers that hold variable namesHaru1-6/+6
Related: #865, #866, #867 Signed-off-by: Haru <haru@dotalux.com>
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-4/+20
Signed-off-by: Haru <haru@dotalux.com>
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
2015-08-15HPM compatibility improvementsHaru1-0/+1
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-11/+11
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-7/+5
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Re-commit of "Fixed order of includes in all source files"Haru1-5/+9
This reverts commit 94657284973f4037596bae468ebfbee5c217e02b.
2014-05-10Revert "Fixed order of includes in all source files"panikon1-9/+5
This reverts commit b6b3f58795288701d0e162d43fa6f0a47af913b3. Fixes issue 8184 http://hercules.ws/board/tracker/issue-8184-cart-related/
2014-05-09Fixed order of includes in all source filesHaru1-5/+9
- Changed order according to the (upcoming) code style guidelines. - Fixes several issues caused by missing headers when their include order is changed or in plugins. Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Ref redesign, part 3Haru1-4/+4
- Updated several functions to properly use the data structures defined in parts 1 and 2. - Special thanks to Ind for his help on this, as well as the previous two parts. - Fixes some crashes related to variable references passed back and forth between nested callfunc/callsub scopes (related: 2669e9a, 3259f89, 4f2de07) Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Ref redesign, part 2Haru1-26/+26
- Reorganized regs var/array DBMaps into a specific reg_db structure Signed-off-by: Haru <haru@dotalux.com>
2014-03-05Ref redesign, part 1Haru1-107/+121
- Moved string and numeric mapregs into the same DBMap (for consistency with the other reg types.) Signed-off-by: Haru <haru@dotalux.com>
2014-01-16Minor redundancy fix on mapreg loadingshennetsind1-2/+2
so that it skips set_reg. Thanks to Michieru Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Follow up 82b583b5ef4e729ad2c3c74b26adce16a145605ashennetsind1-1/+4
Fixed mapreg reload issue, sql_query not returning results, and caused deletearray to no longer display error messages when the array in question is not available. Special Thanks to Haruna, ossi0110 Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Hercules 1st 2014 MegaPatchshennetsind1-42/+57
http://hercules.ws/board/topic/3886-hercules-1st-2014-megapatch/ Signed-off-by: shennetsind <ind@henn.et>
2013-12-17Speed up of several procedures that rely on ERS, _mreallocz ('z'ero)shennetsind1-1/+1
Made Possible Thanks to the Woonderful Haruna! <3 Commit also fixes an inconsistency in the ERS, where it'd start with clear memory but would use garbage upon resizing, also implements a new ERS option that clears entries as soon as pass by ers_free, so that they'll be all shinny for when ers_alloc reuses them. Signed-off-by: shennetsind <ind@henn.et>
2013-10-26Changed 'tick' variables to 64 bitHaru1-1/+1
- This fixes an issue with timers that stop working after about 24-49 days when the tick overflows (note that this may happen much earlier than that, and at hard to predict times, on some systems) - Updated the RDTSC help message in the configure script to also warn users about issues with SpeedStep enabled systems. - On Windows, tick() still has a resolution of 10~15ms (or even as low as 100ms on some systems). A TODO comment (thanks, Ai4rei) was added for a follow-up patch, as I want this one to be as small as possible) - Note: on Windows versions earlier than 6.x (Vista, Server 2008), the tick overflow issue is NOT fixed, since they don't support the function used to retrieve a 64 bit tick. This isn't a big issue, since those platforms are already - or going soon to be - out of their extended support period, and it's already advisable to upgrade, for other reasons. If you're the unfortunate user of such a system, it is recommended that you reboot your machine at least once every 49 days for Hercules to work reliably. - Note: To clear some doubts, since I've already been asked, this has absolutely NOTHING to do with 32/64 bit CPUs or OSes. It's all about a variable's size, not the size of registers of your CPU, and your 32bit CPU will be able to handle this just fine. Signed-off-by: Haru <haru@dotalux.com>
2013-10-02HPM: Map.c Completedshennetsind1-18/+18
Fully Interfaced. Moved missing vars and declarations of interest into the interface, removed duplicate mentions of map within calls to shorten wherever it made sense to. Ladies and Gentleman its my pleasure to announce that with this commit we've revised all of map-server, we've learned a hell lot from this, improved many things on the go and have a number of features to be released thanks to this. *cough* hpm hooking *cough*. Signed-off-by: shennetsind <ind@henn.et>
2013-09-25Renamed iTimer interface to timer.shennetsind1-2/+2
Also removed duplicate mentions of timer within calls to shorten.
2013-09-16HPM: Mapreg_sql.c Interfaceshennetsind1-71/+92
Fully Integrated Signed-off-by: shennetsind <ind@henn.et>
2013-07-25Expanding script.c interfaceshennetsind1-5/+5
Hercules Renewal Phase One. Signed-off-by: shennetsind <ind@henn.et>
2013-06-10Added SqlStmt functions to the SQL interfaceSusu1-9/+9
2013-06-07Hercules Renewal Phase One : pc, party, map, timerSusu1-2/+2
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
2013-05-15HPM Updateshennetsind1-10/+10
Made SQL and strlib functions HPM-friendly, special thanks to Yommy for bringing the issue up. Added partial map.c support, for the all-handy map[] array, beware that soon the whole map.c renewal design will be commit and when that happens your usage of map.c functions in plugins might require some updates. Signed-off-by: shennetsind <ind@henn.et>
2013-05-04Mapreg saving overhaulshennetsind1-105/+186
Server only saves variables that were changed, not all of them. Special Thanks to Yommy <3~! Signed-off-by: shennetsind <ind@henn.et>
2012-12-05- Undid r16968: SVN Replaced with source:/trunk/src/@16966 (tid:74924).brianluau1-151/+160
[16969:16991/trunk/src/] will be re-committed in the next 24 hours. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16992 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-11-25Applied AStyle code formating as discussed on tid:74602.greenboxal21-160/+151
Removed /SAFESEH option from MSVC11 projects. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-03-13 - Added missing parameter to `db_iput` and `db_uiput` macros (follow-up to ↵gepard19841-10/+10
r15682). - Numeric global variables (mapreg) now utilize `DBMap`'s ability to store integer-type data (follow-up to r15682). - Minor code cleanup: replaced some `DBMap` function calls with macros. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15683 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-03-13Enhanced `DBMap` implementation to allow storing integer type data in ↵gepard19841-3/+3
addition to void pointers. - Added enum for data: `int`, `unsigned int` and `void*` - Replaced generic `void*` data with `DBData` struct to hold `int`, `unsigned int` or `void*` (member of `DBNode`) - Added `db_i2data`, `db_ui2data` and `db_ptr2data` functions to cast from `int`/`uint`/`void*` to `DBData` (used in `DBMap::put()`) - Added `db_data2i`, `db_data2ui` and `db_data2ptr` functions to get `int`/`uint`/`void*` from `DBData` - Enabled statistics for new functions in `db_stats` struct - `DBCreateData` functions (used in `DBMap::ensure()`) now return `DBData` instead of `void*` - `DBApply` functions (used in `DBMap::foreach()` and `DBMap::destroy()`) now take `DBData*` as a parameter instead of `void*` - `DBMatcher` functions (used in `DBMap::getall()`) now take `DBData` as a parameter instead of `void*` - `DBReleaser` functions now take `DBData` as parameter instead of `void*` - Default releasers release data if it is `void*` (`DB_DATA_PTR`) type - `DBIterator` functions: `first()`, `last()`, `next()` and `prev()` now return `DBData*` instead of `void*` - `DBIterator::remove()` now returns `int` (1 if node was found and removed, 0 otherwise) instead of `void*` and takes an extra `DBData*` parameter for the data of removed entry - `DBMap::get()` and `DBMap::ensure()` now return `DBData*` instead of `void*` - `DBMap::remove()` and `DBMap::put()` now return `int` (1 if node already existed, 0 otherwise) instead of `void*` and take an extra `DBData*` parameter for the data of removed entry - `DBMap::put()` now takes `DBData` as parameter instead of `void*` - `DBMap::getall()` now puts data into `DBData**` buffer instead of `void**` buffer - Updated macros: - (`i`/`ui`/`str`)`db_get` and (`i`/`ui`/`str`)`db_ensure` were wrapped with `db_data2ptr` to extract data from `DBData*` that is now returned by `DBMap::get()` - added (`i`/`ui`/`str`)`db_iget` and (`i`/`ui`/`str`)`db_uiget` that get `DBData` from `DBMap` and extract `int`/`unsigned int` from it (with `db_data2i`/`db_data2ui`) - `db_put`, `idb_put`, `uidb_put` and `strdb_put` data params were wrapped with `db_ptr2data` to match new signature of `DBMap::put()` (`DBData` instead of `void*`) - added (`i`/`ui`/`str`)`db_iput` and (`i`/`ui`/`str`)`db_uiput` that put `int`/`unsigned int` into `DBMap` (first wrapping it with `DBData`) - added `NULL` in place of extra parameter for removed data in `db_remove` macros - `dbi_first`, `dbi_last`, `dbi_next` and `dbi_prev` were wrapped with `db_data2ptr` to extract data from `DBData*` that is now returned by these `DBIterator` functions - Updated `DBMap` documentation, and fixed a dozen of typos in it. - Updated rest of rA code to reflect `DBMap` changes (mostly required signature changes of `DBCreateData` and `DBApply` functions). - Fixed a bug where `DBMap::put()` would return data of a deleted entry. - Removed some unnecessary pointer casts. - Increased `showmsg.c` static buffer size to fit entire DBMap stats report. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15682 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-03-09Code cleanup: replaced `DBIterator` function calls with macros where possible. gepard19841-4/+4
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15668 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-30Replaced custom type 'intptr' with standard 'intptr_t'.ultramage1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14873 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-22* Fixed sql mapreg loading code specifying output buffer size for ↵ai4rei1-2/+2
SqlStmt_BindColumn without zero-terminator, leading to truncations of variable names and/or their values when using the maximum length (bugreport:1939, since r11245). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14614 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-11-21Removed an extra { from previous commit.Paradox924X1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14159 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-11-21Cleaned up mapreg dirty-marking code to only mark the mapreg as dirty when ↵Paradox924X1-11/+4
it actually is. (bugreport:3735) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14158 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-08-17Fixed some messed up operator priority in the mapreg code (bugreport:2078).ultramage1-8/+8
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13088 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-08-15Split off mapreg code from script.cultramage1-0/+242
* new mapserver files, mapreg.h, mapreg_txt.c, mapreg_sql.c * removed MAPREGSQL from project files / makefiles * mapreg storage engine is now fully dependent on the server type * added config settings mapreg_txt and mapreg_db to inter config * added get_str() function to complement add_str() * fixed txt mapreg code allowing too long variable names git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13081 54d463be-8e91-2dee-dedb-b68131a5f0ec