import com.almworks.sqlite4java.*;
import java.io.*;
import java.util.Vector; 

public class KAHVE3 
{
public static void main(String arg[]) throws SQLiteException
{
SQLiteConnection db = new SQLiteConnection(new File("/temp"));
db.open(true);
db.exec("drop table if exists KAHVE");
db.exec("create table KAHVE(isim String,kot int,fiyat double,miktar int,toplam double)");
db.exec("insert into KAHVE values('Espresso',150,9.99,110,0);");
db.exec("insert into KAHVE values('Venezuella',173,12.99,57,0);");
db.exec("insert into KAHVE values('Brezilya',123,12.99,30,0);");
db.exec("insert into KAHVE values('Kolombia',111,15.99,20,0);");
db.exec("update KAHVE set toplam=fiyat*miktar;");
SQLiteStatement statement = db.prepare("select * from KAHVE");
String isim[];
Vector<Object> cache=new Vector<Object>();
Object value;
Object a[][];
int m=0;
int n=0;
try { n=statement.columnCount();
      isim=new String[n];
      for (int i=0;i<n;i++)
      {isim[i]=statement.getColumnName(i);}
      while (statement.step()) 
      {m++;Object[] record=new Object[n];
      for(int i=0;i<n;i++)
        {record[i]=statement.columnValue(i);}
      cache.add(record);
      } //while'in sonu
      a=new Object[m][n];
      for(int i=0;i<m;i++)
      {for(int j=0;j<n;j++)
       {a[i][j]=((Object[])cache.elementAt(i))[j];}
      } 
      } finally {statement.dispose();}
      JTableP.print(a,isim,"KAHVE Veri tabanư ");  
}

} 