+#define CHANNELCOUNTER_BUFSIZE 512
+#define CHANNELCOUNTER_MAX 512
+
+static int channelcounter_count = 0;
+static char channelcounter_bufs[CHANNELCOUNTER_MAX][CHANNELCOUNTER_BUFSIZE];
+
+void csdb_flushchannelcounters(void *arg) {
+ int i;
+
+ if(!channelcounter_count)
+ return;
+
+ dbquery("BEGIN TRANSACTION;");
+
+ for(i=0;i<channelcounter_count;i++)
+ dbquery("%s", channelcounter_bufs[i]);
+
+ dbquery("COMMIT;");
+
+ channelcounter_count = 0;
+}
+