IDbConnection dbConnection = new SqliteConnection(GetDBFilePath())
dbConnection.Open();
IDbCommand dbCommand = dbConnection.CreateCommand();
dbCommand.CommandText = "select count(*) from dataTable";
IDataReader dbReader = dbCommand.ExecuteReader();
dbReader.Read();
I'm using sqlite3 at unity. There are more than 1,000,000 columns on the table. I want to select the db.
This is where the problem arises. If the number of columns to be inquired is too large, "ExecuteReader" will not be executed.
SqliteException: Some kind of disk I/O error occurred
disk I/O error
at Mono.Data.Sqlite.SQLite3.Reset (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <00000000000000000000000000000000>:0
at Mono.Data.Sqlite.SQLite3.Step (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <00000000000000000000000000000000>:0
at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x00000] in <00000000000000000000000000000000>:0
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00000] in <00000000000000000000000000000000>:0
at DBAccess <DatabaseRead>d__24.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
<DatabaseRead>d__24:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
For example, in the window, more numbers could be executed. Android runs less than Windows.
Is there any way to lift the restriction on the number of columns to be included in IDataReader?
CodePudding user response:
Sqlite is a kind of "In-memory databases", so your android device memory size may limit the db size you can read.
According to Limits In SQLite ,
The default setting for SQLITE_MAX_COLUMN is 2000. You can change it at compile time to values as large as 32767. On the other hand, many experienced database designers will argue that a well-normalized database will never need more than 100 columns in a table.
you should not save huge data in single table.