Version of the database

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Version of the database

Cecil Westerhof-5
I know how to get the version of the running version of SQLite, but is
there a way to get the version with which the database was created?

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Simon Slavin-3

On 5 May 2016, at 5:15pm, Cecil Westerhof <[hidden email]> wrote:

> I know how to get the version of the running version of SQLite, but is
> there a way to get the version with which the database was created?

Unfortunately I do not think this information is stored anywhere.

One often finds three version numbers stored:

A) The version of the engine which was used to create the file.
B) The earliest version of the engine which has made changes to the file.
C) The latest version of the engine which has made changes to the file.

I don't think SQLite stores any of these.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Cecil Westerhof-5
In reply to this post by Cecil Westerhof-5
2016-05-05 18:15 GMT+02:00 Cecil Westerhof <[hidden email]>:

>
> I know how to get the version of the running version of SQLite, but is
> there a way to get the version with which the database was created?
>

​With the command line program I can get it with:
    .dbinfo
one of the things it gives is:
    software version:    3008010
so it is 3.8.10,but would it also be possible to get in my Java program?

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Cecil Westerhof-5
In reply to this post by Simon Slavin-3
2016-05-05 18:19 GMT+02:00 Simon Slavin <[hidden email]>:

>
> On 5 May 2016, at 5:15pm, Cecil Westerhof <[hidden email]> wrote:
>
> > I know how to get the version of the running version of SQLite, but is
> > there a way to get the version with which the database was created?
>
> Unfortunately I do not think this information is stored anywhere.
>
> One often finds three version numbers stored:
>
> A) The version of the engine which was used to create the file.
> B) The earliest version of the engine which has made changes to the file.
> C) The latest version of the engine which has made changes to the file.
>
> I don't think SQLite stores any of these.
>

​Aah, OK. So the info I get with .dbinfo is about the program, not the file?



​At the moment I do not need the information. But I always like to be
prepared. ;-)

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Simon Slavin-3
In reply to this post by Cecil Westerhof-5

On 5 May 2016, at 5:22pm, Cecil Westerhof <[hidden email]> wrote:

> ​With the command line program I can get it with:
>    .dbinfo
> one of the things it gives is:
>    software version:    3008010

I don't know if this is from something stored in the file.  My guess is that it's more likely to be the version of SQLite in the shell tool you're using, using one of these:

SQLITE_EXTERN const char sqlite3_version[] :

<https://www.sqlite.org/c3ref/libversion.html>

the "sqlite_version()" function:

<https://www.sqlite.org/lang_corefunc.html>

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Richard Hipp-3
In reply to this post by Simon Slavin-3
On 5/5/16, Simon Slavin <[hidden email]> wrote:

>
> On 5 May 2016, at 5:15pm, Cecil Westerhof <[hidden email]> wrote:
>
>> I know how to get the version of the running version of SQLite, but is
>> there a way to get the version with which the database was created?
>
> One often finds three version numbers stored:
>
> A) The version of the engine which was used to create the file.
> B) The earliest version of the engine which has made changes to the file.
> C) The latest version of the engine which has made changes to the file.
>
> I don't think SQLite stores any of these.

SQLite stores the version number of the last writer in the database
header.  There is no PRAGMA to retrieve this, but you can see it by
running the ".dbinfo" command in the shell.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Simon Slavin-3

On 5 May 2016, at 5:38pm, Richard Hipp <[hidden email]> wrote:

> There is no PRAGMA to retrieve this, but you can see it by
> running the ".dbinfo" command in the shell.

I was wrong.  Believe Richard, not me.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

R Smith
In reply to this post by Cecil Westerhof-5
The file header contains the SQLite version that most recently modified
the schema. You can see this using the cli, but not a pragma.

If you are willing to dig a bit, you can retrieve it by reading the
first 100 bytes or so from the file and examining the 4 bytes at offset
96. It's a big-endian 32-bit integer containing the version, and also
another 32-bit integer (4-byte) value just prior at offset 92 is a
counter of how many changes were made since using that library version.
Together these can be quite useful information.

The Integer value of the version would be a number like this: 3012034 -
starting with a 3 always for SQLite3 and then the next 3 digits the
minor version (12 in the example) and the last 3 the release (34 in the
example).

For more information on values stored in the header - see here:
https://www.sqlite.org/fileformat2.html#database_header

Cheers,
Ryan


On 2016/05/05 6:22 PM, Cecil Westerhof wrote:

> 2016-05-05 18:15 GMT+02:00 Cecil Westerhof <[hidden email]>:
>
>> I know how to get the version of the running version of SQLite, but is
>> there a way to get the version with which the database was created?
>>
> ​With the command line program I can get it with:
>      .dbinfo
> one of the things it gives is:
>      software version:    3008010
> so it is 3.8.10,but would it also be possible to get in my Java program?
>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

John Gillespie-2
I don't see  the '.dbinfo' command in the shell in the version supplied
with MacOS X 10.10 (Yosemite) - 3.8.8.3.
Was this introduced after this.
I know Apple is a bit slow in updating, but I can't use a personally
compiled verion.
John G



On 5 May 2016 at 23:42, R Smith <[hidden email]> wrote:

> The file header contains the SQLite version that most recently modified
> the schema. You can see this using the cli, but not a pragma.
>
> If you are willing to dig a bit, you can retrieve it by reading the first
> 100 bytes or so from the file and examining the 4 bytes at offset 96. It's
> a big-endian 32-bit integer containing the version, and also another 32-bit
> integer (4-byte) value just prior at offset 92 is a counter of how many
> changes were made since using that library version. Together these can be
> quite useful information.
>
> The Integer value of the version would be a number like this: 3012034 -
> starting with a 3 always for SQLite3 and then the next 3 digits the minor
> version (12 in the example) and the last 3 the release (34 in the example).
>
> For more information on values stored in the header - see here:
> https://www.sqlite.org/fileformat2.html#database_header
>
> Cheers,
> Ryan
>
>
> On 2016/05/05 6:22 PM, Cecil Westerhof wrote:
>
>> 2016-05-05 18:15 GMT+02:00 Cecil Westerhof <[hidden email]>:
>>
>> I know how to get the version of the running version of SQLite, but is
>>> there a way to get the version with which the database was created?
>>>
>>> ​With the command line program I can get it with:
>>      .dbinfo
>> one of the things it gives is:
>>      software version:    3008010
>> so it is 3.8.10,but would it also be possible to get in my Java program?
>>
>>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Simon Slavin-3

On 26 May 2016, at 5:31pm, John G <[hidden email]> wrote:

> Was this introduced after this.

Yes, it's a very recent new thing.

> I know Apple is a bit slow in updating, but I can't use a personally
> compiled verion.

Download the precompiled version from the "Precompiled Binaries" section on the download page.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Version of the database

Richard Hipp-3
In reply to this post by John Gillespie-2
On 5/26/16, John G <[hidden email]> wrote:
> I don't see  the '.dbinfo' command in the shell in the version supplied
> with MacOS X 10.10 (Yosemite) - 3.8.8.3.
> Was this introduced after this.

Added in 3.8.9 (2015-04-08)


--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users