File: 005-mod_log_sql_pgsql.c.dpatch

package info (click to toggle)
libapache-mod-log-sql 1.100-14
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 932 kB
  • ctags: 365
  • sloc: sh: 2,861; ansic: 2,189; xml: 2,010; makefile: 371; perl: 250; sql: 47
file content (31 lines) | stat: -rw-r--r-- 1,115 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh /usr/share/dpatch/dpatch-run
## 005-mod_log_sql_pgsql.c.dpatch by Thomas Goirand <thomas@goirand.fr>
##
## DP: This patch adds a scoreboard feature to mod_log_sql, so you
## DP: can keep tracks of number of hits and bytes for each of the
## DP: hosted websites.

@DPATCH@
--- libapache-mod-log-sql/mod_log_sql_pgsql.c.orig	2007-08-06 00:55:44.000000000 +0800
+++ libapache-mod-log-sql/mod_log_sql_pgsql.c	2007-08-06 00:52:55.000000000 +0800
@@ -235,6 +235,10 @@
 	return LOGSQL_TABLE_SUCCESS;
 }
 
+static char *make_pgsql_ignore_insert(char * insert_query, request_rec *r) {
+	return apr_psprintf(r->pool, "begin ; insert into %s ; commit ;",insert_query);
+}
+
 static char *supported_drivers[] = {"pgsql",NULL};
 static logsql_dbdriver pgsql_driver = {
 	supported_drivers,
@@ -242,7 +246,8 @@
 	log_sql_pgsql_close,	/* close DB connection */
 	log_sql_pgsql_escape,	/* escape query */
 	log_sql_pgsql_query,	/* insert query */
-	log_sql_pgsql_create	/* create table */
+	log_sql_pgsql_create,	/* create table */
+	make_pgsql_ignore_insert /* insert ignore statement */
 };
 
 LOGSQL_REGISTER(pgsql) {