1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Promote the --protocol option to sqlite3_rsync from being an undocumented

debug option to being a supported and user-visible option.  This is 
sometimes needed to work around bugs in prior versions running on the
remote.

FossilOrigin-Name: 4855e04e44e8fce2d6e37dd468eb6e9f4565c36cbc964156e65ac0449d7c212f
This commit is contained in:
drh
2025-05-03 10:35:32 +00:00
parent f4d435dc0d
commit d7b83224bb
3 changed files with 23 additions and 25 deletions

View File

@ -30,12 +30,13 @@ static const char zUsage[] =
"\n"
"OPTIONS:\n"
"\n"
" --exe PATH Name of the sqlite3_rsync program on the remote side\n"
" --help Show this help screen\n"
" --ssh PATH Name of the SSH program used to reach the remote side\n"
" -v Verbose. Multiple v's for increasing output\n"
" --version Show detailed version information\n"
" --wal-only Do not sync unless both databases are in WAL mode\n"
" --exe PATH Name of the sqlite3_rsync program on the remote side\n"
" --help Show this help screen\n"
" --protocol N Use sync protocol version N.\n"
" --ssh PATH Name of the SSH program used to reach the remote side\n"
" -v Verbose. Multiple v's for increasing output\n"
" --version Show detailed version information\n"
" --wal-only Do not sync unless both databases are in WAL mode\n"
;
typedef unsigned char u8;
@ -2029,6 +2030,15 @@ int main(int argc, char const * const *argv){
ctx.eVerbose += numVs(z);
continue;
}
if( strcmp(z, "-protocol")==0 ){
ctx.iProtocol = atoi(cli_opt_val);
if( ctx.iProtocol<1 ){
ctx.iProtocol = 1;
}else if( ctx.iProtocol>PROTOCOL_VERSION ){
ctx.iProtocol = PROTOCOL_VERSION;
}
continue;
}
if( strcmp(z, "-ssh")==0 ){
zSsh = cli_opt_val;
continue;
@ -2089,17 +2099,6 @@ int main(int argc, char const * const *argv){
zRemoteDebugFile = cli_opt_val;
continue;
}
if( strcmp(z, "-protocol")==0 ){
/* DEBUG OPTION: --protocool N
** Set the protocol version to N */
ctx.iProtocol = atoi(cli_opt_val);
if( ctx.iProtocol<1 ){
ctx.iProtocol = 1;
}else if( ctx.iProtocol>PROTOCOL_VERSION ){
ctx.iProtocol = PROTOCOL_VERSION;
}
continue;
}
if( strcmp(z,"-commcheck")==0 ){ /* DEBUG ONLY */
/* Run a communication check with the remote side. Do not attempt
** to exchange any database connection */