mirror of https://github.com/sqlite/sqlite
Be consistent about using "CRLF" instead of "CRNL".
FossilOrigin-Name: ec4f4cfd5f8ca83fad4f08cf6566251d9c63e50a3a4284baca299bd94b047951
This commit is contained in:
parent
72fea11809
commit
863fcdc116
|
@ -38,7 +38,7 @@
|
|||
**
|
||||
** If the SQLITE_U8TEXT_STDIO option is defined, then use O_U8TEXT
|
||||
** when appropriate when writing to stdout or stderr. Use O_BINARY
|
||||
** or O_TEXT (depending on things like the .mode and the .crnl setting
|
||||
** or O_TEXT (depending on things like the .mode and the .crlf setting
|
||||
** in the CLI, or other context clues in other applications) for all
|
||||
** other output channels.
|
||||
**
|
||||
|
|
|
@ -744,7 +744,7 @@ static const char *recoverUnusedString(
|
|||
}
|
||||
|
||||
/*
|
||||
** Implementation of scalar SQL function "escape_crnl". The argument passed to
|
||||
** Implementation of scalar SQL function "escape_crlf". The argument passed to
|
||||
** this function is the output of built-in function quote(). If the first
|
||||
** character of the input is "'", indicating that the value passed to quote()
|
||||
** was a text value, then this function searches the input for "\n" and "\r"
|
||||
|
@ -755,7 +755,7 @@ static const char *recoverUnusedString(
|
|||
** Or, if the first character of the input is not "'", then a copy of the input
|
||||
** is returned.
|
||||
*/
|
||||
static void recoverEscapeCrnl(
|
||||
static void recoverEscapeCrlf(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
|
@ -970,7 +970,7 @@ static int recoverOpenOutput(sqlite3_recover *p){
|
|||
{ "getpage", 1, recoverGetPage },
|
||||
{ "page_is_used", 1, recoverPageIsUsed },
|
||||
{ "read_i32", 2, recoverReadI32 },
|
||||
{ "escape_crnl", 1, recoverEscapeCrnl },
|
||||
{ "escape_crlf", 1, recoverEscapeCrlf },
|
||||
};
|
||||
|
||||
const int flags = SQLITE_OPEN_URI|SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE;
|
||||
|
@ -1323,7 +1323,7 @@ static sqlite3_stmt *recoverInsertStmt(
|
|||
|
||||
if( bSql ){
|
||||
zBind = recoverMPrintf(p,
|
||||
"%z%sescape_crnl(quote(?%d))", zBind, zSqlSep, pTab->aCol[ii].iBind
|
||||
"%z%sescape_crlf(quote(?%d))", zBind, zSqlSep, pTab->aCol[ii].iBind
|
||||
);
|
||||
zSqlSep = "||', '||";
|
||||
}else{
|
||||
|
|
16
manifest
16
manifest
|
@ -1,5 +1,5 @@
|
|||
C Fix\sa\sharmless\scompiler\swarning\sin\sthe\sCLI.
|
||||
D 2024-10-14T09:08:02.231
|
||||
C Be\sconsistent\sabout\susing\s"CRLF"\sinstead\sof\s"CRNL".
|
||||
D 2024-10-14T09:19:02.237
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
|
@ -428,7 +428,7 @@ F ext/misc/shathree.c 1821d90a0040c9accdbe3e3527d378d30569475d758aa70f6848924c0b
|
|||
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
|
||||
F ext/misc/spellfix.c bcc42ef3fd29429bc01a83e751332b8d4690e65d45008449bdffe7656371487f
|
||||
F ext/misc/sqlar.c a6175790482328171da47095f87608b48a476d4fac78d8a9ff18b03a2454f634
|
||||
F ext/misc/sqlite3_stdio.c 6857992f5e39992c9d44ad36230e28cbb0d630d6b0967c59e79ba13f2027ae49
|
||||
F ext/misc/sqlite3_stdio.c 73192f75e1e89722fbdf209056a562ca2a35df3c9e998f9270331e03cb621e7a
|
||||
F ext/misc/sqlite3_stdio.h f05eaf5e0258f0573910324a789a9586fc360a57678c57a6d63cfaa2245b6176
|
||||
F ext/misc/stmt.c b090086cd6bd6281c21271d38d576eeffe662f0e6b67536352ce32bbaa438321
|
||||
F ext/misc/stmtrand.c 59cffa5d8e158943ff1ce078956d8e208e8c04e67307e8f249dece2436dcb7fc
|
||||
|
@ -509,7 +509,7 @@ F ext/recover/recoverpgsz.test 88766fcb810e52ee05335c456d4e5fb06d02b73d3ccb48c52
|
|||
F ext/recover/recoverrowid.test f948bf4024a5f41b0e21b8af80c60564c5b5d78c05a8d64fc00787715ff9f45f
|
||||
F ext/recover/recoverslowidx.test 5205a9742dd9490ee99950dabb622307355ef1662dea6a3a21030057bfd81411
|
||||
F ext/recover/recoversql.test e66d01f95302a223bcd3fd42b5ee58dc2b53d70afa90b0d00e41e4b8eab20486
|
||||
F ext/recover/sqlite3recover.c 2dcf6b56c5e0e2b43fc4c6115b689ab194c374ced7f7f8380ad9a24d8ef24ac9
|
||||
F ext/recover/sqlite3recover.c e822ecbb05a04a5c85d1309765fcd6cf392d100d02d2227cd7720c9d6921a17a
|
||||
F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0e24ff9c74820959
|
||||
F ext/recover/test_recover.c 072260d7452a3b81aba995b2b3269e7ec2aa7f06725544ba4c25b1b0a1dbc61a
|
||||
F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15
|
||||
|
@ -771,7 +771,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
|||
F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68
|
||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||
F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe
|
||||
F src/shell.c.in e1e38be42a5a8a2d1732d684f6c5f13ca0be28d66ab16ed7553c53a287602796
|
||||
F src/shell.c.in a4174d9d73223ccc9b6bfa98a2feccf6af9f6386a1bdcbf7a4c527909a130bba
|
||||
F src/sqlite.h.in 1def838497ad53c81486649ce79821925d1ac20a9843af317a344d507efe116e
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
||||
|
@ -2217,8 +2217,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
|
|||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 43787b8ec5348207ae84e6f16acf2605c1ca024fc02b022ce2f36b8495e88384
|
||||
R dc6bf56e3dd7752d134a3df81d5dd0b4
|
||||
P 31c46e84fffe29c45fc63ae8cd1f96f42196f0ab56e72cd07b4eedbd9058e85b
|
||||
R 0ddfce1b00f5e783e91c489309275ead
|
||||
U drh
|
||||
Z 8d8c0b91bf578f1da5d0fabaf0b54fde
|
||||
Z 0bab3d34918042e28b7a5784677fe83e
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
|
|
@ -1 +1 @@
|
|||
31c46e84fffe29c45fc63ae8cd1f96f42196f0ab56e72cd07b4eedbd9058e85b
|
||||
ec4f4cfd5f8ca83fad4f08cf6566251d9c63e50a3a4284baca299bd94b047951
|
||||
|
|
|
@ -1448,7 +1448,7 @@ struct ShellState {
|
|||
u8 bSafeMode; /* True to prohibit unsafe operations */
|
||||
u8 bSafeModePersist; /* The long-term value of bSafeMode */
|
||||
u8 eRestoreState; /* See comments above doAutoDetectRestore() */
|
||||
u8 crnlMode; /* Do NL-to-CRLF translations when enabled (maybe) */
|
||||
u8 crlfMode; /* Do NL-to-CRLF translations when enabled (maybe) */
|
||||
ColModeOpts cmOpts; /* Option values affecting columnar mode output */
|
||||
unsigned statsOn; /* True to display memory stats before each finalize */
|
||||
unsigned mEqpLines; /* Mask of vertical lines in the EQP output graph */
|
||||
|
@ -1629,7 +1629,7 @@ static const char *modeDescr[] = {
|
|||
#define SEP_Tab "\t"
|
||||
#define SEP_Space " "
|
||||
#define SEP_Comma ","
|
||||
#define SEP_CrLf "\n" /* Use ".crnl on" to get \r\n line endings */
|
||||
#define SEP_CrLf "\n" /* Use ".crlf on" to get \r\n line endings */
|
||||
#define SEP_Unit "\x1F"
|
||||
#define SEP_Record "\x1E"
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ static void editFunc(
|
|||
char *zCmd = 0;
|
||||
int bBin;
|
||||
int rc;
|
||||
int hasCRNL = 0;
|
||||
int hasCRLF = 0;
|
||||
FILE *f = 0;
|
||||
sqlite3_int64 sz;
|
||||
sqlite3_int64 x;
|
||||
|
@ -1759,7 +1759,7 @@ static void editFunc(
|
|||
}else{
|
||||
const char *z = (const char*)sqlite3_value_text(argv[0]);
|
||||
/* Remember whether or not the value originally contained \r\n */
|
||||
if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1;
|
||||
if( z && strstr(z,"\r\n")!=0 ) hasCRLF = 1;
|
||||
x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f);
|
||||
}
|
||||
fclose(f);
|
||||
|
@ -1804,7 +1804,7 @@ static void editFunc(
|
|||
sqlite3_result_blob64(context, p, sz, sqlite3_free);
|
||||
}else{
|
||||
sqlite3_int64 i, j;
|
||||
if( hasCRNL ){
|
||||
if( hasCRLF ){
|
||||
/* If the original contains \r\n then do no conversions back to \n */
|
||||
}else{
|
||||
/* If the file did not originally contain \r\n then convert any new
|
||||
|
@ -1849,9 +1849,9 @@ static void outputModePop(ShellState *p){
|
|||
/*
|
||||
** Set output mode to text or binary for Windows.
|
||||
*/
|
||||
static void setCrnlMode(ShellState *p){
|
||||
static void setCrlfMode(ShellState *p){
|
||||
#ifdef _WIN32
|
||||
if( p->crnlMode ){
|
||||
if( p->crlfMode ){
|
||||
sqlite3_fsetmode(p->out, _O_TEXT);
|
||||
}else{
|
||||
sqlite3_fsetmode(p->out, _O_BINARY);
|
||||
|
@ -1940,7 +1940,7 @@ static void output_quoted_string(ShellState *p, const char *z){
|
|||
}
|
||||
sqlite3_fputs("'", out);
|
||||
}
|
||||
setCrnlMode(p);
|
||||
setCrlfMode(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2008,7 +2008,7 @@ static void output_quoted_escaped_string(ShellState *p, const char *z){
|
|||
sqlite3_fprintf(out, ",'%s',char(10))", zNL);
|
||||
}
|
||||
}
|
||||
setCrnlMode(p);
|
||||
setCrlfMode(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2797,7 +2797,7 @@ static int shell_callback(
|
|||
for(i=0; i<nArg; i++){
|
||||
output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
|
||||
}
|
||||
if( p->crnlMode && cli_strcmp(p->rowSeparator,SEP_CrLf)==0 ){
|
||||
if( p->crlfMode && cli_strcmp(p->rowSeparator,SEP_CrLf)==0 ){
|
||||
sqlite3_fputs("\r\n", p->out);
|
||||
}else{
|
||||
sqlite3_fputs(p->rowSeparator, p->out);
|
||||
|
@ -2807,13 +2807,13 @@ static int shell_callback(
|
|||
for(i=0; i<nArg; i++){
|
||||
output_csv(p, azArg[i], i<nArg-1);
|
||||
}
|
||||
if( p->crnlMode && cli_strcmp(p->rowSeparator,SEP_CrLf)==0 ){
|
||||
if( p->crlfMode && cli_strcmp(p->rowSeparator,SEP_CrLf)==0 ){
|
||||
sqlite3_fputs("\r\n", p->out);
|
||||
}else{
|
||||
sqlite3_fputs(p->rowSeparator, p->out);
|
||||
}
|
||||
}
|
||||
setCrnlMode(p);
|
||||
setCrlfMode(p);
|
||||
break;
|
||||
}
|
||||
case MODE_Insert: {
|
||||
|
@ -4956,7 +4956,7 @@ static const char *(azHelp[]) = {
|
|||
".clone NEWDB Clone data into NEWDB from the existing database",
|
||||
#endif
|
||||
".connection [close] [#] Open or close an auxiliary database connection",
|
||||
".crnl on|off Translate \\n to \\r\\n sometimes. Default OFF",
|
||||
".crlf on|off Translate \\n to \\r\\n sometimes. Default OFF",
|
||||
".databases List names and files of attached databases",
|
||||
".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
|
||||
#if SQLITE_SHELL_HAVE_RECOVER
|
||||
|
@ -6437,7 +6437,7 @@ static void output_redir(ShellState *p, FILE *pfNew){
|
|||
sqlite3_fputs("Output already redirected.\n", stderr);
|
||||
}else{
|
||||
p->out = pfNew;
|
||||
setCrnlMode(p);
|
||||
setCrlfMode(p);
|
||||
if( p->mode==MODE_Www ){
|
||||
sqlite3_fputs(
|
||||
"<!DOCTYPE html>\n"
|
||||
|
@ -6493,7 +6493,7 @@ static void output_reset(ShellState *p){
|
|||
}
|
||||
p->outfile[0] = 0;
|
||||
p->out = stdout;
|
||||
setCrnlMode(p);
|
||||
setCrlfMode(p);
|
||||
}
|
||||
#else
|
||||
# define output_redir(SS,pfO)
|
||||
|
@ -8446,7 +8446,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
}
|
||||
}else
|
||||
|
||||
/* Undocumented. Legacy only. See "crnl" below */
|
||||
/* Undocumented. Legacy only. See "crlf" below */
|
||||
if( c=='b' && n>=3 && cli_strncmp(azArg[0], "binary", n)==0 ){
|
||||
eputz("The \".binary\" command is deprecated.\n");
|
||||
rc = 1;
|
||||
|
@ -8574,13 +8574,16 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
}
|
||||
}else
|
||||
|
||||
if( c=='c' && n==4 && cli_strncmp(azArg[0], "crnl", n)==0 ){
|
||||
if( c=='c' && n==4
|
||||
&& (cli_strncmp(azArg[0], "crlf", n)==0
|
||||
|| cli_strncmp(azArg[0], "crnl",n)==0)
|
||||
){
|
||||
if( nArg==2 ){
|
||||
p->crnlMode = booleanValue(azArg[1]);
|
||||
setCrnlMode(p);
|
||||
p->crlfMode = booleanValue(azArg[1]);
|
||||
setCrlfMode(p);
|
||||
}else{
|
||||
sqlite3_fprintf(stderr, "crnl is currently %s\n",
|
||||
p->crnlMode ? "ON" : "OFF");
|
||||
sqlite3_fprintf(stderr, "crlf is currently %s\n",
|
||||
p->crlfMode ? "ON" : "OFF");
|
||||
}
|
||||
}else
|
||||
|
||||
|
@ -12616,14 +12619,14 @@ static void main_init(ShellState *data) {
|
|||
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
|
||||
|
||||
/* By default, come up in O_BINARY mode. That way, the default output is
|
||||
** the same for Windows and non-Windows systems. Use the ".crnl on"
|
||||
** the same for Windows and non-Windows systems. Use the ".crlf on"
|
||||
** command to change into O_TEXT mode to do automatic NL-to-CRLF
|
||||
** conversions on output for Windows.
|
||||
**
|
||||
** End-of-line marks on CVS output is CRLF when in .crnl is on and
|
||||
** NL when .crnl is off.
|
||||
** End-of-line marks on CVS output is CRLF when in .crlf is on and
|
||||
** NL when .crlf is off.
|
||||
*/
|
||||
data->crnlMode = 0;
|
||||
data->crlfMode = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue