--- flow-tools-0.67/src/flow-export.c.orig Thu Dec 4 13:55:31 2003 +++ flow-tools-0.67/src/flow-export.c Fri Sep 24 08:44:44 2004 @@ -57,6 +57,7 @@ #define DB_DEFAULT_DBTABLE "raw" #define DB_DEFAULT_DBUSER "netflow" #define DB_DEFAULT_DBPWD "netflow" +#define DB_QUOTE putchar(34) #endif /* MYSQL */ @@ -70,9 +71,19 @@ #define DB_DEFAULT_DBTABLE "raw" #define DB_DEFAULT_DBUSER "netflow" #define DB_DEFAULT_DBPWD "netflow" +#define DB_QUOTE putchar(39) #endif /* PGSQL*/ +/* if both PGSQL and MYSQL are not defined */ +#ifndef HAVE_PGSQL +#ifndef HAVE_MYSQL + +#define DB_QUOTE putchar(34) + +#endif /* NO MYSQL */ +#endif /* NO PGSQL */ + #if HAVE_LL_STRTOUL #define strtoull strtoul #endif /* HAVE_LL_STRTOULL */ @@ -1199,10 +1211,10 @@ if (xfields & FT_XFIELD_EXADDR) { if (comma) fmt_buf[len++] = ','; - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->exaddr)), FMT_JUST_LEFT); - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; comma = 1; } @@ -1257,28 +1269,28 @@ if (xfields & FT_XFIELD_SRCADDR) { if (comma) fmt_buf[len++] = ','; - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->srcaddr)), FMT_JUST_LEFT); - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; comma = 1; } if (xfields & FT_XFIELD_DSTADDR) { if (comma) fmt_buf[len++] = ','; - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->dstaddr)), FMT_JUST_LEFT); - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; comma = 1; } if (xfields & FT_XFIELD_NEXTHOP) { if (comma) fmt_buf[len++] = ','; - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->nexthop)), FMT_JUST_LEFT); - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; comma = 1; } @@ -1375,19 +1387,19 @@ if (xfields & FT_XFIELD_PEER_NEXTHOP) { if (comma) fmt_buf[len++] = ','; - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->peer_nexthop)), FMT_JUST_LEFT); - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; comma = 1; } if (xfields & FT_XFIELD_ROUTER_SC) { if (comma) fmt_buf[len++] = ','; - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->router_sc)), FMT_JUST_LEFT); - if (quote) fmt_buf[len++] = '"'; + if (quote) fmt_buf[len++] = DB_QUOTE; comma = 1; }