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

Improved response to error conditions in the ".session" shell command and

in the "changeset" command-line program.

FossilOrigin-Name: b69f7dd1f35846c3bb9f4f160d50c4f03796f887
This commit is contained in:
drh
2014-08-19 00:26:17 +00:00
parent 9f674f2600
commit 2967e0cc9c
4 changed files with 22 additions and 14 deletions

View File

@ -232,8 +232,10 @@ int main(int argc, char **argv){
exit(1);
}
readFile(argv[3], &szB, &pB);
sqlite3changeset_concat(sz, pBuf, szB, pB, &szOut, &pOutBuf);
if( fwrite(pOutBuf, szOut, 1, out)!=1 ){
rc = sqlite3changeset_concat(sz, pBuf, szB, pB, &szOut, &pOutBuf);
if( rc!=SQLITE_OK ){
fprintf(stderr, "sqlite3changeset_concat() returns %d\n", rc);
}else if( szOut>0 && fwrite(pOutBuf, szOut, 1, out)!=1 ){
fprintf(stderr, "unable to write all %d bytes of output to \"%s\"\n",
szOut, zOut);
}
@ -300,8 +302,10 @@ int main(int argc, char **argv){
fprintf(stderr, "cannot open \"%s\" for writing\n", zOut);
exit(1);
}
sqlite3changeset_invert(sz, pBuf, &szOut, &pOutBuf);
if( fwrite(pOutBuf, szOut, 1, out)!=1 ){
rc = sqlite3changeset_invert(sz, pBuf, &szOut, &pOutBuf);
if( rc!=SQLITE_OK ){
fprintf(stderr, "sqlite3changeset_invert() returns %d\n", rc);
}else if( szOut>0 && fwrite(pOutBuf, szOut, 1, out)!=1 ){
fprintf(stderr, "unable to write all %d bytes of output to \"%s\"\n",
szOut, zOut);
}