Report: import .dump.text in a .sqlite file

  1. 4 months ago

    Emile S

    Nov 22 Europe (France, Strasbourg)

    This follows a previous discussion here (that do not have a conclusion ?)

    I just created a special one button project to import a .dump.txt file into a .sqlite file.

    Everything works fine even if the INSERT INTO syntax appears strange to my eyes:

    INSERT INTO "Phone_Book" VALUES('CMS Bourse-Esplanade-Krutenau - 67000','','','','','','15, Rue de Genève','','67000','Strasbourg','03-68-98-51-40','','','','','','',1);

    The example in Xojo includes the TABLE Columns names.

    BTW: the code uses a TextInputStream, read a line at a time and execute what it is found (FOREIGN KEY, BEGIN TRANSATION, CREATE TABLE with all my Columns and INSERT INTO all my (exported) Records.

    For more details on .dump, read:
    https://sqlite.org/cli.html#converting_an_entire_database_to_an_ascii_text_file

    I generated my .dump.txt file using the Terminal on El Capitan.

    I would write Eureka, but, I do not know what to do with that information, so now you know too.

    Enjoy (eventually).

  2. Christian S

    Nov 22 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    You know you can use the CLI commands the MBS Plugin?

    See InternalSQLiteLibraryMBS .Shell method.

  3. Dave S

    Nov 22 San Diego, California USA
    Edited 4 months ago

    An INSERT INTO statement does not require the Column names *IF* the value statement accounts for ALL columns and is in the same physical order as the fields in the table....

    NOTE : that last requirement cannot be guaranteed which is why normally one would always specifiy the column names/order

  4. Emile S

    Nov 22 Europe (France, Strasbourg)

    @Dave S that last requirement

    What is “the last requirement” ?

    This was new to me because the LR does not expose this syntax. That is why I created the project.

  5. Dave S

    Nov 22 San Diego, California USA

    That the fields are in the order of the value statement..... other processes may or may not have altered the tables ..... so it is never safe to assume the field order is constant

or Sign Up to reply!