summaryrefslogtreecommitdiff
path: root/src/common/console.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-07-08 15:34:41 -0300
committershennetsind <ind@henn.et>2013-07-08 15:34:41 -0300
commit8f7418ffaffb763e435b29eee5707c66d5615e73 (patch)
treeea4b44356fd036f4cce16738547684a70fc2dd6f /src/common/console.c
parent4f69a9ea0f80e78da61482b2d1143a6e58859fd1 (diff)
downloadhercules-8f7418ffaffb763e435b29eee5707c66d5615e73.tar.gz
hercules-8f7418ffaffb763e435b29eee5707c66d5615e73.tar.bz2
hercules-8f7418ffaffb763e435b29eee5707c66d5615e73.tar.xz
hercules-8f7418ffaffb763e435b29eee5707c66d5615e73.zip
Cygwin Fix for the Hercules SQL Update Check
Also modified the output (i think its sightly improved), also added a console command to skip updates so no need to go add the query yourself 'sql update skip <file name>' Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/console.c')
-rw-r--r--src/common/console.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/console.c b/src/common/console.c
index a9ea0386f..66f8d914a 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -17,6 +17,7 @@
#include "../common/mutex.h"
#include "../common/timer.h"
#include "../common/strlib.h"
+ #include "../common/sql.h"
#endif
#include <stdio.h>
@@ -106,6 +107,13 @@ CPCMD(malloc_usage) {
unsigned int val = (unsigned int)iMalloc->usage();
ShowInfo("malloc_usage: %.2f MB\n",(double)(val)/1024);
}
+CPCMD(skip) {
+ if( !line ) {
+ ShowDebug("usage example: sql update skip 2013-02-14--16-15.sql\n");
+ return;
+ }
+ Sql_HerculesUpdateSkip(console->SQL, line);
+}
#define CP_DEF_C(x) { #x , NULL , NULL, NULL }
#define CP_DEF_C2(x,y) { #x , NULL , #y, NULL }
#define CP_DEF_S(x,y) { #x , console_parse_ ## x , #y, NULL }
@@ -123,6 +131,9 @@ void console_load_defaults(void) {
CP_DEF_S(mem_report,server),
CP_DEF_S(malloc_usage,server),
CP_DEF_S(exit,server),
+ CP_DEF_C(sql),
+ CP_DEF_C2(update,sql),
+ CP_DEF_S(skip,update),
};
unsigned int i, len = ARRAYLENGTH(default_list);
struct CParseEntry *cmd;
@@ -375,6 +386,9 @@ void console_parse_init(void) {
iTimer->add_timer_interval(iTimer->gettick() + 1000, console->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */
}
+void console_setSQL(Sql *SQL) {
+ console->SQL = SQL;
+}
#endif /* CONSOLE_INPUT */
void console_init (void) {
@@ -413,5 +427,7 @@ void console_defaults(void) {
console->load_defaults = console_load_defaults;
console->parse_list_subs = console_parse_list_subs;
console->addCommand = console_parse_create;
+ console->setSQL = console_setSQL;
+ console->SQL = NULL;
#endif
}