aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-02-21 15:42:57 +0000
committerdrh <drh@noemail.net>2015-02-21 15:42:57 +0000
commitd4ef026ebb87b2d4504b73ce08cde8da2a849b9e (patch)
treea8be47cfdb1ca8fe1a6abc5918a3b72a27ee1b11 /src
parent2da47d38691b74a6cfa2ce2e5bdce3bb7d8fc186 (diff)
downloadsqlite-d4ef026ebb87b2d4504b73ce08cde8da2a849b9e.tar.gz
sqlite-d4ef026ebb87b2d4504b73ce08cde8da2a849b9e.zip
Update document on sqlite3_mprintf() and related functions. Discuss the
%w format and point out that obscure ANSI-C formats are not supported. No changes to code. FossilOrigin-Name: f8917ba4d917bc762b3b252466ab72a8a70dc0d8
Diffstat (limited to 'src')
-rw-r--r--src/sqlite.h.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 8a358dbb2..ee910393e 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -2232,6 +2232,10 @@ void sqlite3_free_table(char **result);
**
** These routines are work-alikes of the "printf()" family of functions
** from the standard C library.
+** These routines understand most of the common K&R formatting options,
+** plus some additional non-standard formats, detailed below.
+** Note that some of the more obscure formatting options from recent
+** C-library standards are omitted from this implementation.
**
** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
** results into memory obtained from [sqlite3_malloc()].
@@ -2264,7 +2268,7 @@ void sqlite3_free_table(char **result);
** These routines all implement some additional formatting
** options that are useful for constructing SQL statements.
** All of the usual printf() formatting options apply. In addition, there
-** is are "%q", "%Q", and "%z" options.
+** is are "%q", "%Q", "%w" and "%z" options.
**
** ^(The %q option works like %s in that it substitutes a nul-terminated
** string from the argument list. But %q also doubles every '\'' character.
@@ -2317,6 +2321,12 @@ void sqlite3_free_table(char **result);
** The code above will render a correct SQL statement in the zSQL
** variable even if the zText variable is a NULL pointer.
**
+** ^(The "%w" formatting option is like "%q" except that it expects to
+** be contained within double-quotes instead of single quotes, and it
+** escapes the double-quote character instead of the single-quote
+** character.)^ The "%w" formatting option is intended for safely inserting
+** table and column names into a constructed SQL statement.
+**
** ^(The "%z" formatting option works like "%s" but with the
** addition that after the string has been read and copied into
** the result, [sqlite3_free()] is called on the input string.)^