App Crashes Without Any Changes Done
Solution 1:
The cause of this exception is that you have something other then ?? INTEGER PRIMARY KEY AUTOINCREMENT
for a column when creating the table.
More specifically you have :-
createtable Lehrer_table(ID_LINTEGER PRIMARY KEY AUTOINCREMENT,LEHRERNAMETEXT,LEHRERKUERZELTEXT,LEHRERRAUMTEXT,LEHRERMAILTEXT)
This should likely be :-
createtable Lehrer_table(ID_L INTEGERPRIMARY KEY AUTOINCREMENT,LEHRERNAMETEXT,LEHRERKUERZELTEXT,LEHRERRAUMTEXT,LEHRERMAILTEXT)
i.e. a space has been added between ID_L
and INTEGER
so ID_LINTEGER
becomes ID_L INTEGER
.
Saying that you using AUTOINCREMENT
is very likely unnecessary and detrimental as it consumes more resources.
All that AUTOINCREMENT
does is ensure that the next id will be greater than the previous (it very likely will be anyway until you reached 9223372036854775807 rows). Should that number be reached with AUTOINCREMENT
you would then not be able to insert rows as an insert would have an SQLITE_FULL exception. Whilst, there is a chance that without AUTOINCREMENT
that a now unused id will be assigned.
To quote the SQLIte documentation :-
The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed.
In SQLite, a column with type INTEGER PRIMARY KEY is an alias for the ROWID (except in WITHOUT ROWID tables) which is always a 64-bit signed integer.
On an INSERT, if the ROWID or INTEGER PRIMARY KEY column is not explicitly given a value, then it will be filled automatically with an unused integer, usually one more than the largest ROWID currently in use. This is true regardless of whether or not the AUTOINCREMENT keyword is used.
If the AUTOINCREMENT keyword appears after INTEGER PRIMARY KEY, that changes the automatic ROWID assignment algorithm to prevent the reuse of ROWIDs over the lifetime of the database. In other words, the purpose of AUTOINCREMENT is to prevent the reuse of ROWIDs from previously deleted rows.
As such I'd suggest using :-
createtable Lehrer_table(ID_L INTEGERPRIMARY KEY,LEHRERNAMETEXT,LEHRERKUERZELTEXT,LEHRERRAUMTEXT,LEHRERMAILTEXT)
Post a Comment for "App Crashes Without Any Changes Done"