1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-05 04:30:38 +03:00

For the ".import" command of the command-line shell, start a transaction

if there is not one active already.

FossilOrigin-Name: 5dcc2d91bd343cd0fac79d3c8f079a5ce534cdf7
This commit is contained in:
drh
2013-08-06 14:36:36 +00:00
parent 9f099fd45a
commit 2d463113f0
3 changed files with 11 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
C Clean\sup\sthe\sinput\sreader\sin\sthe\scommand-line\sshell\sfor\simproved\slegibility\nand\sperformance.
D 2013-08-06T14:01:46.052
C For\sthe\s".import"\scommand\sof\sthe\scommand-line\sshell,\sstart\sa\stransaction\nif\sthere\sis\snot\sone\sactive\salready.
D 2013-08-06T14:36:36.363
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -217,7 +217,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 17e670996729ac41aadf6a31f57b4e6f29b3d819
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c 8b148eb851f384412aea57091659d14b369918ca
F src/shell.c 18be30ad43044f1d84441667c8b50df0b4996db9
F src/shell.c 927e17b37b63b24461e372d982138fb22c4df321
F src/sqlite.h.in 442c109e0c3447c34b1794971ecdb673ce08a843
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
@@ -1105,7 +1105,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 924f7e4d7a8fa2fe9100836663f3733b6e1a9084
R a0a003b94645637a781f18f2495d5c36
P 2b1743d60171635c1e5a6ede6b4928f4671f948d
R 52d68f7d6fd0cf4ecec25cf61e17c3e0
U drh
Z 390282ae711b439a5d58cc71aa5c9578
Z 274a34c6d0a826d2bb04d7b9aabecdb7

View File

@@ -1 +1 @@
2b1743d60171635c1e5a6ede6b4928f4671f948d
5dcc2d91bd343cd0fac79d3c8f079a5ce534cdf7

View File

@@ -1990,6 +1990,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
int nCol; /* Number of columns in the table */
int nByte; /* Number of bytes in an SQL string */
int i, j; /* Loop counters */
int needCommit; /* True to COMMIT or ROLLBACK at end */
int nSep; /* Number of bytes in p->separator[] */
char *zSql; /* An SQL statement */
CSVReader sCsv; /* Reader context */
@@ -2091,6 +2092,8 @@ static int do_meta_command(char *zLine, struct callback_data *p){
xCloser(sCsv.in);
return 1;
}
needCommit = sqlite3_get_autocommit(db);
if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0);
do{
int startLine = sCsv.nLine;
for(i=0; i<nCol; i++){
@@ -2127,7 +2130,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
xCloser(sCsv.in);
sqlite3_free(sCsv.z);
sqlite3_finalize(pStmt);
sqlite3_exec(p->db, "COMMIT", 0, 0, 0);
if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
}else
if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){