55 sqlEscapeString (
sqlEscape *b,
const char *str)
57 const char *p, *src_head;
61 ENTER(
"str = %s", str);
72 LEAVE(
"%s: already escaped", str);
78 slen = strcspn (str,
"\\\'");
81 LEAVE(
"nothing to escape");
90 p += 1 + strcspn (p,
"\\\'");
94 if (len >= b->esc_buflen)
96 b->escape = g_realloc(b->escape, len + 100);
97 b->esc_buflen = len + 100;
101 src_head = (
char *) str;
102 dst_tail = b->escape;
103 p = src_head + strcspn (src_head,
"\\\'");
106 size_t cp_len = p - src_head;
108 strncpy (dst_tail, src_head, cp_len);
116 p = src_head + strcspn (src_head,
"\\\'");
120 size_t cp_len = p - src_head;
122 strncpy (dst_tail, src_head, cp_len);
127 LEAVE(
"b->escape = %s", b->escape);
133 #define INITIAL_BUFSZ 2000
140 b->escape = g_malloc (INITIAL_BUFSZ);
141 b->esc_buflen = INITIAL_BUFSZ;
153 LEAVE(
"b is (null)");
#define ENTER(format, args...)
All type declarations for the whole Gnucash engine.
#define LEAVE(format, args...)
const gchar * QofLogModule