06-15 08:51:42.292: ERROR/AndroidRuntime(11019): Caused by: android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x249200 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method) 06-15 08:51:42.292: ERROR/AndroidRuntime(11019): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:24..
Layout XML 정의하기 SQLiteOpenHelper 구현하기 Activity 생성하기 Layout XML 정의하기 > SQLiteOpenHelper 구현하기 SQLiteOpenHelper 를 상속받아서 DB에 관련된 기능을 구현한다. public class MyDBHelper extends SQLiteOpenHelper { private static final String TAG = "MyDBHelper"; private static final int DATABASE_VERSION = 1; private static final String DB_NAME = "db_sample10"; public MyDBHelper(Context context, CursorFactory factory) { supe..
06-10 08:54:19.741: ERROR/AndroidRuntime(579): Caused by: android.database.sqlite.SQLiteException: near "AUTOINCREMENT": syntax error: CREATE TABLE schedule(_id INTEGER PRIMARY AUTOINCREMENT, content TEXT); SQL 문을 잘 못 작성하였다... SQLite Manager를 이용하여 SQL을 검증한 후에 사용한다.
추상클래스 이므로 서브 클래스를 파생하여 사용하는 DB에 맞게 메서드들을 재정의하고 적절한 스크립트를 작성해 넣어야 한다. SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version) 생성자 Context context DB를 생성하는 컨텍스트, 보통 메인 액티지티를 전달한다. String name DB 파일의 이름 CursorFactory factory 커스텀 커스를 사용하고자 할 때 지정, 표준 커서를 사용할 때는 null int version DB 파일의 버전 DB 업데이트에 사용 public void onCreate(SQLiteDatabase db) DB가 처음 만들어질 때 호출된다. 여기서 테이블을 만들고 초..
From an adb remote shell, you can use the sqlite3 command-line program to manage SQLite databases created by Android applications. The sqlite3 tool includes many useful commands, such as .dump to print out the contents of a table and .schema to print the SQL CREATE statement for an existing table. The tool also gives you the ability to execute SQLite commands on the fly. 참고자료 Examining sqlite3 D..
안드로이는 SQLite database 를 모두 지원한다. 생성한 어떤 DB도 어플리케이션 안에서는 이름을 가지고 어떤 클래스에도 접근가능하지만, 어플리케이션 밖에서는 불가능하다. Android provides full support for SQLite databases. Any databases you create will be accessible by name to any class in the application, but not outside the application. 새 SQLite database를 만드는 권장하는 방법은 SQLiteOpenHelper 의 서브 클래스를 생성하고 onCreate() 메소드를 오버라이드하고 그 곳에서 관련명령을 실행한다. The recommended metho..
Datatypes In SQLite Version 3 data type value 특징 NULL NULL INTEGER signed integer stored in 1, 2, 3, 4, 6, or 8 bytes REAL floating point value 8-byte IEEE floating point number TEXT text string UTF-8, UTF-16BE or UTF-16LE 사용 BLOB blob of data Boolean Datatype 별도의 Boolean 타입은 없다. 대신 Integers 의 0과 1 사용 SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as in..