fork download
  1. package com.sandy.mylittleprincess2;
  2. import java.io.File;
  3.  
  4. import android.content.Context;
  5. import android.database.sqlite.SQLiteDatabase;
  6. import android.database.sqlite.SQLiteDatabase.CursorFactory;
  7. import android.database.sqlite.SQLiteOpenHelper;
  8.  
  9. public class CreatDB extends SQLiteOpenHelper{
  10. private static final String DICTIONARY_TABLE_NAME = "Place";
  11. private static final String DICTIONARY_TABLE_CREATE =
  12. "CREATE TABLE " + DICTIONARY_TABLE_NAME + " (" +
  13. "_id" + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
  14. "Finish_date" + " TEXT , "+
  15. "HyperLink" + " TEXT, " +
  16. "Main" + " TEXT, " +
  17. "Context"+" TEXT, "+
  18. "Address"+" TEXT "+
  19. " );";
  20.  
  21. private static final int VERSION=3;
  22. public CreatDB(Context context) {
  23. super(context, "Princess", null, VERSION);
  24. // TODO 自動產生的建構子 Stub
  25. }
  26.  
  27. @Override
  28. public void onCreate(SQLiteDatabase db) {
  29. // TODO 自動產生的方法 Stub
  30. db.execSQL(DICTIONARY_TABLE_CREATE);
  31.  
  32. }
  33.  
  34. @Override
  35. public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  36. // TODO 自動產生的方法 Stub
  37. System.out.println("old"+oldVersion+"new"+newVersion);
  38. if(oldVersion<2){
  39. String sql=" ALTER TABLE "+DICTIONARY_TABLE_NAME+" ADD COLUMN Address TEXT";
  40. db.execSQL(sql);
  41. oldVersion++;
  42. }else{
  43. //onCreate(db);
  44. }
  45. }
  46.  
  47. @Override
  48. public synchronized void close() {
  49. // TODO 自動產生的方法 Stub
  50. super.close();
  51. }
  52.  
  53. }
  54.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:9: error: class CreatDB is public, should be declared in a file named CreatDB.java
public class CreatDB extends SQLiteOpenHelper{
       ^
Main.java:4: error: package android.content does not exist
import android.content.Context;
                      ^
Main.java:5: error: package android.database.sqlite does not exist
import android.database.sqlite.SQLiteDatabase;
                              ^
Main.java:6: error: package android.database.sqlite.SQLiteDatabase does not exist
import android.database.sqlite.SQLiteDatabase.CursorFactory;
                                             ^
Main.java:7: error: package android.database.sqlite does not exist
import android.database.sqlite.SQLiteOpenHelper;
                              ^
Main.java:9: error: cannot find symbol
public class CreatDB extends SQLiteOpenHelper{
                             ^
  symbol: class SQLiteOpenHelper
Main.java:22: error: cannot find symbol
	public CreatDB(Context context) {
	               ^
  symbol:   class Context
  location: class CreatDB
Main.java:28: error: cannot find symbol
	public void onCreate(SQLiteDatabase db) {
	                     ^
  symbol:   class SQLiteDatabase
  location: class CreatDB
Main.java:35: error: cannot find symbol
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	                      ^
  symbol:   class SQLiteDatabase
  location: class CreatDB
Main.java:27: error: method does not override or implement a method from a supertype
	@Override
	^
Main.java:34: error: method does not override or implement a method from a supertype
	@Override
	^
Main.java:47: error: method does not override or implement a method from a supertype
	@Override
	^
Main.java:50: error: cannot find symbol
		super.close();
		^
  symbol:   variable super
  location: class CreatDB
13 errors
stdout
Standard output is empty