android studio的firebase无法存储所有数据

时间:2020-06-04 12:11:52

标签: android sql json firebase firebase-realtime-database

我将所有数据存储到Firebase时遇到问题。我有一个使用类,成员作为数据来存储数据的功能。

我将数据写入firebase,它存储数据,但仅约占我要存储的数据的1/2。我有一个由SQL数据游标提供的数据日志,我创建了一个抽象的游标窗口。

然后循环循环并存储所有条目。它仅在上半年存储。但是,数据存储变量在完成时是正确的,这意味着它已成功循环通过我的数据库

因此,我存储到Firebase时出了点问题。

我要将 172155 值存储到Firebase。完成大容量存储功能后,我的数据存储变量确实等于此变量,但是当我提取数据时,其变量仅限于 81789 条目。我已经检查过json了,那就是那里的所有数据。

我的问题是我应该如何正确存储这些数据。如果我尝试存储较少的数据,那么它可以工作,但是我需要能够存储这种大小的数据。

为什么这不起作用? mDatareff_User.child(valueOf(i)).setValue(member);

我的编写代码如下:

private void Mass_store_to_firebase() {
        Cursor data;
        data = BLE_DB.showData_Filtered_Log();
        data.moveToFirst();
        data_stored = 0;
        if (data.getCount() == 0) {
            Utils.toast(getApplicationContext(), "No data selected");
        }
        if (data.getCount() != 0) {
                //Cursor window fix and get data
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
                CursorWindow cw = new CursorWindow("mass_store", 536870912);//16777216 broke
                AbstractWindowedCursor ac = (AbstractWindowedCursor) data;
                ac.setWindow(cw);
                ac.moveToFirst();//0

                if (ac.getCount() == 0)//No data selected
                {
                    Utils.toast(getApplicationContext(), "No data selected");
                }
                for (int i = 0; i < ac.getCount(); i++) {
                    member.setT1_Data_string(ac.getString(1));//T1
                    member.setT2_Data_string(ac.getString(2));//T2
                    member.setT3_Data_string(ac.getString(4));//T3
                    member.setT4_Data_string(ac.getString(5));//T4
                    member.setPdiff_Data_string(ac.getString(6));//P1 data
                    member.setTime_string(ac.getString(7));

                    //Userdata_number_of_data = Userdata_number_of_data + 1;
                    //mDatareff_User.child(valueOf(Userdata_number_of_data)).setValue(member);//Increment max id count
                    mDatareff_User.child(valueOf(i)).setValue(member);//Use i to set the data.
                    data_stored++;
                    ac.moveToNext();
                }
                ac.close();
            }
            Log.d(TAG, "Stored mass data");//Log the event
            Utils.toast(getApplicationContext(), "Stored mass data");//Inform the user
        }
    }

logcat的片段

2020-06-04 14:52:44.128 8113-8223/com.example.firebase D/EventRaiser: Raising 2 event(s)
2020-06-04 14:52:44.129 8113-8223/com.example.firebase D/Connection: conn_0 - Sending data: {t=d, d={a=p, r=54242, b={p=D3:68:62:99:90:C3/54238, d={t4_Data_string=2268, t2_Data_string=2268, t3_Data_string=2268, t1_Data_string=2268, pdiff_Data_string=-0.020000, time_string=2020-05-30 01:27:22 GMT}}}}
2020-06-04 14:52:44.129 8113-8224/com.example.firebase D/WebSocket: ws_0 - ws message: {"t":"d","d":{"b":{"p":"D3:68:62:99:90:C3/54235","d":{"pdiff_Data_string":"-0.020000","t1_Data_string":"2268","t2_Data_string":"2268","t3_Data_string":"2268","t4_Data_string":"2268","time_string":"2020-05-30 01:27:19 GMT"}},"a":"d"}}
2020-06-04 14:52:44.129 8113-8223/com.example.firebase D/WebSocket: ws_0 - Reset keepAlive. Remaining: 42807
2020-06-04 14:52:44.130 8113-8223/com.example.firebase D/RepoOperation: Aborting transactions for path: /D3:68:62:99:90:C3/54238. Affected: /D3:68:62:99:90:C3/54238
2020-06-04 14:52:44.130 8113-8223/com.example.firebase D/RepoOperation: set: /D3:68:62:99:90:C3/54239
2020-06-04 14:52:44.130 8113-8223/com.example.firebase D/DataOperation: set: /D3:68:62:99:90:C3/54239 {
      pdiff_Data_string=-0.010
      t1_Data_string=2268
      t2_Data_string=2268
      t3_Data_string=2268
      t4_Data_string=2268
      time_string=2020-05-30 01:27:23 GMT
    }
2020-06-04 14:52:44.130 8113-8224/com.example.firebase D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":54239,"b":{"s":"ok","d":""}}}
2020-06-04 14:52:44.131 8113-8223/com.example.firebase D/EventRaiser: Raising 2 event(s)
2020-06-04 14:52:44.131 8113-8224/com.example.firebase D/WebSocket: ws_0 - ws message: {"t":"d","d":{"b":{"p":"D3:68:62:99:90:C3/54236","d":{"pdiff_Data_string":"-0.020000","t1_Data_string":"2268","t2_Data_string":"2268","t3_Data_string":"2268","t4_Data_string":"2268","time_string":"2020-05-30 01:27:20 GMT"}},"a":"d"}}
2020-06-04 14:52:44.131 8113-8224/com.example.firebase D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":54240,"b":{"s":"ok","d":""}}}
2020-06-04 14:52:44.131 8113-8224/com.example.firebase D/WebSocket: ws_0 - ws message: {"t":"d","d":{"b":{"p":"D3:68:62:99:90:C3/54237","d":{"pdiff_Data_string":"-0.020000","t1_Data_string":"2268","t2_Data_string":"2268","t3_Data_string":"2268","t4_Data_string":"2268","time_string":"2020-05-30 01:27:21 GMT"}},"a":"d"}}
2020-06-04 14:52:44.131 8113-8224/com.example.firebase D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":54241,"b":{"s":"ok","d":""}}}
2020-06-04 14:52:44.137 8113-8223/com.example.firebase D/Connection: conn_0 - Sending data: {t=d, d={a=p, r=54243, b={p=D3:68:62:99:90:C3/54239, d={t4_Data_string=2268, t2_Data_string=2268, t3_Data_string=2268, t1_Data_string=2268, pdiff_Data_string=-0.010, time_string=2020-05-30 01:27:23 GMT}}}}
2020-06-04 14:52:44.137 8113-8223/com.example.firebase D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44992
2020-06-04 14:52:44.137 8113-8223/com.example.firebase D/RepoOperation: Aborting transactions for path: /D3:68:62:99:90:C3/54239. Affected: /D3:68:62:99:90:C3/54239
2020-06-04 14:52:44.137 8113-8223/com.example.firebase D/RepoOperation: set: /D3:68:62:99:90:C3/54240
2020-06-04 14:52:44.137 8113-8223/com.example.firebase D/DataOperation: set: /D3:68:62:99:90:C3/54240 {

0 个答案:

没有答案