added first helpserv functions
[NeonServV5.git] / src / mysqlConn.c
index 75bb4269a92528d496d7b6e8b50740ce517eb571..d2430f0889d0ec772dd1d15f236a655e0b266e22 100644 (file)
@@ -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) {