,   CyberForum.ru

Android


 
 
 
:  :  - 15,   - 4.87
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
#1

"Attempt to re-open an already-closed object" SQLite - Android

09.04.2015, 18:03. 2400. 41
( )

. ... :

FATAL EXCEPTION: main
java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase:

Log.v , , , .
, , ... . .


.
EventActivity.java
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event);
 
        Log.v(TAG, "    " );
 
        //    
        db = new DB(this);
        db.open();
 
        Log.v(TAG, "- " );
 
        //  
 
        edtMan = (Spinner) findViewById(R.id.ManSpinner);
        edtET = (Spinner) findViewById(R.id.ETSpinner);
        edtMeet = (Spinner) findViewById(R.id.MeetingSpinner);
 
        // MAN - EVENT TYPE - MEET
        CreatNewSpinnerFU("man", "name", edtMan);
        CreatNewSpinnerFU("event_type", "name", edtET);
        CreatNewSpinnerFU("meeting", "name", edtMeet);
 
 
        checkboxEvent = (CheckBox) findViewById(R.id.checkBox);
 
        Log.v(TAG, "Ĩ '' " );
 
        btnEvent  = (Button) findViewById(R.id.new_event_in_tab);
        btnEvent.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Do something in response to button click
 
                boolean checkMan= !true,
                        checkET = !true,
                        checkMeet = !true;
 
                Log.v(TAG, "!" );
 
                //checkMan = !true; checkET = !true; checkMeet = !true;
 
                Log.v(TAG, "   --- if (edtMan.getSelectedItem() != null) ---" );
 
                if (edtMan.getSelectedItem() != null)
                {
                    Log.v(TAG, "----if    -----" );
                    Log.v(TAG, "----if -----   checkMan = true;" );
                    checkMan = true;
                    Log.v(TAG, "----if -----   checkMan = true;-- " );
 
 
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);" );
                    cur = db.GetCatalogValueByName("man", "_id", "name", edtMan.getSelectedItem().toString());
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);-------" );
 
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    cManID = cur.getInt(cur.getColumnIndex("_id"));
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    //db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                }
 
                Log.v(TAG, "  E  --- if (edtET.getSelectedItem() != null) ---" );
                if (edtET.getSelectedItem() != null)
                {
                    checkET = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "FullName", edtET.getSelectedItem().toString());
                    cETID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID );
                }
 
                Log.v(TAG, "   --- if (edtMeet.getSelectedItem() != null) ---" );
                if (edtMeet.getSelectedItem() != null)
                {
                    checkMeet = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "FullName", edtMeet.getSelectedItem().toString());
                    cMeetID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
                }
 
                Log.v(TAG, "   'TRUE'     'event' --- if(checkMan != false & checkET != false & checkMeet != false) ---" );
 
                //   true,      "event"
                if(checkMan != false & checkET != false & checkMeet != false){
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MAN, cManID ); ---" );
                    db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_EVENT_TYPE, cETID ); ---" );
                    db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "    ---- ---" );
                    db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
 
                    if (checkboxEvent.isChecked() == true) {
                        db.addRec("event", DB.EVENT_COLUMN_VALUE, 1 );
                        Log.v(TAG, "---1" );
 
                    }else {
                        db.addRec("event", DB.EVENT_COLUMN_VALUE, 0 );
                        Log.v(TAG, "---0" );
                    }
 
                }
 
 
            }
        });
        db.close();
    }
// SPINNER
    public void CreatNewSpinnerFU(String name_table, String name_column, Spinner qwerty) {
        List ListArray = new ArrayList();
        Cursor Post = db.GetCatalogByName(name_table);
        Post.moveToFirst();
 
        if (Post != null && Post.getCount() > 0) {
            do {
                ListArray.add(Post.getString(Post.getColumnIndex(name_column)));
            } while (Post.moveToNext());
 
            ArrayAdapter dataAdapterPost = new ArrayAdapter(this, android.R.layout.simple_spinner_item, ListArray);
            dataAdapterPost.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            qwerty.setAdapter(dataAdapterPost);
        }
    }

.
BD.java
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
public class DB {
 
    private static final String TAG = "DB__ACTIVITY";
 
 
    private static final String DB_NAME = "Allreg";
    private static final int DB_VERSION = 1;
    //man
    private static final String DB_TABLE = "man";
    public static final String COLUMN_ID = "_id";
    public static final String COLUMN_NAME = "name";
 
    private static final String DB_CREATE =
            "create table " + DB_TABLE + "(" +
                    COLUMN_ID + " integer primary key autoincrement, " +
                    COLUMN_NAME + " text" +
                    ");";
 
    //event type
    private static final String EVENT_TYPE_TABLE = "event_type";
    public static final String EVENT_TYPE_COLUMN_ID = "_id";
    public static final String EVENT_TYPE_COLUMN_NAME = "name";
 
    private static final String EVENT_TYPE_DB_CREATE =
            "create table " + EVENT_TYPE_TABLE + "(" +
                    EVENT_TYPE_COLUMN_ID + " integer primary key autoincrement, " +
                    EVENT_TYPE_COLUMN_NAME + " text" +
                    ");";
 
    //meeting
    private static final String MEETING_TABLE = "meeting";
    public static final String MEETING_COLUMN_ID = "_id";
    public static final String MEETING_COLUMN_NAME = "name";
 
    private static final String MEETING_DB_CREATE =
            "create table " + MEETING_TABLE + "(" +
                    MEETING_COLUMN_ID + " integer primary key autoincrement, " +
                    MEETING_COLUMN_NAME + " text" +
                    ");";
 
    //event
    private static final String EVENT_TABLE = "event";
    public static final String EVENT_COLUMN_ID = "_id";
    public static final String EVENT_COLUMN_MAN = "ManId";
    public static final String EVENT_COLUMN_MEETING = "MeetingId";
    public static final String EVENT_COLUMN_EVENT_TYPE = "EventTypeId";
    public static final String EVENT_COLUMN_VALUE = "Value";
 
    private static final String EVENT_DB_CREATE =
            "create table " + EVENT_TABLE + "(" +
                    EVENT_COLUMN_ID + " integer primary key autoincrement, " +
                    EVENT_COLUMN_MAN + " integer" +
                    EVENT_COLUMN_MEETING + " integer" +
                    EVENT_COLUMN_EVENT_TYPE + " integer" +
                    EVENT_COLUMN_VALUE + " integer" +
                    ");";
 
    private final Context mCtx;
 
 
    private DBHelper mDBHelper;
    private SQLiteDatabase mDB;
 
    public DB(Context ctx) {
        mCtx = ctx;
    }
 
    //  
    public void open() {
        mDBHelper = new DBHelper(mCtx, DB_NAME, null, DB_VERSION);
        mDB = mDBHelper.getWritableDatabase();
    }
 
    //  
    public void close() {
        if (mDBHelper!=null) mDBHelper.close();
    }
 
    //      DB_TABLE
    public Cursor getAllData(String name_DB) {
        String str = name_DB;
        return mDB.query(str, null, null, null, null, null, null);
    }
 
    //    DB_TABLE
    //-----------------------------------   _id
    public void delRec(String name_DB , String column_id , long id) {
        String str = name_DB;
        String col_id = column_id;
        mDB.delete(name_DB, col_id + " = " + id, null);
    }
 
    //    
    //    
    public Cursor GetCatalogByName(String FullName)
    {
        Cursor cur = mDB.rawQuery("select * from " + FullName.toString() , null);
        cur.moveToFirst();
        return cur;
    }
 
    //         
    public Cursor GetCatalogValueByName(String CatalogFullName,
                                        String FieldFullName,
                                        String ConditionField,
                                        String Value)
    {
        //Open();
 
        Log.v(TAG, "----  GetCatalogValueByName----");
 
        Log.v(TAG,"---  ." + " select " + FieldFullName + " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'" );
 
        Cursor cur = mDB.rawQuery(" select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'"
                , null);
 
        Log.v(TAG, " select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'");
 
        cur.moveToFirst();
        //Close();
 
        Log.v(TAG, cur.getCount() + "");
 
        return cur;
    }
 
    //      
    private class DBHelper extends SQLiteOpenHelper {
 
        public DBHelper(Context context, String name, CursorFactory factory,
                        int version) {
            super(context, name, factory, version);
        }
 
        //    
        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL(DB_CREATE);
            db.execSQL(EVENT_TYPE_DB_CREATE);
            db.execSQL(MEETING_DB_CREATE);
            db.execSQL(EVENT_DB_CREATE);
 
        }
 
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        }
    }
}




Prolog
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
04-09 15:46:08.708  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     
04-09 15:46:08.728  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ - 
04-09 15:46:08.728  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ Ĩ '' 
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  .
    select _id from man where name = ' '
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-09 15:46:12.102  10679-10679/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.kirukato.coolstdreg/databases/Allreg
            at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1318)
            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1261)
            at com.example.kirukato.coolstdreg.DB.GetCatalogValueByName(DB.java:154)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:96)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
, . .
0
? .
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
09.04.2015, 18:03
! "Attempt to re-open an already-closed object" SQLite ( Android):

"Attempting to invoke method on a null object reference" - Android
! . Add Attempting to invoke interface method java.sql.Statement...

SQLite, : "" - Android
SQLite. : . 3 : , ...

(Spinner) "->" c SQLite - Android
...

Attempt to invoke virtual method on a null object reference - Android
, , firebase. public class Tab3Activity...

Attempt to invoke virtual method on a null object reference - Android
. . . : Caused by: java.lang.NullPointerException: Attempt to...

"" SQLite - Android
, : "" , ...

41
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 20:13  [] #16
Armagedo
"" , DB

Java
1
2
3
public void close() {
 if (mDBHelper!=null) mDBHelper.close();
 }
.
? ?
? ?
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 20:18 #17
Naomis
? ?
?
, ?

Rube.

( db), (Post) - ?

, -
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 20:31  [] #18
Armagedo
, ?
Rube.
, - ?
, , , ...

... . ...
"FATAL EXCEPTION: main " , , .
Prolog
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
04-09 20:16:13.882  31989-31989/com.example.kirukato.coolstdreg I/Process﹕ Sending signal. PID: 31989 SIG: 9
04-09 20:16:24.393      580-580/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libEGL_adreno.so
04-09 20:16:24.393      580-580/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libGLESv1_CM_adreno.so
04-09 20:16:24.393      580-580/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libGLESv2_adreno.so
04-09 20:16:24.393      580-580/com.example.kirukato.coolstdreg I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:316>: EGL 1.4 QUALCOMM build:  (CL4169980)
    OpenGL ES Shader Compiler Version: 17.01.10.SPL
    Build Date: 11/04/13 Mon
    Local Branch:
    Remote Branch:
    Local Patches:
    Reconstruct Branch:
04-09 20:16:24.433      580-580/com.example.kirukato.coolstdreg D/OpenGLRenderer﹕ Enabling debug mode 0
04-09 20:16:28.107      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     
04-09 20:16:28.127      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ - 
04-09 20:16:28.147      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ Ĩ '' 
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕  edtMan.getSelectedItem().toString()------
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from man where name = ' '
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from man where name = ' '
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);-------
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    _id ---- cManID = cur.getInt(...._id")-----
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    _id ---- cManID = cur.getInt(...._id")-----
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕   E  --- if (edtET.getSelectedItem() != null) ---
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from event_type where name = '   '
04-09 20:16:29.008      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from event_type where name = '   '
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMeet.getSelectedItem() != null) ---
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from event_type where name = ' '
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from event_type where name = ' '
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 0
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-09 20:16:29.018      580-580/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-09 20:16:29.038      580-580/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
            at android.database.AbstractCursor.checkPosition(AbstractCursor.java:424)
            at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
            at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:68)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:119)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
, , - .

8
"meeting"
Java
1
Log.v(TAG, cur.getCount() + "");

Prolog
1
DB__ACTIVITY﹕ 0
Java
1
2
3
4
5
6
7
8
Log.v(TAG, "   --- if (edtMeet.getSelectedItem() != null) ---" );
                if (edtMeet.getSelectedItem() != null)
                {
                    checkMeet = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "name", edtMeet.getSelectedItem().toString());
                    cMeetID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
                }
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
public Cursor GetCatalogValueByName(String CatalogFullName,
                                        String FieldFullName,
                                        String ConditionField,
                                        String Value)
    {
        //Open();
 
        Log.v(TAG, "----  GetCatalogValueByName----");
 
        Log.v(TAG,"---  ." + " select " + FieldFullName + " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'" );
 
        Cursor cur = mDB.rawQuery(" select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'"
                , null);
 
        Log.v(TAG, " select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'");
 
        cur.moveToFirst();
        //Close();
 
        Log.v(TAG, cur.getCount() + "");
 
        return cur;
    }
- ?
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 20:32 #19
Naomis
...
.
- .
- , "", .

Naomis
, - .

android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
.
0 0.

onClick, 119
onClick(EventActivity.java:119)
?
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 20:36  [] #20
Armagedo
?
Java
1
cMeetID = cur.getInt(cur.getColumnIndex("_id"));
Java
1
2
3
4
5
6
7
8
Log.v(TAG, "   --- if (edtMeet.getSelectedItem() != null) ---" );
                if (edtMeet.getSelectedItem() != null)
                {
                    checkMeet = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "name", edtMeet.getSelectedItem().toString());
                    cMeetID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
                }
1
Armagedo, . , .
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 20:40 #21
.

- .
, - ?

.

- .
, , , .

Java
1
cur.moveToFirst();
, ?
100 ?
1
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 20:53  [] #22
Armagedo, , ... if' . .

DB.java .
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public Cursor GetCatalogValueByName(String CatalogFullName,
                                        String FieldFullName,
                                        String ConditionField,
                                        String Value)
    {
        Cursor cur = mDB.rawQuery(" select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'"
                , null);
 
        cur.moveToFirst();
 
        Log.v(TAG, cur.getCount() + "");
 
        return cur;
    }
_id
Java
1
2
cur = db.GetCatalogValueByName("event_type", "_id", "name", edtMeet.getSelectedItem().toString());
cMeetID = cur.getInt(cur.getColumnIndex("_id"));
3
Armagedo, spinner' _id, 4- "event"
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 20:59 #23
Naomis
Armagedo, , .
, , .

-


Log.v(TAG, cur.getCount() + "");

DB__ACTIVITY﹕ 0
.. cur 0 .

Naomis
DB.java .
, , ...
, , "".
, , , , .
1
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 21:13  [] #24
Armagedo, , , ? . ...
.

. , , , - .
:
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ --- if (edtMan.getSelectedItem() != null) ---
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if ----- checkMan = true;
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if ----- checkMan = true;--
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if----- cur = db.GetCatalogValueByName(.........);
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ edtMan.getSelectedItem().toString()------
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---- GetCatalogValueByName----
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ --- . select _id from man where name = ' '
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from man where name = ' '
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if----- cur = db.GetCatalogValueByName(.........);-------
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if----- _id ---- cManID = cur.getInt(...._id")-----
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if----- _id ---- cManID = cur.getInt(...._id")-----
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ E --- if (edtET.getSelectedItem() != null) ---
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---- GetCatalogValueByName----
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ --- . select _id from event_type where name = ' '
04-09 21:09:56.419 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from event_type where name = ' '
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ --- if (edtMeet.getSelectedItem() != null) ---
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---- GetCatalogValueByName----
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ --- . select _id from meeting where name = ' '
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from meeting where name = ' '
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ 'TRUE' 'event' --- if(checkMan != false & checkET != false & checkMeet != false) ---
04-09 21:09:56.429 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ---- db.addRec("event", DB.EVENT_COLUMN_MAN, cManID ); ---
04-09 21:09:56.459 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕
04-09 21:09:56.459 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ---- db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID ); ---
04-09 21:09:56.459 17506-17506/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) table event has no column named EventTypeId
04-09 21:09:56.469 17506-17506/com.example.kirukato.coolstdreg E/SQLiteDatabase﹕ Error inserting EventTypeId=4
android.database.sqlite.SQLiteException: table event has no column named EventTypeId (code 1): , while compiling: INSERT INTO event(EventTypeId) 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:1475)
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1347)
at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:133)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:17903)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
04-09 21:09:56.469 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕
04-09 21:09:56.469 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ---- ---
04-09 21:09:56.469 17506-17506/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) table event has no column named MeetingId
04-09 21:09:56.469 17506-17506/com.example.kirukato.coolstdreg E/SQLiteDatabase﹕ Error inserting MeetingId=2
android.database.sqlite.SQLiteException: table event has no column named MeetingId (code 1): , while compiling: INSERT INTO event(MeetingId) 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:1475)
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1347)
at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:137)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:17903)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
04-09 21:09:56.469 17506-17506/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) table event has no column named Value
04-09 21:09:56.479 17506-17506/com.example.kirukato.coolstdreg E/SQLiteDatabase﹕ Error inserting Value=1
android.database.sqlite.SQLiteException: table event has no column named Value (code 1): , while compiling: INSERT INTO event(Value) 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:1475)
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1347)
at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:140)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:17903)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
04-09 21:09:56.479 17506-17506/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ---1
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 21:25 #25
׸ - ?

android.database.sqlite.SQLiteException: table event has no column named EventTypeId(code 1): , while compiling: INSERT INTO event(EventTypeId) VALUES (?)
event EventTypeId

addRec 116 DB.java

at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
1
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
10.04.2015, 18:06  [] #26
Armagedo, . . . ! , ? . . ... . .

20 20
"attempt to re-open an already-closed object" , - .

Prolog
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
04-10 17:41:05.825    2977-2977/com.example.kirukato.coolstdreg D/on pause﹕ /
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕  edtMan.getSelectedItem().toString()------
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from man where name = ' '
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-10 17:41:30.851    2977-2977/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.kirukato.coolstdreg/databases/Allreg
            at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1318)
            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1261)
            at com.example.kirukato.coolstdreg.DB.GetCatalogValueByName(DB.java:156)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:96)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
"mDB.insert(table, null, cv);" DB.java
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//    TABLE
    public void addRec(String name_table, String name_column, String txt) {
        String table = name_table;
        String column = name_column;
        ContentValues cv = new ContentValues();
        cv.put(column, txt);
        mDB.insert(table, null, cv);
    }
    // ( int)
    public void addRec(String name_table, String name_column, int txt) {
        String table = name_table;
        String column = name_column;
        ContentValues cv = new ContentValues();
        cv.put(column, txt);
        mDB.insert(table, null, cv);
    }
"db.addRec("event", "MeetingId", cMeetID );". , "db.addRec("event", "MeetingId", cMeetID );" , . ?
Java
1
2
3
4
5
6
7
8
if(checkMan != false & checkET != false & checkMeet != false){
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MAN, cManID ); ---" );
                    db.addRec("event", "ManId", cManID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MEETING, cMeetID ); ---" );
                    db.addRec("event", "MeetingId", cMeetID );
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
10.04.2015, 18:12  [] #27
.

Prolog
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
04-10 17:49:35.929    4807-4807/com.example.kirukato.coolstdreg D/OpenGLRenderer﹕ Enabling debug mode 0
04-10 17:49:48.192    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     
04-10 17:49:48.202    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ - 
04-10 17:49:48.202    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ Ĩ '' 
04-10 17:50:09.235    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-10 17:50:09.235    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-10 17:50:09.235    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-10 17:50:09.235    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕  edtMan.getSelectedItem().toString()------
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from man where name = ''
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from man where name = ''
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);-------
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    _id ---- cManID = cur.getInt(...._id")-----
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    _id ---- cManID = cur.getInt(...._id")-----
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕   E  --- if (edtET.getSelectedItem() != null) ---
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from event_type where name = ' '
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from event_type where name = ' '
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMeet.getSelectedItem() != null) ---
04-10 17:50:09.245    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-10 17:50:09.255    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from meeting where name = ' '
04-10 17:50:09.255    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from meeting where name = ' '
04-10 17:50:09.255    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-10 17:50:09.255    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    'TRUE'     'event' --- if(checkMan != false & checkET != false & checkMeet != false) ---
04-10 17:50:09.255    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    ---- db.addRec("event", DB.EVENT_COLUMN_MAN, cManID ); ---
04-10 17:50:09.305    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ 
04-10 17:50:09.305    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    ---- db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID ); ---
04-10 17:50:09.305    4807-4807/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) table event has no column named MeetingId
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg E/SQLiteDatabase﹕ Error inserting MeetingId=3
    android.database.sqlite.SQLiteException: table event has no column named MeetingId (code 1): , while compiling: INSERT INTO event(MeetingId) 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:1475)
            at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1347)
            at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:133)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ 
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    ---- db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID ); ---
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) table event has no column named EventTypeId
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg E/SQLiteDatabase﹕ Error inserting EventTypeId=2
    android.database.sqlite.SQLiteException: table event has no column named EventTypeId (code 1): , while compiling: INSERT INTO event(EventTypeId) 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:1475)
            at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1347)
            at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:137)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ 
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     ---- ---
04-10 17:50:09.315    4807-4807/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) table event has no column named Value
04-10 17:50:09.325    4807-4807/com.example.kirukato.coolstdreg E/SQLiteDatabase﹕ Error inserting Value=1
    android.database.sqlite.SQLiteException: table event has no column named Value (code 1): , while compiling: INSERT INTO event(Value) 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:1475)
            at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1347)
            at com.example.kirukato.coolstdreg.DB.addRec(DB.java:116)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:145)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
04-10 17:50:09.325    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ---1
04-10 17:51:09.359    4807-4807/com.example.kirukato.coolstdreg D/on pause﹕ /
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕  edtMan.getSelectedItem().toString()------
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from man where name = ''
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-10 17:51:35.397    4807-4807/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-10 17:51:35.407    4807-4807/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.kirukato.coolstdreg/databases/Allreg
            at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1318)
            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1261)
            at com.example.kirukato.coolstdreg.DB.GetCatalogValueByName(DB.java:156)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:96)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
04-10 17:56:35.417    4807-4807/com.example.kirukato.coolstdreg I/Process﹕ Sending signal. PID: 4807 SIG: 9
04-10 17:56:35.877    5436-5436/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libEGL_adreno.so
04-10 17:56:35.877    5436-5436/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libGLESv1_CM_adreno.so
04-10 17:56:35.897    5436-5436/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libGLESv2_adreno.so
04-10 17:56:35.897    5436-5436/com.example.kirukato.coolstdreg I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:316>: EGL 1.4
, , .
"table event has no column named MeetingId", . , . Ctrl+c Ctrl+v .
0
Rube
911 / 559 / 88
: 13.02.2014
: 2,071
10.04.2015, 20:59 #28
Java
1
2
3
4
5
6
7
public void addRec(String name_table, String name_column, int txt) { 
    String table = name_table; //  ?
    String column = name_column; // -||-
    ContentValues cv = new ContentValues(); 
    cv.put(column, txt); 
    mDB.insert(table, null, cv); 
}

Java
1
2
3
4
5
public void addRec(String name_table, String name_column, int txt) { 
    ContentValues cv = new ContentValues(); 
    cv.put(name_column, txt); 
    mDB.insert(name_table, null, cv); 
}
MeetingId , .
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
10.04.2015, 22:27  [] #29
, , .
Java
1
2
3
4
5
public void addRec(String name_table, String name_column, int txt) { 
    ContentValues cv = new ContentValues(); 
    cv.put(name_column, txt); 
    mDB.insert(name_table, null, cv); 
}
. .
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
//event
    private static final String EVENT_TABLE = "event";
    public static final String EVENT_COLUMN_ID = "_id";
    public static final String EVENT_COLUMN_MAN = "ManId";
    public static final String EVENT_COLUMN_MEETING = "MeetingId";
    public static final String EVENT_COLUMN_EVENT_TYPE = "EventTypeId";
    public static final String EVENT_COLUMN_VALUE = "Value";
 
    private static final String EVENT_DB_CREATE =
            "create table " + EVENT_TABLE + "(" +
                    EVENT_COLUMN_ID + " integer primary key autoincrement, " +
                    EVENT_COLUMN_MAN + " integer" +
                    EVENT_COLUMN_MEETING + " integer" +
                    EVENT_COLUMN_EVENT_TYPE + " integer" +
                    EVENT_COLUMN_VALUE + " integer" +
                    ");";
 
@Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL(DB_CREATE);
            db.execSQL(EVENT_TYPE_DB_CREATE);
            db.execSQL(MEETING_DB_CREATE);
            db.execSQL(EVENT_DB_CREATE);
 
        }
49
... .
Prolog
1
2
3
4
5
6
7
V/EVENT__ACTIVITY﹕    'TRUE'     'event' --- if(checkMan != false & checkET != false & checkMeet != false) ---
V/EVENT__ACTIVITY﹕    ---- db.addRec("event", DB.EVENT_COLUMN_MAN, cManID ); ---
V/EVENT__ACTIVITY﹕ 
V/EVENT__ACTIVITY﹕    ---- db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID ); ---
E/SQLiteLog﹕ (1) table event has no column named MeetingId
E/SQLiteDatabase﹕ Error inserting MeetingId=1
android.database.sqlite.SQLiteException: table event has no column named MeetingId (code 1): , while compiling: INSERT INTO event(MeetingId) VALUES (?)
:
Prolog
1
2
at com.example.kirukato.coolstdreg.DB.addRec(DB.java:112)
at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:133)
" mDB.insert(name_table, null, cv); " , DB.java
Java
1
2
3
4
5
public void addRec(String name_table, String name_column, int txt) {
        ContentValues cv = new ContentValues();
        cv.put(name_column, txt);
        mDB.insert(name_table, null, cv);
    }
" db.addRec("event", "MeetingId", cMeetID ); " , EventActivity.java, . . " db.addRec("event", "ManId", cManID );" - . "".
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//   true,      "event" 
                if(checkMan != false & checkET != false & checkMeet != false){
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MAN, cManID ); ---" );
                    db.addRec("event", "ManId", cManID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MEETING, cMeetID ); ---" );
                    db.addRec("event", "MeetingId", cMeetID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_EVENT_TYPE, cETID ); ---" );
                    db.addRec("event", "EventTypeId", cETID );
                    Log.v(TAG, "" );
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
11.04.2015, 08:06 #30
Naomis
"attempt to re-open an already-closed object" , - .
- .


Naomis, - , .
0
MoreAnswers
37091 / 29110 / 5898
: 17.06.2006
: 43,301
11.04.2015, 08:06
! :

SQLite, " " - Android
! : SQLite - &quot;&quot;, &quot;&quot;. - ...

"Hello world" "android" - Android
! - . , google.developers . ...

sqlite - Android
, . SQL WHERE = ...

, "", "", "" - Android
, ! - - &quot;_&quot;, &quot;&quot;, &quot;&quot; ...




:
30
Yandex
11.04.2015, 08:06

- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru