SQLite Android Bindings

Check-in [cf6a31d2c9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add an extra test for SQLiteOpenHelper.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cf6a31d2c93f887298de3cc9259bc8cc64236000
User & Date: dan 2015-04-09 18:15:20
Context
2016-05-20
18:43
Update to Android Studio and gradle build system. (check-in: 345de238a6 user: dan tags: trunk)
2016-05-19
15:24
Upgrade this module so that it takes the form of an Android Studio project. (check-in: b5fcf9e7da user: dan tags: android-studio)
2015-04-09
18:15
Add an extra test for SQLiteOpenHelper. (check-in: cf6a31d2c9 user: dan tags: trunk)
2015-04-04
08:19
Update this code to support 64-bit pointers. See also: https://android.googlesource.com/platform/frameworks/base.git/+/738702d28ab7e0e89e3c6e18fd46cc1361917eb9 (check-in: 3e4327dc6e user: dan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/org/sqlite/app/customsqlite/CustomSqlite.java.

337
338
339
340
341
342
343
















344
345
346
347
348
349
350
    }
    public void onCreate(SQLiteDatabase db){
      db.execSQL("CREATE TABLE t1(x)");
    }
    public void onUpgrade(SQLiteDatabase db, int iOld, int iNew){
    }
  } 

















  /*
  ** If this is a SEE build, check that SQLiteOpenHelper still works.
  */
  public void see_test_2() throws Exception {
    if( !SQLiteDatabase.hasCodec() ) return;
    SQLiteDatabase.deleteDatabase(DB_PATH);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
    }
    public void onCreate(SQLiteDatabase db){
      db.execSQL("CREATE TABLE t1(x)");
    }
    public void onUpgrade(SQLiteDatabase db, int iOld, int iNew){
    }
  } 

  /*
  ** Check that SQLiteOpenHelper works.
  */
  public void helper_test_1() throws Exception {
    /* SQLiteDatabase.deleteDatabase(DB_PATH); */

    MyHelper helper = new MyHelper(this);
    SQLiteDatabase db = helper.getWritableDatabase();
    db.execSQL("INSERT INTO t1 VALUES ('x'), ('y'), ('z')");

    String res = string_from_t1_x(db);
    test_result("helper.1", res, ".x.y.z");

    helper.close();
  }

  /*
  ** If this is a SEE build, check that SQLiteOpenHelper still works.
  */
  public void see_test_2() throws Exception {
    if( !SQLiteDatabase.hasCodec() ) return;
    SQLiteDatabase.deleteDatabase(DB_PATH);
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381

382
383
384
385
386
387
388

    test_result("see_test_2.5", db_is_encrypted(), "encrypted");
  }

  public void run_the_tests(View view){
    System.loadLibrary("sqliteX");
    DB_PATH = getApplicationContext().getDatabasePath("test.db");
    DB_PATH.mkdirs();

    myTV.setText("");
    myNErr = 0;
    myNTest = 0;

    try {
      report_version();

      supp_char_test_1();
      csr_test_1();
      csr_test_2();
      thread_test_1();
      thread_test_2(); 
      see_test_1();
      see_test_2();







|







>







383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405

    test_result("see_test_2.5", db_is_encrypted(), "encrypted");
  }

  public void run_the_tests(View view){
    System.loadLibrary("sqliteX");
    DB_PATH = getApplicationContext().getDatabasePath("test.db");
    DB_PATH.getParentFile().mkdirs();

    myTV.setText("");
    myNErr = 0;
    myNTest = 0;

    try {
      report_version();
      helper_test_1();
      supp_char_test_1();
      csr_test_1();
      csr_test_2();
      thread_test_1();
      thread_test_2(); 
      see_test_1();
      see_test_2();