Android Open Source - robotronic Database Helper






From Project

Back to project page robotronic.

License

The source code is released under:

Copyright (C) 2011 by Drew Schrauf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the So...

If you think the Android project robotronic listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.drewschrauf.robotronic.database;
//  ww w  .ja va 2  s  .  c  o m
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
  private static final String DB_NAME = "robotronic"; // the name of our database
  private static final int DB_VERSION = 1; // the version of the database
  
  public static final String TABLE_NAME = "FETCHED_DATA";
  public static final String COLUMN_URL = "URL";
  public static final String COLUMN_DATA = "DATA";
  public static final String COLUMN_FETCHED_DATE = "FETCHED_DATE";

  public DatabaseHelper(Context context) {
    super(context, DB_NAME, null, DB_VERSION);
  }

  @Override
  public void onCreate(SQLiteDatabase db) {
    String newTableQueryString =   
      "create table " + TABLE_NAME + " (" +
      COLUMN_URL + " text primary key not null," +
      COLUMN_DATA + " text," +
      COLUMN_FETCHED_DATE + " datetime);";
   
    // execute the query string to the database.
    db.execSQL(newTableQueryString);
  }

  @Override
  public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {    
  }
  
}




Java Source Code List

com.drewschrauf.example.robotronic.ExampleHome.java
com.drewschrauf.example.robotronic.ExampleListItem.java
com.drewschrauf.example.robotronic.ExampleList.java
com.drewschrauf.example.robotronic.ExampleSimple.java
com.drewschrauf.robotronic.activities.RobotronicActivity.java
com.drewschrauf.robotronic.activities.RobotronicListActivity.java
com.drewschrauf.robotronic.database.DatabaseHandler.java
com.drewschrauf.robotronic.database.DatabaseHelper.java
com.drewschrauf.robotronic.threads.BinaryFetchThread.java
com.drewschrauf.robotronic.threads.CacheCleaner.java
com.drewschrauf.robotronic.threads.DataFetchThread.java
com.drewschrauf.robotronic.threads.ParsingException.java
com.drewschrauf.robotronic.threads.RobotronicProperties.java
com.drewschrauf.robotronic.threads.RobotronicThread.java
com.drewschrauf.robotronic.threads.RobotronicUtilities.java
com.drewschrauf.robotronic.threads.ThreadHandler.java