Get and set user version
Originally reported on Google Code with ID 43 ``` I need to work with sqlite database from android. I'm able to get data from the database.I need to use user version in someway with sqlite4java
Is there any way to set and get userversion?
Best Regards Mikael Andersson ```
Reported by `mxmicke` on 2012-04-01 13:45:43
Comments (7)
-
-
Account Deleted ``` Hi,
I'm using as a version control of my data and upgrading to newer version. It's very commen in Android programming when the user as installed a program from the "Play Market".
I have made a small program on Android and able to transport the database out. My new software will be able to edit all data in Windows and transport it back to Android.
My missing command below
db.getVersion(); ...
db.setVersion(NewVersion);
Maybe we allready have it :-) Could it be implemented if not? ```
Reported by `mxmicke` on 2012-04-01 16:29:12
-
``` Mikael, SQLite is a generic SQL-based database, and sqlite4java is a wrapper for it. So unless what you ask is something SQLite can already do, it is out of scope.
If you need to store a value in your database, you should create a table, set data with INSERT or UPDATE and retrieve it with SELECT.
Good luck! Igor ```
Reported by `sereda` on 2012-04-01 17:37:31 - Status changed: `Invalid`
-
Account Deleted ``` Hello Again,
Sure I could make my own table but it's not what I'm asking for. If you know the structure for the database you could also get this version of the database. It's not stored as a table from Android device.
I'm sure you will have the question from other users also.
Sorry to give you headace.. but I also have it. ```
Reported by `mxmicke` on 2012-04-01 17:59:50
-
``` Don't worry, you're not giving me a headache :)
I got it - you're talking about PRAGMA user_version. There's no need for extra support for this pragma from sqlite4java - you can read and write it with standard SQL.
See http://sqlite.org/pragma.html#pragma_user_version ```
Reported by `sereda` on 2012-04-01 18:18:53
-
Account Deleted ``` Nice
It works... I'm very happy now :-) ```
Reported by `mxmicke` on 2012-04-01 18:39:25
-
Account Deleted ``` Hi Again,
Maybe you can help me again
For loading back old databases, works fine now.
Now I would like to create a total new database... not existing.
I use this line SQLiteDB db = SQLiteDB.getInstance("c:/database.db");
but I got this error
apr 22, 2012 10:06:37 FM com.almworks.sqlite4java.Internal log Info: [sqlite] DB[1]: instantiated [c:\database.db] apr 22, 2012 10:06:38 FM com.almworks.sqlite4java.Internal log Info: [sqlite] Internal: loaded sqlite4java-win32-x64 from system path apr 22, 2012 10:06:38 FM com.almworks.sqlite4java.Internal log Info: [sqlite] Internal: loaded sqlite 3.7.10, wrapper 0.2 Instantiation SQLiteException: [14] unable to open database file
I think it should create a new database, but I got a error instead.
Do you know how to solve? ```
Reported by `mxmicke` on 2012-04-22 08:17:30
- Log in to comment
``` Mikael, I don't understand your request, sorry. Please describe in more detail what is "user version". In particular, how do you work with it using SQLite API (http://sqlite.org)
Kind regards, Igor ```
Reported by `sereda` on 2012-04-01 16:04:56 - Labels added: Type-Other - Labels removed: Type-Defect