From: drh Date: Sat, 21 Feb 2015 15:42:57 +0000 (+0000) Subject: Update document on sqlite3_mprintf() and related functions. Discuss the X-Git-Tag: version-3.8.9~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4ef026ebb87b2d4504b73ce08cde8da2a849b9e;p=thirdparty%2Fsqlite.git 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 --- diff --git a/manifest b/manifest index fbd8198361..8dd0ff3390 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scompiler\swarning\sassociated\swith\sUSE_PREAD64. -D 2015-02-21T00:56:05.294 +C Update\sdocument\son\ssqlite3_mprintf()\sand\srelated\sfunctions.\s\sDiscuss\sthe\n%w\sformat\sand\spoint\sout\sthat\sobscure\sANSI-C\sformats\sare\snot\ssupported.\nNo\schanges\sto\scode. +D 2015-02-21T15:42:57.800 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6b9e7677829aa94b9f30949656e27312aefb9a46 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -232,7 +232,7 @@ F src/resolve.c f4d79e31ffa5820c2e3d1740baa5e9b190425f2b F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c e46cef4c224549b439384c88fc7f57ba064dad54 F src/shell.c 6276582ee4e9114e0bb0795772414caaf21c0f8e -F src/sqlite.h.in b02d8d19c5adc73bd02b225054103247aff64425 +F src/sqlite.h.in 86cddbfdb3155967858c1469108813bcc08eda21 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d F src/sqliteInt.h 57a405ae6d2ed10fff52de376d18f21e04d96609 @@ -1239,7 +1239,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7560a9fa50236ecaa0617f1ab5bb5662f4a61c72 -R afd779aaccfbda112c52de91ea006a71 +P c299e55a661c04f71ab43cb8aed04f8ece6e0567 +R dda772aafb6dee5a528cc1c5d5a14dc2 U drh -Z 8991d0e22753a2d2a931885c01f739fa +Z 75f83919b9b483315b93f05f4ef8627c diff --git a/manifest.uuid b/manifest.uuid index 799d2f85ad..c46ad20405 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c299e55a661c04f71ab43cb8aed04f8ece6e0567 \ No newline at end of file +f8917ba4d917bc762b3b252466ab72a8a70dc0d8 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 8a358dbb2f..ee910393e6 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.)^