path: root/posts/dbi-crap-api.mdwn
diff options
Diffstat (limited to 'posts/dbi-crap-api.mdwn')
1 files changed, 30 insertions, 0 deletions
diff --git a/posts/dbi-crap-api.mdwn b/posts/dbi-crap-api.mdwn
new file mode 100644
index 0000000..adf0ebd
--- /dev/null
+++ b/posts/dbi-crap-api.mdwn
@@ -0,0 +1,30 @@
+[[!meta title="APIs don't matter, do they?"]]
+[[!meta author="Daniel Silverstone"]]
+[[!meta date="2005-07-07 17:20:45 +0100"]]
+[[!tag tech]]
+I’d like to introduce you to a bit of API which belongs to
+[libdbi]( which belongs in the “Mommy,
+who cut my crack with washing powder?” box…
+<tt style="white-space: nowrap;">int
+dbi\_driver\_quote\_string(dbi\_driver Driver, char
+\*\*orig)<br><br>&\#160;&\#160;Encloses the target string in the types
+of quotes that the database expects,<br>&\#160;&\#160;and escapes any
+special characters. The original string will be freed and
+will<br>&\#160;&\#160;point to a newly allocated one (which you still
+must free on your own).<br><br>Arguments<br>&\#160;&\#160;Driver: The
+target driver.<br>&\#160;&\#160;orig: A pointer to the string to quote
+and escape.<br><br>Returns<br>&\#160;&\#160;The new string’s
+Now what on earth posesses someone to think that such an API is better
+than, for example:
+returning, ooh `NULL` if it had a problem?
+Now I have to get a string out of [Lua](, `strdup()`
+it, only to have it `free()`d when the quote function gets a hold of it.
+But hey, malloc churn is fast, right?
+— <em>Bletch</em>