tanqidong1992 / sqlite4java

Automatically exported from code.google.com/p/sqlite4java
0 stars 0 forks source link

Get and set user version #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by mxmi...@gmail.com on 1 Apr 2012 at 1:45

GoogleCodeExporter commented 9 years ago
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

Original comment by ser...@gmail.com on 1 Apr 2012 at 4:04

GoogleCodeExporter commented 9 years ago
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?

Original comment by mxmi...@gmail.com on 1 Apr 2012 at 4:29

GoogleCodeExporter commented 9 years ago
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

Original comment by ser...@gmail.com on 1 Apr 2012 at 5:37

GoogleCodeExporter commented 9 years ago
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.

Original comment by mxmi...@gmail.com on 1 Apr 2012 at 5:59

GoogleCodeExporter commented 9 years ago
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

Original comment by ser...@gmail.com on 1 Apr 2012 at 6:18

GoogleCodeExporter commented 9 years ago
Nice

It works... I'm very happy now :-)

Original comment by mxmi...@gmail.com on 1 Apr 2012 at 6:39

GoogleCodeExporter commented 9 years ago
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?

Original comment by mxmi...@gmail.com on 22 Apr 2012 at 8:17