|
SQLite
|
|||
---|---|---|---|
#18+
делаю по примерам БД для андроид, Код: java 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33.
и обработчик Код: java 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.
но выходит ошибку 09:09:57.529 2046-2046/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:09:57.549 2046-2046/com.example.eldos.myapplication E/SQLiteDatabase﹕ Error inserting catname=lkj android.database.sqlite.SQLiteException: no such table: contact_table (code 1): , while compiling: INSERT INTO contact_table(catname) VALUES (?) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1467) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339) at com.example.eldos.myapplication.DB.sqlInto(DB.java:98) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at android.view.View$1.onClick(View.java:3818) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) в чем может быть дело, ведь таблица с полями создает, что еще просит он ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 12:20 |
|
SQLite
|
|||
---|---|---|---|
#18+
Елдосведь таблица с полями создает, что еще просит он Не создает, сам-же понимаешь... Где создается экземпляр хелпера? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 12:29 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЕлдосведь таблица с полями создает, что еще просит он Не создает, сам-же понимаешь... Где создается экземпляр хелпера? в активити там же Код: java 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.
... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 12:47 |
|
SQLite
|
|||
---|---|---|---|
#18+
Елдос, вставь log в OnCreate, а перед этим удали приложение полностью. Со всеми данными. ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 13:54 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЕлдос, вставь log в OnCreate, а перед этим удали приложение полностью. Со всеми данными. как я понимаю лог должен выводить в консоль Код: java 1. 2. 3. 4. 5. 6. 7.
но почему делаю поиск нету записей, я поставил лог на обработчик, с таким же именем log_tag но его не видно, правильно ли я понимаю все, менял уровень тоже не видно ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 14:13 |
|
SQLite
|
|||
---|---|---|---|
#18+
Елдосно почему делаю поиск нету записей, Возможно база создана была ранее, но без таблиц. Удалял приложение? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 14:16 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЕлдосно почему делаю поиск нету записей, Возможно база создана была ранее, но без таблиц. Удалял приложение? я думал она каждый раз новую установку делает, да сейчас удалил 12-11 08:33:21.949 1499-1499/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 08:35:27.125 1499-1499/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 08:36:50.201 1575-1575/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:06:12.337 1880-1880/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:08:52.921 1965-1965/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:09:57.529 2046-2046/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:21:29.005 2184-2184/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:35:53.289 2269-2269/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:44:09.869 2353-2353/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 09:44:23.549 2380-2380/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 10:14:11.849 2411-2411/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 11:00:41.569 2544-2544/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 11:04:09.117 2615-2615/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 11:09:13.181 2705-2705/com.example.eldos.myapplication E/SQLiteLog﹕ (1) no such table: contact_table 12-11 11:32:14.753 2972-2972/com.example.eldos.myapplication W/LOG_TAG﹕ Will create table 12-11 11:32:14.753 2972-2972/com.example.eldos.myapplication W/LOG_TAG﹕ Created table выходит такой лог ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 14:32 |
|
SQLite
|
|||
---|---|---|---|
#18+
Елдося думал она каждый раз новую установку делает, Создает при отсутствии базы, а далее только обновляет через upgrade. Тебе-бы еще синтаксис подучить... Откуда ты откопал про varchar? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 14:47 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЕлдося думал она каждый раз новую установку делает, Создает при отсутствии базы, а далее только обновляет через upgrade. Тебе-бы еще синтаксис подучить... Откуда ты откопал про varchar? а что здесь такого, но сейчас даже инсерт не работает ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 14:57 |
|
SQLite
|
|||
---|---|---|---|
#18+
Елдоса что здесь такого, В том, что нет такого типа в sqlite. Елдосно сейчас даже инсерт не работает Он изначально не работал, таблицы-то как не было, так и не появилась. Еще разик: wadmanТебе-бы еще синтаксис подучить... ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2014, 15:04 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЕлдоса что здесь такого, В том, что нет такого типа в sqlite. Елдосно сейчас даже инсерт не работает Он изначально не работал, таблицы-то как не было, так и не появилась. Еще разик: wadmanТебе-бы еще синтаксис подучить... ничего не менял, и сейчас работает нормально, после удаления запускается нормально и сразу создает таблицу без ошибок, и добавление и инсерт работает нормально. 12-12 02:53:05.576 2215-2215/com.example.eldos.myapplication W/LOG_TAG﹕ Will create table 12-12 02:53:05.576 2215-2215/com.example.eldos.myapplication W/LOG_TAG﹕ Created table почему так получилось? ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2014, 05:57 |
|
SQLite
|
|||
---|---|---|---|
#18+
Елдосничего не менял, и сейчас работает нормально, Так бабушки из бухгалтерии рассуждают :) если ничего не менял, то и поменяться ничего не могло... ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2014, 09:32 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЕлдосничего не менял, и сейчас работает нормально, Так бабушки из бухгалтерии рассуждают :) если ничего не менял, то и поменяться ничего не могло... разве что закрыл и заново открыл среду, вот так странно получилось ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2014, 11:21 |
|
SQLite
|
|||
---|---|---|---|
#18+
Чудеса, sqlite действительно подготовлен к людям, которые привыкли работать с другими базами... sqlite doc 2.1 Determination Of Column Affinity The affinity of a column is determined by the declared type of the column, according to the following rules in the order shown: If the declared type contains the string "INT" then it is assigned INTEGER affinity. If the declared type of the column contains any of the strings "CHAR", "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the type VARCHAR contains the string "CHAR" and is thus assigned TEXT affinity. If the declared type for a column contains the string "BLOB" or if no type is specified then the column has affinity NONE. If the declared type for a column contains any of the strings "REAL", "FLOA", or "DOUB" then the column has REAL affinity. Otherwise, the affinity is NUMERIC. Note that the order of the rules for determining column affinity is important. A column whose declared type is "CHARINT" will match both rules 1 and 2 but the first rule takes precedence and so the column affinity will be INTEGER. То есть sqlite сам за тебя конвертировал varchar(255) в text. ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2014, 11:38 |
|
SQLite
|
|||
---|---|---|---|
#18+
wadmanЧудеса, sqlite действительно подготовлен к людям, которые привыкли работать с другими базами... sqlite doc 2.1 Determination Of Column Affinity The affinity of a column is determined by the declared type of the column, according to the following rules in the order shown: If the declared type contains the string "INT" then it is assigned INTEGER affinity. If the declared type of the column contains any of the strings "CHAR", "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the type VARCHAR contains the string "CHAR" and is thus assigned TEXT affinity. If the declared type for a column contains the string "BLOB" or if no type is specified then the column has affinity NONE. If the declared type for a column contains any of the strings "REAL", "FLOA", or "DOUB" then the column has REAL affinity. Otherwise, the affinity is NUMERIC. Note that the order of the rules for determining column affinity is important. A column whose declared type is "CHARINT" will match both rules 1 and 2 but the first rule takes precedence and so the column affinity will be INTEGER. То есть sqlite сам за тебя конвертировал varchar(255) в text. во как, это очень хорошо, а то что я выбираю для него размер для него не имеет значение? ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2014, 17:29 |
|
|
start [/forum/topic.php?fid=13&fpage=21&tid=1331489]: |
0ms |
get settings: |
11ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
32ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
52ms |
get tp. blocked users: |
2ms |
others: | 260ms |
total: | 392ms |
0 / 0 |