projects
/
libusual.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
38a611b
)
pgutil: support NULL for quote_literal
author
Marko Kreen
<markokr@gmail.com>
Thu, 2 Sep 2010 11:28:02 +0000
(14:28 +0300)
committer
Marko Kreen
<markokr@gmail.com>
Thu, 2 Sep 2010 11:28:02 +0000
(14:28 +0300)
usual/pgutil.c
patch
|
blob
|
blame
|
history
diff --git
a/usual/pgutil.c
b/usual/pgutil.c
index 8028525dbe1d9e202d8dc96a8212d70d248af019..64ad07f35846ec9a3244c6ce6f971b0d828f349b 100644
(file)
--- a/
usual/pgutil.c
+++ b/
usual/pgutil.c
@@
-37,6
+37,13
@@
bool pg_quote_literal(char *_dst, const char *_src, int dstlen)
if (dstlen < 3)
return false;
+ if (_src == NULL) {
+ if (dstlen < 5)
+ return false;
+ memcpy(_dst, "NULL", 5);
+ return true;
+ }
+
retry:
*dst++ = '\'';
while (*src && dst < end) {