amalgalite 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/ext/sqlite3.h CHANGED
@@ -30,7 +30,7 @@
30
30
  ** the version number) and changes its name to "sqlite3.h" as
31
31
  ** part of the build process.
32
32
  **
33
- ** @(#) $Id: sqlite.h.in,v 1.412 2008/11/10 23:54:06 drh Exp $
33
+ ** @(#) $Id: sqlite.h.in,v 1.415 2008/11/19 01:20:26 drh Exp $
34
34
  */
35
35
  #ifndef _SQLITE3_H_
36
36
  #define _SQLITE3_H_
@@ -107,8 +107,8 @@ extern "C" {
107
107
  ** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z
108
108
  ** are the major version, minor version, and release number.
109
109
  */
110
- #define SQLITE_VERSION "3.6.5"
111
- #define SQLITE_VERSION_NUMBER 3006005
110
+ #define SQLITE_VERSION "3.6.6.2"
111
+ #define SQLITE_VERSION_NUMBER 3006006
112
112
 
113
113
  /*
114
114
  ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
@@ -1274,7 +1274,10 @@ struct sqlite3_mem_methods {
1274
1274
  **
1275
1275
  ** <dt>SQLITE_CONFIG_PAGECACHE</dt>
1276
1276
  ** <dd>This option specifies a static memory buffer that SQLite can use for
1277
- ** the database page cache. There are three arguments: A pointer to the
1277
+ ** the database page cache with the default page cache implemenation.
1278
+ ** This configuration should not be used if an application-define page
1279
+ ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
1280
+ ** There are three arguments to this option: A pointer to the
1278
1281
  ** memory, the size of each page buffer (sz), and the number of pages (N).
1279
1282
  ** The sz argument must be a power of two between 512 and 32768. The first
1280
1283
  ** argument should point to an allocation of at least sz*N bytes of memory.
@@ -1319,6 +1322,17 @@ struct sqlite3_mem_methods {
1319
1322
  ** size of each lookaside buffer slot and the second is the number of
1320
1323
  ** slots allocated to each database connection.</dd>
1321
1324
  **
1325
+ ** <dt>SQLITE_CONFIG_PCACHE</dt>
1326
+ ** <dd>This option takes a single argument which is a pointer to
1327
+ ** an [sqlite3_pcache_methods] object. This object specifies the interface
1328
+ ** to a custom page cache implementation. SQLite makes a copy of the
1329
+ ** object and uses it for page cache memory allocations.</dd>
1330
+ **
1331
+ ** <dt>SQLITE_CONFIG_GETPCACHE</dt>
1332
+ ** <dd>This option takes a single argument which is a pointer to an
1333
+ ** [sqlite3_pcache_methods] object. SQLite copies of the current
1334
+ ** page cache implementation into that object.</dd>
1335
+ **
1322
1336
  ** </dl>
1323
1337
  */
1324
1338
  #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -1334,6 +1348,8 @@ struct sqlite3_mem_methods {
1334
1348
  #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
1335
1349
  /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
1336
1350
  #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
1351
+ #define SQLITE_CONFIG_PCACHE 14 /* sqlite3_pcache_methods* */
1352
+ #define SQLITE_CONFIG_GETPCACHE 15 /* sqlite3_pcache_methods* */
1337
1353
 
1338
1354
  /*
1339
1355
  ** CAPI3REF: Configuration Options {H10170} <S20000>
@@ -6555,6 +6571,149 @@ SQLITE_EXPERIMENTAL int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
6555
6571
  #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1
6556
6572
  #define SQLITE_STMTSTATUS_SORT 2
6557
6573
 
6574
+ /*
6575
+ ** CAPI3REF: Custom Page Cache Object
6576
+ ** EXPERIMENTAL
6577
+ **
6578
+ ** The sqlite3_pcache type is opaque. It is implemented by
6579
+ ** the pluggable module. The SQLite core has no knowledge of
6580
+ ** its size or internal structure and never deals with the
6581
+ ** sqlite3_pcache object except by holding and passing pointers
6582
+ ** to the object.
6583
+ **
6584
+ ** See [sqlite3_pcache_methods] for additional information.
6585
+ */
6586
+ typedef struct sqlite3_pcache sqlite3_pcache;
6587
+
6588
+ /*
6589
+ ** CAPI3REF: Application Defined Page Cache.
6590
+ ** EXPERIMENTAL
6591
+ **
6592
+ ** The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can
6593
+ ** register an alternative page cache implementation by passing in an
6594
+ ** instance of the sqlite3_pcache_methods structure. The majority of the
6595
+ ** heap memory used by sqlite is used by the page cache to cache data read
6596
+ ** from, or ready to be written to, the database file. By implementing a
6597
+ ** custom page cache using this API, an application can control more
6598
+ ** precisely the amount of memory consumed by sqlite, the way in which
6599
+ ** said memory is allocated and released, and the policies used to
6600
+ ** determine exactly which parts of a database file are cached and for
6601
+ ** how long.
6602
+ **
6603
+ ** The contents of the structure are copied to an internal buffer by sqlite
6604
+ ** within the call to [sqlite3_config].
6605
+ **
6606
+ ** The xInit() method is called once for each call to [sqlite3_initialize()]
6607
+ ** (usually only once during the lifetime of the process). It is passed
6608
+ ** a copy of the sqlite3_pcache_methods.pArg value. It can be used to set
6609
+ ** up global structures and mutexes required by the custom page cache
6610
+ ** implementation. The xShutdown() method is called from within
6611
+ ** [sqlite3_shutdown()], if the application invokes this API. It can be used
6612
+ ** to clean up any outstanding resources before process shutdown, if required.
6613
+ **
6614
+ ** The xCreate() method is used to construct a new cache instance. The
6615
+ ** first parameter, szPage, is the size in bytes of the pages that must
6616
+ ** be allocated by the cache. szPage will not be a power of two. The
6617
+ ** second argument, bPurgeable, is true if the cache being created will
6618
+ ** be used to cache database pages read from a file stored on disk, or
6619
+ ** false if it is used for an in-memory database. The cache implementation
6620
+ ** does not have to do anything special based on the value of bPurgeable,
6621
+ ** it is purely advisory.
6622
+ **
6623
+ ** The xCachesize() method may be called at any time by SQLite to set the
6624
+ ** suggested maximum cache-size (number of pages stored by) the cache
6625
+ ** instance passed as the first argument. This is the value configured using
6626
+ ** the SQLite "[PRAGMA cache_size]" command. As with the bPurgeable parameter,
6627
+ ** the implementation is not required to do anything special with this
6628
+ ** value, it is advisory only.
6629
+ **
6630
+ ** The xPagecount() method should return the number of pages currently
6631
+ ** stored in the cache supplied as an argument.
6632
+ **
6633
+ ** The xFetch() method is used to fetch a page and return a pointer to it.
6634
+ ** A 'page', in this context, is a buffer of szPage bytes aligned at an
6635
+ ** 8-byte boundary. The page to be fetched is determined by the key. The
6636
+ ** mimimum key value is 1. After it has been retrieved using xFetch, the page
6637
+ ** is considered to be pinned.
6638
+ **
6639
+ ** If the requested page is already in the page cache, then a pointer to
6640
+ ** the cached buffer should be returned with its contents intact. If the
6641
+ ** page is not already in the cache, then the expected behaviour of the
6642
+ ** cache is determined by the value of the createFlag parameter passed
6643
+ ** to xFetch, according to the following table:
6644
+ **
6645
+ ** <table border=1 width=85% align=center>
6646
+ ** <tr><th>createFlag<th>Expected Behaviour
6647
+ ** <tr><td>0<td>NULL should be returned. No new cache entry is created.
6648
+ ** <tr><td>1<td>If createFlag is set to 1, this indicates that
6649
+ ** SQLite is holding pinned pages that can be unpinned
6650
+ ** by writing their contents to the database file (a
6651
+ ** relatively expensive operation). In this situation the
6652
+ ** cache implementation has two choices: it can return NULL,
6653
+ ** in which case SQLite will attempt to unpin one or more
6654
+ ** pages before re-requesting the same page, or it can
6655
+ ** allocate a new page and return a pointer to it. If a new
6656
+ ** page is allocated, then it must be completely zeroed before
6657
+ ** it is returned.
6658
+ ** <tr><td>2<td>If createFlag is set to 2, then SQLite is not holding any
6659
+ ** pinned pages associated with the specific cache passed
6660
+ ** as the first argument to xFetch() that can be unpinned. The
6661
+ ** cache implementation should attempt to allocate a new
6662
+ ** cache entry and return a pointer to it. Again, the new
6663
+ ** page should be zeroed before it is returned. If the xFetch()
6664
+ ** method returns NULL when createFlag==2, SQLite assumes that
6665
+ ** a memory allocation failed and returns SQLITE_NOMEM to the
6666
+ ** user.
6667
+ ** </table>
6668
+ **
6669
+ ** xUnpin() is called by SQLite with a pointer to a currently pinned page
6670
+ ** as its second argument. If the third parameter, discard, is non-zero,
6671
+ ** then the page should be evicted from the cache. In this case SQLite
6672
+ ** assumes that the next time the page is retrieved from the cache using
6673
+ ** the xFetch() method, it will be zeroed. If the discard parameter is
6674
+ ** zero, then the page is considered to be unpinned. The cache implementation
6675
+ ** may choose to reclaim (free or recycle) unpinned pages at any time.
6676
+ ** SQLite assumes that next time the page is retrieved from the cache
6677
+ ** it will either be zeroed, or contain the same data that it did when it
6678
+ ** was unpinned.
6679
+ **
6680
+ ** The cache is not required to perform any reference counting. A single
6681
+ ** call to xUnpin() unpins the page regardless of the number of prior calls
6682
+ ** to xFetch().
6683
+ **
6684
+ ** The xRekey() method is used to change the key value associated with the
6685
+ ** page passed as the second argument from oldKey to newKey. If the cache
6686
+ ** previously contains an entry associated with newKey, it should be
6687
+ ** discarded. Any prior cache entry associated with newKey is guaranteed not
6688
+ ** to be pinned.
6689
+ **
6690
+ ** When SQLite calls the xTruncate() method, the cache must discard all
6691
+ ** existing cache entries with page numbers (keys) greater than or equal
6692
+ ** to the value of the iLimit parameter passed to xTruncate(). If any
6693
+ ** of these pages are pinned, they are implicitly unpinned, meaning that
6694
+ ** they can be safely discarded.
6695
+ **
6696
+ ** The xDestroy() method is used to delete a cache allocated by xCreate().
6697
+ ** All resources associated with the specified cache should be freed. After
6698
+ ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
6699
+ ** handle invalid, and will not use it with any other sqlite3_pcache_methods
6700
+ ** functions.
6701
+ */
6702
+ typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
6703
+ struct sqlite3_pcache_methods {
6704
+ void *pArg;
6705
+ int (*xInit)(void*);
6706
+ void (*xShutdown)(void*);
6707
+ sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
6708
+ void (*xCachesize)(sqlite3_pcache*, int nCachesize);
6709
+ int (*xPagecount)(sqlite3_pcache*);
6710
+ void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
6711
+ void (*xUnpin)(sqlite3_pcache*, void*, int discard);
6712
+ void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
6713
+ void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
6714
+ void (*xDestroy)(sqlite3_pcache*);
6715
+ };
6716
+
6558
6717
  /*
6559
6718
  ** Undo the hack that converts floating point types to integer for
6560
6719
  ** builds on processors without floating point support.
@@ -9,7 +9,7 @@ module Amalgalite
9
9
 
10
10
  MAJOR = 0
11
11
  MINOR = 5
12
- BUILD = 0
12
+ BUILD = 1
13
13
 
14
14
  #
15
15
  # return the Version as an array of MAJOR, MINOR, BUILD
@@ -5,10 +5,10 @@ describe "Amalgalite::SQLite3::Version" do
5
5
  it "should have the sqlite3 version" do
6
6
  Amalgalite::SQLite3::VERSION.should =~ /\d\.\d\.\d/
7
7
  Amalgalite::SQLite3::Version.to_s.should =~ /\d\.\d\.\d/
8
- Amalgalite::SQLite3::Version.to_i.should == 3006005
8
+ Amalgalite::SQLite3::Version.to_i.should == 3006006
9
9
  Amalgalite::SQLite3::Version::MAJOR.should == 3
10
10
  Amalgalite::SQLite3::Version::MINOR.should == 6
11
- Amalgalite::SQLite3::Version::RELEASE.should == 5
11
+ Amalgalite::SQLite3::Version::RELEASE.should == 6
12
12
  Amalgalite::SQLite3::Version.to_a.should have(3).items
13
13
  end
14
14
  end
data/tasks/extension.rake CHANGED
@@ -9,7 +9,21 @@ require 'archive/tar/minitar'
9
9
 
10
10
  if ext_config = Configuration.for_if_exist?('extension') then
11
11
  namespace :ext do
12
- desc "Build the extension(s)"
12
+ def current_sqlite_version
13
+ ext = Configuration.for('extension').configs.first
14
+ path = Pathname.new( ext )
15
+ h_path = path.dirname.realpath + "sqlite3.h"
16
+ File.open( h_path ) do |f|
17
+ f.each_line do |line|
18
+ if line =~ /\A#define SQLITE_VERSION\s+/ then
19
+ define ,constant ,value = line.split
20
+ return value
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ desc "Build the SQLite extension version #{current_sqlite_version}"
13
27
  task :build do
14
28
  ext_config.configs.each do |extension|
15
29
  path = Pathname.new(extension)
@@ -67,7 +81,7 @@ if ext_config = Configuration.for_if_exist?('extension') then
67
81
  end
68
82
  end
69
83
 
70
- desc "Download and integrate the next version of sqlite"
84
+ desc "Download and integrate the next version of sqlite (use VERSION=x.y.z)"
71
85
  task :update_sqlite do
72
86
  next_version = ENV['VERSION']
73
87
  raise "VERSION env variable must be set" unless next_version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amalgalite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-17 00:00:00 -07:00
12
+ date: 2008-11-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency