西西軟件園多重安全檢測下載網(wǎng)站、值得信賴的軟件下載站!
西西首頁 電腦軟件 安卓軟件 電腦游戲 安卓游戲 排行榜 專題合集

Sqlite工具(SqliteStudio)

v3.3.3 綠色中文版
  • Sqlite工具(SqliteStudio)v3.3.3 綠色中文版
  • 軟件大小:22.1M
  • 更新時間:2022-02-25 17:06
  • 軟件語言:中文
  • 軟件廠商:
  • 軟件類別:國產(chǎn)軟件 / 免費軟件 / 數(shù)據(jù)庫類
  • 軟件等級:5級
  • 應用平臺:WinAll, Win7
  • 官方網(wǎng)站:http://sqlitestudio.pl
  • 應用備案:
好評:50%
壞評:50%

軟件介紹

SqliteStudio是一款 Sqlite數(shù)據(jù)庫可視化工具,是使用Sqlite數(shù)據(jù)庫開發(fā)應用的必備軟件,SqliteStudio軟件無需安裝,下載后解壓即可使用,很小巧但很好用,綠色中文版本。比起其它SQLite管理工具,我喜歡用這個。很方便易用,不用安裝的單個可執(zhí)行文件,支持中文。

SQLiteStudio 是一個跨平臺的 SQLite 數(shù)據(jù)庫的管理工具,采用 Tcl 語言開發(fā)。

Sqlite工具(SqliteStudio)

SQLiteStudio的特色:

功能完善的sqlite2和sqlite3工具,視圖編碼支持utf8。
支持導出數(shù)據(jù)格式:csv、html、plain、sql、xml,
可同時打開多個數(shù)據(jù)庫文件
支持查看和編輯二進制字段

SqliteStudio怎么用?

使用“sqlitestudio”打開(也可以使用其它sqlite可視化工具,個人習慣使用該工具,多語言小巧無需安裝)

1、打開sqlitestudio ”數(shù)據(jù)庫“-”添加數(shù)據(jù)庫“

2、選擇導出的那個數(shù)據(jù)庫文件直接打開即可。

3、在sqlitestudio 可以創(chuàng)建和修改表也可以執(zhí)行SQL語句基本可以滿足常用需求

在sqlitestudio 導出表數(shù)據(jù)直接右鍵”導出表“ 默認格式CSV文件

4、導入表數(shù)據(jù):

右鍵表名“import data to table”

SqliteStudio在Android程序中使用已有的SQLite數(shù)據(jù)庫

1. 準備SQLite database文件

    假設你已經(jīng)創(chuàng)建了一個sqlite數(shù)據(jù)庫,我們需要對其進行一些修改。

   (譯者注:這里原文是推薦了一個SQLite數(shù)據(jù)庫管理軟件,這個我覺得可以隨自己的喜好,最Windows下面有多款可視化的SQlite數(shù)據(jù)庫管理軟件,可以方便的讀取,編輯數(shù)據(jù)庫,例如我用的是sqlitestudio

打開數(shù)據(jù)庫,添加一個新的table “android_metadata",插入一行數(shù)據(jù),具體的SQL如下:

[sql] view plaincopyprint?在CODE上查看代碼片派生到我的代碼片

CREATE TABLE "android_metadata" ("locale" TEXT DEFAULT 'en_US')  

INSERT INTO "android_metadata" VALUES ('en_US')  

   (譯者注:上面兩行是表明需要進行的操作,具體可以直接在sqlitesstudio中完成)

    然后你需要對你數(shù)據(jù)表格的primary id 列重命名為 “_id”,這樣Adroid會知道怎么對id列進行綁定,你可以很容易的在SQlite數(shù)據(jù)庫管理軟件中進行列編輯。

    這兩步之后,你的sqlite數(shù)據(jù)庫文件就準備好了。

  (譯者注:這里我保留了id列,即沒有對其進行重命名,測試證明也是沒有問題的)

2. 在你的Android程序中復制,打開以及訪問數(shù)據(jù)庫

    現(xiàn)在把你上一步準備好的數(shù)據(jù)庫文件放在“assets”文件夾下面,然后通過繼承 SQLiteOpenHelper類來創(chuàng)建一個Database Helper類,

你的DataBaseHelper類大致可以如下:

public class DataBaseHelper extends SQLiteOpenHelper{  

    //The Android's default system path of your application database.  

    private static String DB_PATH = "/data/data/YOUR_PACKAGE/databases/";  

    private static String DB_NAME = "myDBName";  

    private SQLiteDatabase myDataBase;   

    private final Context myContext;  

    /** 

     * Constructor 

     * Takes and keeps a reference of the passed context in order to access to the application assets and resources. 

     * @param context 

     */  

    public DataBaseHelper(Context context) {  

        super(context, DB_NAME, null, 1);  

        this.myContext = context;  

    }     

  /** 

     * Creates a empty database on the system and rewrites it with your own database. 

     * */  

    public void createDataBase() throws IOException{  

        boolean dbExist = checkDataBase();  

        if(dbExist){  

            //do nothing - database already exist  

        }else{  

            //By calling this method and empty database will be created into the default system path  

               //of your application so we are gonna be able to overwrite that database with our database.  

            this.getReadableDatabase();  

            try {  

                copyDataBase();  

            } catch (IOException e) {  

                throw new Error("Error copying database");  

            }  

        }  

    }  

    /** 

     * Check if the database already exist to avoid re-copying the file each time you open the application. 

     * @return true if it exists, false if it doesn't 

     */  

    private boolean checkDataBase(){  

        SQLiteDatabase checkDB = null;  

        try{  

            String myPath = DB_PATH + DB_NAME;  

            checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);  

        }catch(SQLiteException e){  

            //database does't exist yet.  

        }  

        if(checkDB != null){  

            checkDB.close();  

        }  

        return checkDB != null ? true : false;  

    }  

    /** 

     * Copies your database from your local assets-folder to the just created empty database in the 

     * system folder, from where it can be accessed and handled. 

     * This is done by transfering bytestream. 

     * */  

    private void copyDataBase() throws IOException{  

        //Open your local db as the input stream  

        InputStream myInput = myContext.getAssets().open(DB_NAME);  

        // Path to the just created empty db  

        String outFileName = DB_PATH + DB_NAME;  

        //Open the empty db as the output stream  

        OutputStream myOutput = new FileOutputStream(outFileName);  

        //transfer bytes from the inputfile to the outputfile  

        byte[] buffer = new byte[1024];  

        int length;  

        while ((length = myInput.read(buffer))>0){  

            myOutput.write(buffer, 0, length);  

        }  

        //Close the streams  

        myOutput.flush();  

        myOutput.close();  

        myInput.close();  

    }  

    public void openDataBase() throws SQLException{  

        //Open the database  

        String myPath = DB_PATH + DB_NAME;  

        myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);  

    }  

    @Override  

    public synchronized void close() {  

            if(myDataBase != null)  

                myDataBase.close();  

            super.close();  

    }  

    @Override  

    public void onCreate(SQLiteDatabase db) {  

    }  

    @Override  

    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {  

    }  

        // Add your public helper methods to access and get content from the database.  

       // You could return cursors by doing "return myDataBase.query(....)" so it'd be easy  

       // to you to create adapters for your views.  

}  

    就這樣。

    現(xiàn)在你可以創(chuàng)建一個新的DataBaseHelper實例,然后調用createDataBase(),然后再調用openDataBase()方法,記住修改DB_PATH字符串中“YOUR_PACKAGE”為你真正的package名稱(也就是說com.examplename.myapp)

以下是示范代碼:

[java] view plaincopyprint?在CODE上查看代碼片派生到我的代碼片

...  

       DataBaseHelper myDbHelper = new DataBaseHelper();  

       myDbHelper = new DataBaseHelper(this);  

       try {  

        myDbHelper.createDataBase();  

    } catch (IOException ioe) {  

        throw new Error("Unable to create database");  

    }  

    try {  

        myDbHelper.openDataBase();  

    }catch(SQLException sqle){  

        throw sqle;  

    }  

       ...  

軟件標簽: SQLite SqliteStudio

設置中文語言:

軟件截圖

Sqlite工具(SqliteStudio) v3.3.3 綠色中文版
Sqlite工具(SqliteStudio) v3.3.3 綠色中文版

其他版本下載

最新評論查看所有(2)條評論 >

第 2 樓 上海有線通 網(wǎng)友 客人 2018/9/6 11:05:50
很好,多谢分享~

支持( 0 ) 蓋樓(回復)

第 1 樓 上海有線通 網(wǎng)友 客人 2018/8/9 15:21:38
很好,GOOD,谢谢分享

支持( 0 ) 蓋樓(回復)

發(fā)表評論

昵稱:
表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
查看所有(2)條評論 > 字數(shù): 0/500

TOP
軟件下載