dimanche 16 août 2015

sqlite script file execute in android

I want to do the following

I have generated the following sqlite script

    BEGIN TRANSACTION;

DROP TABLE IF EXISTS Country;

CREATE TABLE Country (
    Id              INTEGER NOT NULL,
    ArabicName      TEXT,
    EnglishName     TEXT,
    PRIMARY KEY (
        Id
    )
);

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          1,
                          'Egypt',
                          'Egypt'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          2,
                          'Algeri',
                          'Algeri'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          3,
                          'Australia',
                          'Australia'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          4,
                          'Austria',
                          'Austria'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          5,
                          'Cyrpus',
                          'Cyrpus'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          6,
                          'France',
                          'France'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          7,
                          'Malysia',
                          'Malysia'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          8,
                          'Switzerland',
                          'Switzerland'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          9,
                          'Tunisia',
                          'Tunisia'
                      );

INSERT INTO Country (
                          Id,
                          ArabicName,
                          EnglishName
                      )
                      VALUES (
                          10,
                          'Madrid',
                          'Madrid'
                      );


COMMIT TRANSACTION;

What I want to do is to be able to open the file and read all the data and execute it to database in android.

I will download the file when first open the application, and then I should read the script and execute it

Can any one help please ?

Aucun commentaire:

Enregistrer un commentaire