From 21f06723fb23903b635eb6c6e9fcb13060f84422 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 19 Jul 2007 12:41:39 +0000 Subject: [PATCH] Clarify the documentation on the nByte parameter to sqlite3_prepare(). Make it clear that nByte is a maximum string length. Ticket #2516. (CVS 4162) FossilOrigin-Name: d1ae3de4613d36b5352eb852f1951a09d4a92ac1 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 20 ++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 1df201fdf6..020a9e9e49 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Get\sthe\smin/max\soptimization\sworking\swith\sdescending\sindices.\s\sTicket\s#2514.\s(CVS\s4161) -D 2007-07-18T18:17:12 +C Clarify\sthe\sdocumentation\son\sthe\snByte\sparameter\sto\ssqlite3_prepare().\nMake\sit\sclear\sthat\snByte\sis\sa\smaximum\sstring\slength.\s\sTicket\s#2516.\s(CVS\s4162) +D 2007-07-19T12:41:40 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -107,7 +107,7 @@ F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88 F src/select.c 3b167744fc375bddfddcef87feb18f5171737677 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c e7534cce78398bc1cac4a643e931fc6221c2897e -F src/sqlite.h.in bbcc5481af9f40ce5762c323cf555581a025f3de +F src/sqlite.h.in 8164526b1658a6dad472953ea91239849f913d45 F src/sqlite3ext.h 95575e0d175a0271fe2c3232c0d11e8720ed6887 F src/sqliteInt.h 81183ae71162818bf60478e738ff68604128bb06 F src/sqliteLimit.h f14609c27636ebc217c9603ade26dbdd7d0f6afa @@ -518,7 +518,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 7ef2aaf72a8a953df7a763dd94657bb4ff05294f -R ff608d553175a9b0892b61edd3a60768 +P a80a3c9d0a5e0a8a3d67bd841e2076893fd5e9aa +R d4afa784234874caf7b671e3a6ed87c3 U drh -Z 2ad3f38523c32921466d9249c05ca115 +Z c86e52f36ab4239de550f9e1ef291098 diff --git a/manifest.uuid b/manifest.uuid index 8652c03424..150502dd87 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a80a3c9d0a5e0a8a3d67bd841e2076893fd5e9aa \ No newline at end of file +d1ae3de4613d36b5352eb852f1951a09d4a92ac1 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 7bc4feb61b..f504d220f2 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.217 2007/06/27 15:53:35 danielk1977 Exp $ +** @(#) $Id: sqlite.h.in,v 1.218 2007/07/19 12:41:40 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -963,10 +963,14 @@ typedef struct sqlite3_stmt sqlite3_stmt; ** The second argument "zSql" is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces uses UTF-8 and sqlite3_prepare16() and sqlite3_prepare16_v2() -** use UTF-16. If the next argument, "nBytes", is less +** use UTF-16. +** +** If the nByte argument is less ** than zero, then zSql is read up to the first zero terminator. If -** "nBytes" is not less than zero, then it is the length of the string zSql -** in bytes (not characters). +** nByte is non-negative, then it is the maximum number of +** bytes read from zSql. When nByte is non-negative, the +** zSql string ends at either the first '\000' character or +** until the nByte-th byte, whichever comes first. ** ** *pzTail is made to point to the first byte past the end of the first ** SQL statement in zSql. This routine only compiles the first statement @@ -1019,28 +1023,28 @@ typedef struct sqlite3_stmt sqlite3_stmt; int sqlite3_prepare( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ - int nBytes, /* Length of zSql in bytes. */ + int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); int sqlite3_prepare_v2( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ - int nBytes, /* Length of zSql in bytes. */ + int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); int sqlite3_prepare16( sqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ - int nBytes, /* Length of zSql in bytes. */ + int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); int sqlite3_prepare16_v2( sqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ - int nBytes, /* Length of zSql in bytes. */ + int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ );