.exit in script is not working

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

.exit in script is not working

Stéphane AULERY-2
Hello,

 

When I use the -init option the .exit statement at the end of my script is never executed.

 

I launch sqlite from a batch file on Windows Server 2012 and Windows 7 64 bit.

 

 

Command line :

 

sqlite3.exe -init myscript.scr

 

 

myscript.scr :

 

.log sqlite.log

.bail off

.nullvalue ""

 

CREATE TABLE STOCKSMAG (

Article TEXT,

CodeDepot TEXT,

QteStock INTEGER,

ECclient INTEGER,

Dispo INTEGER,

ECfour INTEGER,

Proj INTEGER,

DateGen DATETIME,

SeuilReappro INTEGER

);

 

.import STOCKSMAG.txt STOCKSMAG

 

 

 

.output STOCKSCUMUL.txt

 

SELECT

     Article,

     SUM (QteStock) AS QteStock,

     SUM (ECclient) AS ECclient,

     SUM (Dispo) AS Dispo,

     SUM (ECfour) AS ECfour,

     SUM (Proj) AS Proj

FROM STOCKSMAG

GROUP BY Article

ORDER BY Article;

 

.exit

 

 

STOCKSMAG.txt :

 

Article|CodeDepot|QteStock|ECclient|Dispo|ECfour|Proj|DateGen|SeuilReappro

000001|117|0|0|0|0|0|30/08/2018|

000001|118|0|0|0|0|0|30/08/2018|

000001|121|0|0|0|0|0|30/08/2018|

000001|125|0|0|0|0|0|30/08/2018|

 

Regards,

 

--

Stéphane Aulery

Développeur

 

Service informatique

Narbonne Accessoires

04.68.44.16.54

 

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: .exit in script is not working

Kees Nuyt
On Fri, 31 Aug 2018 19:29:47 +0200, Stéphane AULERY
<[hidden email]> wrote:

> When I use the -init option the .exit statement
> at the end of my script is never executed.
>
> I launch sqlite from a batch file on Windows Server 2012 and Windows 7 64 bit.
>
> Command line :
> sqlite3.exe -init myscript.scr

If you want a script to exit, use redirection:

        sqlite3.exe <myscript.scr

The -init option is meant to run a specific initialization
before the main script is executed.

You can do something like:
        sqlite3.exe -init initscript.scr <myscript.scr

--
Regards,
Kees Nuyt

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] .exit in script is not working

Hick Gunter
In reply to this post by Stéphane AULERY-2
Try the following script:

Select "statement";
.exit
Select "after exit";

Running the script as an init file produces only the first text. An .exit command in an init file will only terminate the execution of the init file itself, not the sqlite shell as a whole. This is intended.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Stéphane AULERY
Gesendet: Freitag, 31. August 2018 19:30
An: [hidden email]
Cc: [hidden email]
Betreff: [EXTERNAL] [sqlite] .exit in script is not working

Hello,



When I use the -init option the .exit statement at the end of my script is never executed.



I launch sqlite from a batch file on Windows Server 2012 and Windows 7 64 bit.





Command line :



sqlite3.exe -init myscript.scr





myscript.scr :



.log sqlite.log

.bail off

.nullvalue ""



CREATE TABLE STOCKSMAG (

Article TEXT,

CodeDepot TEXT,

QteStock INTEGER,

ECclient INTEGER,

Dispo INTEGER,

ECfour INTEGER,

Proj INTEGER,

DateGen DATETIME,

SeuilReappro INTEGER

);



.import STOCKSMAG.txt STOCKSMAG







.output STOCKSCUMUL.txt



SELECT

     Article,

     SUM (QteStock) AS QteStock,

     SUM (ECclient) AS ECclient,

     SUM (Dispo) AS Dispo,

     SUM (ECfour) AS ECfour,

     SUM (Proj) AS Proj

FROM STOCKSMAG

GROUP BY Article

ORDER BY Article;



.exit





STOCKSMAG.txt :



Article|CodeDepot|QteStock|ECclient|Dispo|ECfour|Proj|DateGen|SeuilReappro

000001|117|0|0|0|0|0|30/08/2018|

000001|118|0|0|0|0|0|30/08/2018|

000001|121|0|0|0|0|0|30/08/2018|

000001|125|0|0|0|0|0|30/08/2018|



Regards,



--

Stéphane Aulery

Développeur



Service informatique

Narbonne Accessoires

04.68.44.16.54



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users