added full half-op support
[NeonServV5.git] / src / mysqlConn.c
index dcd99e5d39a48d9ba5516522c0d4e507bebbb105..b82d317cc4a5770ffd6a3c8af6812bd9e8ec6ecc 100644 (file)
@@ -1,5 +1,5 @@
 /* mysqlConn.c - NeonServ v5.3
- * Copyright (C) 2011  Philipp Kreil (pk910)
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  */
 
 #include "mysqlConn.h"
-#define DATABASE_VERSION "9"
+#define DATABASE_VERSION "14"
 
 struct used_result {
     MYSQL_RES *result;
@@ -203,6 +203,25 @@ void printf_mysql_query(const char *text, ...) {
     }
 }
 
+void printf_long_mysql_query(int len, const char *text, ...) {
+    va_list arg_list;
+    char queryBuf[len];
+    int pos;
+    queryBuf[0] = '\0';
+    va_start(arg_list, text);
+    pos = vsnprintf(queryBuf, len - 2, text, arg_list);
+    va_end(arg_list);
+    if (pos < 0 || pos > (len - 2)) pos = len - 2;
+    queryBuf[pos] = '\0';
+    printf("MySQL: %s\n", queryBuf);
+    if(mysql_query(mysql_conn, queryBuf)) {
+        check_mysql();
+        if(mysql_query(mysql_conn, queryBuf)) {
+            show_mysql_error();
+        }
+    }
+}
+
 char* escape_string(const char *str) {
     struct escaped_string *escapedstr = malloc(sizeof(*escapedstr));
     if (!escapedstr) {