package org.sqlg;

import android.app.Activity;
import android.os.Bundle;

import org.sqlg.SQLiteGlue;

public class SQLiteGlueTest extends Activity
{
  static
  {
    System.loadLibrary("sqlg");
  }

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    long db1 = SQLiteGlue.sqlg_db_open(getFilesDir() + "DB.db", SQLiteGlue.SQLG_OPEN_READWRITE | SQLiteGlue.SQLG_OPEN_CREATE);

if (db1 < 0) {
  android.util.Log.w("SQLiteGlueTest", "DB open error: " + -db1);
return;
}

long s1 = SQLiteGlue.sqlg_db_prepare_st(db1, "select upper('Chris1')");
SQLiteGlue.sqlg_st_step(s1);

String u1 = SQLiteGlue.sqlg_st_column_text(s1, 0);

  android.util.Log.i("SQLiteGlueTest", "upper: " + u1);

SQLiteGlue.sqlg_st_finish(s1);
SQLiteGlue.sqlg_db_close(db1);

  }
}

@@ -97,16 +97,38 @@
 eGlue;%0A%0A
+import java.io.File;%0A%0A
 public c
@@ -410,16 +410,69 @@
 main);%0A%0A
+    File dbfile = new File(getFilesDir(), %22DB.db%22);%0A%0A
     long
@@ -472,19 +472,20 @@
    long 
+my
 db
-1
  = SQLit
@@ -507,32 +507,39 @@
 pen(
-getFilesDir() + %22DB.db%22,
+dbfile.getAbsolutePath(),%0A     
  SQL
@@ -603,23 +603,28 @@
 );%0A%0A
+    
 if (
+my
 db
-1
  %3C 0) %7B%0A
   an
@@ -619,16 +619,20 @@
  %3C 0) %7B%0A
+    
   androi
@@ -687,22 +687,29 @@
  + -
+my
 db
-1
 );%0A
+      
 return;%0A
 %7D%0A%0Al
@@ -708,18 +708,26 @@
 rn;%0A
-%7D%0A%0A
+    %7D%0A%0A    
 long s
-1
+t
  = S
@@ -755,19 +755,20 @@
 pare_st(
+my
 db
-1
 , %22selec
@@ -780,20 +780,39 @@
 er('
-Chris1
+How about ascii text?
 ')%22);%0A
+    
 SQLi
@@ -836,22 +836,29 @@
 ep(s
-1
+t
 );%0A%0A
+    
 String 
-u1
+first
  = S
@@ -892,16 +892,18 @@
 xt(s
-1
+t
 , 0);%0A%0A
+  
   an
@@ -953,14 +953,21 @@
 %22 + 
-u1);%0A%0A
+first);%0A%0A    
 SQLi
@@ -989,20 +989,24 @@
 finish(s
-1
+t
 );%0A
+    
 SQLiteGl
@@ -1026,15 +1026,15 @@
 ose(
+my
 db
-1
 );%0A
-%0A
   %7D%0A

Clean up format, etc.