changeset 21:a2ad87cad48b

Enhanced the convenience of Cache dialog.
author pyon@macmini
date Wed, 17 Dec 2014 00:52:43 +0900
parents 226774bf49fc
children 92188f60323d
files Changes include/about.h include/cache.h include/db.h include/hhsdb.h include/miniframe.h include/myframe.h include/sqlite3.h src/about.cpp src/bprint.cpp src/cache.cpp src/db.cpp src/hhsdb.cpp src/kana.cpp src/miniframe.cpp src/myframe.cpp src/wxsqlite3.cpp
diffstat 17 files changed, 1218 insertions(+), 240 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Mon Dec 08 19:47:42 2014 +0900
+++ b/Changes	Wed Dec 17 00:52:43 2014 +0900
@@ -1,3 +1,9 @@
+version 03.24
+2014-12-14
+ Enhanced the convenience of Cache dialog.
+ Updated Libraries.
+
+----
 version 03.23
 2014-12-08
  Small fix.
@@ -15,7 +21,7 @@
 ----
 version 03.20
 2014-08-12
- Print HHSNo on marksheet.
+ Implement printing HHSNo on marksheet.
 
 ----
 version 03.19
--- a/include/about.h	Mon Dec 08 19:47:42 2014 +0900
+++ b/include/about.h	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : about.h
-// Last Change: 21-Jul-2013.
+// Last Change: 11-Dec-2014.
 //
 #ifndef __ABOUT_H__
 #define __ABOUT_H__
@@ -15,6 +15,7 @@
 		wxStaticText*   m_staticTextDesc;
 		wxButton*       m_buttonOK;
 		wxRichTextCtrl* m_richText;
+		wxStaticText*   m_staticTextBuild;
 	
 	public:
 		AboutDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ); 
--- a/include/cache.h	Mon Dec 08 19:47:42 2014 +0900
+++ b/include/cache.h	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : cache.h
-// Last Change: 02-May-2014.
+// Last Change: 12-Dec-2014.
 //
 
 #ifndef __CACHE_H__
@@ -7,34 +7,63 @@
 
 #include "common.h"
 
+//
+class CacheGetDialog : public wxDialog 
+{
+    DECLARE_EVENT_TABLE()
+	private:
+        wxArrayString    m_nocache;
+	
+	protected:
+		wxDirPickerCtrl* m_dirPicker;
+		wxButton*        m_buttonGet;
+		wxButton*        m_buttonCancel;
+	
+	public:
+		CacheGetDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style );
+		~CacheGetDialog();
+        void OnGetCache( wxCommandEvent& WXUNUSED(event) );	
+        void SetSyncDates( wxArrayString );	
+};
 
+//
 class CacheDialog : public wxDialog 
 {
     DECLARE_EVENT_TABLE()
 	private:
-        wxString    m_rootdir;
-        int         m_width, m_height;
+        wxString      m_rootdir;
+        wxArrayString nocache;
+        int           m_width, m_height;
 	
 	protected:
+		wxStaticText*     m_staticText;
+		wxListCtrl*       m_listCtrl;
+		wxStaticText*     m_staticTextRange;
+		wxStaticText*     m_staticTextBetween;
 		wxDatePickerCtrl* m_datePickerBgn;
 		wxDatePickerCtrl* m_datePickerEnd;
-		wxButton*         m_buttonMake;
+		wxButton*         m_buttonCache;
+		wxButton*         m_buttonGet;
 		wxButton*         m_buttonClose;
 	
 	public:
 		CacheDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ); 
 		~CacheDialog();
         void Setting( wxString rootdir, int w, int h );
+        void Listup( void );
+        void OnDateChange( wxDateEvent& WXUNUSED(event) );
+        void OnGetCache( wxCommandEvent& WXUNUSED(event) );
         void OnMakeCache( wxCommandEvent& WXUNUSED(event) );
-        void MakeCache( wxString begin, wxString end );
-        void OnClose( wxCommandEvent& WXUNUSED(event) );
+};
+
+enum
+{
+    ID_RGBGN = wxID_HIGHEST + 660,
+    ID_RGEND,
+    ID_MKCACHE,
+    ID_GET,
+    ID_GETCACHE,
 };
 
 #endif //__CACHE_H__
 
-enum
-{
-    ID_MKCACHE = wxID_HIGHEST + 660,
-    ID_CLOSE,
-};
-
--- a/include/db.h	Mon Dec 08 19:47:42 2014 +0900
+++ b/include/db.h	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : db.h
-// Last Change: 21-May-2014.
+// Last Change: 12-Dec-2014.
 //
 #ifndef __DB_H__
 #define __DB_H__
@@ -28,8 +28,10 @@
 wxArrayString GetCcnByDate( wxString date );
 // 合議体から被保険者番号を取得
 wxArrayString GetHhsNoByCcn( wxString ccn, wxString date );
-// 範囲日時のパスを取得
-wxArrayString GetPathes( wxString from, wxString to );
+// 指定した範囲の日付のパスを取得
+wxArrayString GetPathesByPeriod( wxString from, wxString to );
+// 指定日のパスを取得
+wxArrayString GetPathesByDate( wxString date );
 // インデックスを更新
 void UpdateIndex( wxString datadir, wxString date );
 // DBの整合性をチェック
--- a/include/hhsdb.h	Mon Dec 08 19:47:42 2014 +0900
+++ b/include/hhsdb.h	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : hhsdb.h
-// Last Change: 21-May-2014.
+// Last Change: 12-Dec-2014.
 //
 
 #ifndef __HHSDB_H__
@@ -25,8 +25,7 @@
 
 enum
 {
-    ID_FPICKR = wxID_HIGHEST + 130,
-    ID_UPDATE,
+    ID_UPDATE = wxID_HIGHEST + 130,
 };
 
 #endif //__HHSDB_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/miniframe.h	Wed Dec 17 00:52:43 2014 +0900
@@ -0,0 +1,59 @@
+// Filename   : miniframe.h
+// Last Change: 04-Dec-2014.
+//
+#ifndef __MINIFRAME_H__
+#define __MINIFRAME_H__
+
+#include "common.h"
+
+class MiniFrame;
+///////////////////////////////////////////////////////////////
+// カスタム検索ボックス
+class MiniSearchBox : public wxSearchCtrl
+{
+    DECLARE_EVENT_TABLE()
+	private:
+        wxArrayString m_jhhsno;
+
+	public:
+		MiniSearchBox( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style );
+		~MiniSearchBox();
+
+        void OnKey( wxKeyEvent& event );
+};
+
+
+///////////////////////////////////////////////////////////////
+// メインフレーム
+class MiniFrame : public wxFrame 
+{
+    DECLARE_EVENT_TABLE()
+	private:
+        wxFileConfig*     config;
+        wxString          conf_file;
+        wxString          m_hhsno;
+        wxString          m_shared;
+	
+	protected:
+		wxStaticText*     m_staticText; // コマンド?
+		MiniSearchBox*    m_searchBox;
+	
+	public:
+		MiniFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style );
+		~MiniFrame();
+		
+        void OnOpenAppDir( wxCommandEvent& WXUNUSED(event) );
+        void OpenAppDir( void );
+        void OpenHhsDir( wxString path );
+        void Transform( wxString mode );
+        void PrintImages( wxString path );
+        void OnCommand( wxCommandEvent& WXUNUSED(event) );
+        void LoadParam( void );
+};
+
+enum {
+    ID_MSEARCH = wxID_HIGHEST + 10,
+};
+
+#endif //__MINIFRAME_H__
+
--- a/include/myframe.h	Mon Dec 08 19:47:42 2014 +0900
+++ b/include/myframe.h	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.h
-// Last Change: 19-Jun-2014.
+// Last Change: 12-Dec-2014.
 //
 #ifndef __MYFRAME_H__
 #define __MYFRAME_H__
@@ -53,6 +53,7 @@
         void OnDClick5( wxMouseEvent& event );
         void SetCacheImages( wxString dirpath );	
         void DoPreview( int n );
+        void Initialize( void );
 };
 
 ///////////////////////////////////////////////////////////////
--- a/include/sqlite3.h	Mon Dec 08 19:47:42 2014 +0900
+++ b/include/sqlite3.h	Wed Dec 17 00:52:43 2014 +0900
@@ -107,9 +107,9 @@
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.7.16"
-#define SQLITE_VERSION_NUMBER 3007016
-#define SQLITE_SOURCE_ID      "2013-03-18 11:39:23 66d5f2b76750f3520eb7a495f6247206758f5b90"
+#define SQLITE_VERSION        "3.8.5"
+#define SQLITE_VERSION_NUMBER 3008005
+#define SQLITE_SOURCE_ID      "2014-06-04 14:06:34 b1ed4f2a34ba66c29b130f8d13e9092758019212"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -370,7 +370,7 @@
 ** <ul>
 ** <li> The application must insure that the 1st parameter to sqlite3_exec()
 **      is a valid and open [database connection].
-** <li> The application must not close [database connection] specified by
+** <li> The application must not close the [database connection] specified by
 **      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
 ** <li> The application must not modify the SQL statement text passed into
 **      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
@@ -425,6 +425,8 @@
 #define SQLITE_FORMAT      24   /* Auxiliary database format error */
 #define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
 #define SQLITE_NOTADB      26   /* File opened that is not a database file */
+#define SQLITE_NOTICE      27   /* Notifications from sqlite3_log() */
+#define SQLITE_WARNING     28   /* Warnings from sqlite3_log() */
 #define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
 #define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
 /* end-of-error-codes */
@@ -445,7 +447,7 @@
 ** [sqlite3_extended_result_codes()] API.
 **
 ** Some of the available extended result codes are listed here.
-** One may expect the number of extended result codes will be expand
+** One may expect the number of extended result codes will increase
 ** over time.  Software that uses extended result codes should expect
 ** to see new result codes in future releases of SQLite.
 **
@@ -475,15 +477,21 @@
 #define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))
 #define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))
 #define SQLITE_IOERR_DELETE_NOENT      (SQLITE_IOERR | (23<<8))
+#define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))
+#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))
+#define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))
 #define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
 #define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
+#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
 #define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
 #define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
 #define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
+#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))
 #define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
 #define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
 #define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))
 #define SQLITE_READONLY_ROLLBACK       (SQLITE_READONLY | (3<<8))
+#define SQLITE_READONLY_DBMOVED        (SQLITE_READONLY | (4<<8))
 #define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))
 #define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))
 #define SQLITE_CONSTRAINT_COMMITHOOK   (SQLITE_CONSTRAINT | (2<<8))
@@ -494,6 +502,10 @@
 #define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))
 #define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))
 #define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
+#define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))
+#define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
+#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
+#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))
 
 /*
 ** CAPI3REF: Flags For File Open Operations
@@ -547,7 +559,11 @@
 ** after reboot following a crash or power loss, the only bytes in a
 ** file that were written at the application level might have changed
 ** and that adjacent bytes, even bytes within the same sector are
-** guaranteed to be unchanged.
+** guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
+** flag indicate that a file cannot be deleted when open.  The
+** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
+** read-only media and cannot be changed even by processes with
+** elevated privileges.
 */
 #define SQLITE_IOCAP_ATOMIC                 0x00000001
 #define SQLITE_IOCAP_ATOMIC512              0x00000002
@@ -562,6 +578,7 @@
 #define SQLITE_IOCAP_SEQUENTIAL             0x00000400
 #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800
 #define SQLITE_IOCAP_POWERSAFE_OVERWRITE    0x00001000
+#define SQLITE_IOCAP_IMMUTABLE              0x00002000
 
 /*
 ** CAPI3REF: File Locking Levels
@@ -733,6 +750,9 @@
   void (*xShmBarrier)(sqlite3_file*);
   int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
   /* Methods above are valid for version 2 */
+  int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
+  int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
+  /* Methods above are valid for version 3 */
   /* Additional methods may be added in future releases */
 };
 
@@ -775,15 +795,29 @@
 ** additional information.
 **
 ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
-** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
-** SQLite and sent to all VFSes in place of a call to the xSync method
-** when the database connection has [PRAGMA synchronous] set to OFF.)^
-** Some specialized VFSes need this signal in order to operate correctly
-** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most 
-** VFSes do not need this signal and should silently ignore this opcode.
-** Applications should not call [sqlite3_file_control()] with this
-** opcode as doing so may disrupt the operation of the specialized VFSes
-** that do require it.  
+** No longer in use.
+**
+** <li>[[SQLITE_FCNTL_SYNC]]
+** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
+** sent to the VFS immediately before the xSync method is invoked on a
+** database file descriptor. Or, if the xSync method is not invoked 
+** because the user has configured SQLite with 
+** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place 
+** of the xSync method. In most cases, the pointer argument passed with
+** this file-control is NULL. However, if the database file is being synced
+** as part of a multi-database commit, the argument points to a nul-terminated
+** string containing the transactions master-journal file name. VFSes that 
+** do not need this signal should silently ignore this opcode. Applications 
+** should not call [sqlite3_file_control()] with this opcode as doing so may 
+** disrupt the operation of the specialized VFSes that do require it.  
+**
+** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
+** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
+** and sent to the VFS after a transaction has been committed immediately
+** but before the database is unlocked. VFSes that do not need this signal
+** should silently ignore this opcode. Applications should not call
+** [sqlite3_file_control()] with this opcode as doing so may disrupt the 
+** operation of the specialized VFSes that do require it.  
 **
 ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
 ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
@@ -869,7 +903,8 @@
 ** it is able to override built-in [PRAGMA] statements.
 **
 ** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
-** ^This file-control may be invoked by SQLite on the database file handle
+** ^The [SQLITE_FCNTL_BUSYHANDLER]
+** file-control may be invoked by SQLite on the database file handle
 ** shortly after it is opened in order to provide a custom VFS with access
 ** to the connections busy-handler callback. The argument is of type (void **)
 ** - an array of two (void *) values. The first (void *) actually points
@@ -880,13 +915,44 @@
 ** current operation.
 **
 ** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
-** ^Application can invoke this file-control to have SQLite generate a
+** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
+** to have SQLite generate a
 ** temporary filename using the same algorithm that is followed to generate
 ** temporary filenames for TEMP tables and other internal uses.  The
 ** argument should be a char** which will be filled with the filename
 ** written into memory obtained from [sqlite3_malloc()].  The caller should
 ** invoke [sqlite3_free()] on the result to avoid a memory leak.
 **
+** <li>[[SQLITE_FCNTL_MMAP_SIZE]]
+** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
+** maximum number of bytes that will be used for memory-mapped I/O.
+** The argument is a pointer to a value of type sqlite3_int64 that
+** is an advisory maximum number of bytes in the file to memory map.  The
+** pointer is overwritten with the old value.  The limit is not changed if
+** the value originally pointed to is negative, and so the current limit 
+** can be queried by passing in a pointer to a negative number.  This
+** file-control is used internally to implement [PRAGMA mmap_size].
+**
+** <li>[[SQLITE_FCNTL_TRACE]]
+** The [SQLITE_FCNTL_TRACE] file control provides advisory information
+** to the VFS about what the higher layers of the SQLite stack are doing.
+** This file control is used by some VFS activity tracing [shims].
+** The argument is a zero-terminated string.  Higher layers in the
+** SQLite stack may generate instances of this file control if
+** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
+**
+** <li>[[SQLITE_FCNTL_HAS_MOVED]]
+** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
+** pointer to an integer and it writes a boolean into that integer depending
+** on whether or not the file has been renamed, moved, or deleted since it
+** was first opened.
+**
+** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
+** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This
+** opcode causes the xFileControl method to swap the file handle with the one
+** pointed to by the pArg argument.  This capability is used during testing
+** and only needs to be supported when SQLITE_TEST is defined.
+**
 ** </ul>
 */
 #define SQLITE_FCNTL_LOCKSTATE               1
@@ -905,6 +971,12 @@
 #define SQLITE_FCNTL_PRAGMA                 14
 #define SQLITE_FCNTL_BUSYHANDLER            15
 #define SQLITE_FCNTL_TEMPFILENAME           16
+#define SQLITE_FCNTL_MMAP_SIZE              18
+#define SQLITE_FCNTL_TRACE                  19
+#define SQLITE_FCNTL_HAS_MOVED              20
+#define SQLITE_FCNTL_SYNC                   21
+#define SQLITE_FCNTL_COMMIT_PHASETWO        22
+#define SQLITE_FCNTL_WIN32_SET_HANDLE       23
 
 /*
 ** CAPI3REF: Mutex Handle
@@ -1349,7 +1421,7 @@
 ** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, 
 ** that causes the corresponding memory allocation to fail.
 **
-** The xInit method initializes the memory allocator.  (For example,
+** The xInit method initializes the memory allocator.  For example,
 ** it might allocate any require mutexes or initialize internal data
 ** structures.  The xShutdown method is invoked (indirectly) by
 ** [sqlite3_shutdown()] and should deallocate any resources acquired
@@ -1571,7 +1643,9 @@
 ** page cache implementation into that object.)^ </dd>
 **
 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
-** <dd> ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
+** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
+** global [error log].
+** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
 ** function with a call signature of void(*)(void*,int,const char*), 
 ** and a pointer to void. ^If the function pointer is not NULL, it is
 ** invoked by [sqlite3_log()] to process each logging event.  ^If the
@@ -1589,27 +1663,27 @@
 ** function must be threadsafe. </dd>
 **
 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
-** <dd> This option takes a single argument of type int. If non-zero, then
+** <dd>^(This option takes a single argument of type int. If non-zero, then
 ** URI handling is globally enabled. If the parameter is zero, then URI handling
-** is globally disabled. If URI handling is globally enabled, all filenames
+** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
 ** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
-** connection is opened. If it is globally disabled, filenames are
+** connection is opened. ^If it is globally disabled, filenames are
 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
-** database connection is opened. By default, URI handling is globally
+** database connection is opened. ^(By default, URI handling is globally
 ** disabled. The default value may be changed by compiling with the
-** [SQLITE_USE_URI] symbol defined.
+** [SQLITE_USE_URI] symbol defined.)^
 **
 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
-** <dd> This option takes a single integer argument which is interpreted as
+** <dd>^This option takes a single integer argument which is interpreted as
 ** a boolean in order to enable or disable the use of covering indices for
-** full table scans in the query optimizer.  The default setting is determined
+** full table scans in the query optimizer.  ^The default setting is determined
 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
 ** if that compile-time option is omitted.
 ** The ability to disable the use of covering indices for full table scans
 ** is because some incorrectly coded legacy applications might malfunction
-** malfunction when the optimization is enabled.  Providing the ability to
+** when the optimization is enabled.  Providing the ability to
 ** disable the optimization allows the older, buggy application code to work
 ** without change even with newer versions of SQLite.
 **
@@ -1617,12 +1691,12 @@
 ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
 ** <dd> These options are obsolete and should not be used by new code.
 ** They are retained for backwards compatibility but are now no-ops.
-** </dl>
+** </dd>
 **
 ** [[SQLITE_CONFIG_SQLLOG]]
 ** <dt>SQLITE_CONFIG_SQLLOG
 ** <dd>This option is only available if sqlite is compiled with the
-** SQLITE_ENABLE_SQLLOG pre-processor macro defined. The first argument should
+** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should
 ** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).
 ** The second should be of type (void*). The callback is invoked by the library
 ** in three separate circumstances, identified by the value passed as the
@@ -1632,7 +1706,30 @@
 ** fourth parameter is 1, then the SQL statement that the third parameter
 ** points to has just been executed. Or, if the fourth parameter is 2, then
 ** the connection being passed as the second parameter is being closed. The
-** third parameter is passed NULL In this case.
+** third parameter is passed NULL In this case.  An example of using this
+** configuration option can be seen in the "test_sqllog.c" source file in
+** the canonical SQLite source tree.</dd>
+**
+** [[SQLITE_CONFIG_MMAP_SIZE]]
+** <dt>SQLITE_CONFIG_MMAP_SIZE
+** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
+** that are the default mmap size limit (the default setting for
+** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
+** ^The default setting can be overridden by each database connection using
+** either the [PRAGMA mmap_size] command, or by using the
+** [SQLITE_FCNTL_MMAP_SIZE] file control.  ^(The maximum allowed mmap size
+** cannot be changed at run-time.  Nor may the maximum allowed mmap size
+** exceed the compile-time maximum mmap size set by the
+** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
+** ^If either argument to this option is negative, then that argument is
+** changed to its compile-time default.
+**
+** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
+** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
+** <dd>^This option is only available if SQLite is compiled for Windows
+** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
+** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
+** that specifies the maximum size of the created heap.
 ** </dl>
 */
 #define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */
@@ -1656,6 +1753,8 @@
 #define SQLITE_CONFIG_GETPCACHE2   19  /* sqlite3_pcache_methods2* */
 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20  /* int */
 #define SQLITE_CONFIG_SQLLOG       21  /* xSqllog, void* */
+#define SQLITE_CONFIG_MMAP_SIZE    22  /* sqlite3_int64, sqlite3_int64 */
+#define SQLITE_CONFIG_WIN32_HEAPSIZE      23  /* int nByte */
 
 /*
 ** CAPI3REF: Database Connection Configuration Options
@@ -1732,19 +1831,21 @@
 /*
 ** CAPI3REF: Last Insert Rowid
 **
-** ^Each entry in an SQLite table has a unique 64-bit signed
+** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
+** has a unique 64-bit signed
 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
 ** names are not also used by explicitly declared columns. ^If
 ** the table has a column of type [INTEGER PRIMARY KEY] then that column
 ** is another alias for the rowid.
 **
-** ^This routine returns the [rowid] of the most recent
-** successful [INSERT] into the database from the [database connection]
-** in the first argument.  ^As of SQLite version 3.7.7, this routines
-** records the last insert rowid of both ordinary tables and [virtual tables].
-** ^If no successful [INSERT]s
-** have ever occurred on that database connection, zero is returned.
+** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the 
+** most recent successful [INSERT] into a rowid table or [virtual table]
+** on database connection D.
+** ^Inserts into [WITHOUT ROWID] tables are not recorded.
+** ^If no successful [INSERT]s into rowid tables
+** have ever occurred on the database connection D, 
+** then sqlite3_last_insert_rowid(D) returns zero.
 **
 ** ^(If an [INSERT] occurs within a trigger or within a [virtual table]
 ** method, then this routine will return the [rowid] of the inserted
@@ -2310,11 +2411,13 @@
 ** applications to access the same PRNG for other purposes.
 **
 ** ^A call to this routine stores N bytes of randomness into buffer P.
-**
-** ^The first time this routine is invoked (either internally or by
-** the application) the PRNG is seeded using randomness obtained
-** from the xRandomness method of the default [sqlite3_vfs] object.
-** ^On all subsequent invocations, the pseudo-randomness is generated
+** ^If N is less than one, then P can be a NULL pointer.
+**
+** ^If this routine has not been previously called or if the previous
+** call had N less than one, then the PRNG is seeded using randomness
+** obtained from the xRandomness method of the default [sqlite3_vfs] object.
+** ^If the previous call to this routine had an N of 1 or more then
+** the pseudo-randomness is generated
 ** internally and without recourse to the [sqlite3_vfs] xRandomness
 ** method.
 */
@@ -2474,6 +2577,7 @@
 #define SQLITE_FUNCTION             31   /* NULL            Function Name   */
 #define SQLITE_SAVEPOINT            32   /* Operation       Savepoint Name  */
 #define SQLITE_COPY                  0   /* No longer used */
+#define SQLITE_RECURSIVE            33   /* NULL            NULL            */
 
 /*
 ** CAPI3REF: Tracing And Profiling Functions
@@ -2489,6 +2593,9 @@
 ** as each triggered subprogram is entered.  The callbacks for triggers
 ** contain a UTF-8 SQL comment that identifies the trigger.)^
 **
+** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
+** the length of [bound parameter] expansion in the output of sqlite3_trace().
+**
 ** ^The callback function registered by sqlite3_profile() is invoked
 ** as each SQL statement finishes.  ^The profile callback contains
 ** the original statement text and an estimate of wall-clock time
@@ -2514,9 +2621,10 @@
 ** interface is to keep a GUI updated during a large query.
 **
 ** ^The parameter P is passed through as the only parameter to the 
-** callback function X.  ^The parameter N is the number of 
+** callback function X.  ^The parameter N is the approximate number of 
 ** [virtual machine instructions] that are evaluated between successive
-** invocations of the callback X.
+** invocations of the callback X.  ^If N is less than one then the progress
+** handler is disabled.
 **
 ** ^Only a single progress handler may be defined at one time per
 ** [database connection]; setting a new progress handler cancels the
@@ -2680,8 +2788,32 @@
 **     sqlite3_open_v2(). ^Setting the cache parameter to "private" is 
 **     equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
 **     ^If sqlite3_open_v2() is used and the "cache" parameter is present in
-**     a URI filename, its value overrides any behaviour requested by setting
+**     a URI filename, its value overrides any behavior requested by setting
 **     SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
+**
+**  <li> <b>psow</b>: ^The psow parameter may be "true" (or "on" or "yes" or
+**     "1") or "false" (or "off" or "no" or "0") to indicate that the
+**     [powersafe overwrite] property does or does not apply to the
+**     storage media on which the database file resides.  ^The psow query
+**     parameter only works for the built-in unix and Windows VFSes.
+**
+**  <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter
+**     which if set disables file locking in rollback journal modes.  This
+**     is useful for accessing a database on a filesystem that does not
+**     support locking.  Caution:  Database corruption might result if two
+**     or more processes write to the same database and any one of those
+**     processes uses nolock=1.
+**
+**  <li> <b>immutable</b>: ^The immutable parameter is a boolean query
+**     parameter that indicates that the database file is stored on
+**     read-only media.  ^When immutable is set, SQLite assumes that the
+**     database file cannot be changed, even by a process with higher
+**     privilege, and so the database is opened read-only and all locking
+**     and change detection is disabled.  Caution: Setting the immutable
+**     property on a database file that does in fact change can result
+**     in incorrect query results and/or [SQLITE_CORRUPT] errors.
+**     See also: [SQLITE_IOCAP_IMMUTABLE].
+**       
 ** </ul>
 **
 ** ^Specifying an unknown parameter in the query component of a URI is not an
@@ -2711,8 +2843,9 @@
 **          Open file "data.db" in the current directory for read-only access.
 **          Regardless of whether or not shared-cache mode is enabled by
 **          default, use a private cache.
-** <tr><td> file:/home/fred/data.db?vfs=unix-nolock <td>
-**          Open file "/home/fred/data.db". Use the special VFS "unix-nolock".
+** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
+**          Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
+**          that uses dot-files in place of posix advisory locking.
 ** <tr><td> file:data.db?mode=readonly <td> 
 **          An error. "readonly" is not a valid option for the "mode" parameter.
 ** </table>
@@ -3027,7 +3160,8 @@
 ** <li>
 ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
 ** always used to do, [sqlite3_step()] will automatically recompile the SQL
-** statement and try to run it again.
+** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]
+** retries will occur before sqlite3_step() gives up and returns an error.
 ** </li>
 **
 ** <li>
@@ -3049,7 +3183,6 @@
 ** choice of query plan if the parameter is the left-hand side of a [LIKE]
 ** or [GLOB] operator or if the parameter is compared to an indexed column
 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
-** the 
 ** </li>
 ** </ol>
 */
@@ -3231,6 +3364,9 @@
 ** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).
 **
 ** ^The third argument is the value to bind to the parameter.
+** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter
+** is ignored and the end result is the same as sqlite3_bind_null().
 **
 ** ^(In those routines that have a fourth argument, its value is the
 ** number of bytes in the parameter.  To be clear: the value is the
@@ -3708,19 +3844,19 @@
 **
 ** <tr><td>  NULL    <td> INTEGER   <td> Result is 0
 ** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0
-** <tr><td>  NULL    <td>   TEXT    <td> Result is NULL pointer
-** <tr><td>  NULL    <td>   BLOB    <td> Result is NULL pointer
+** <tr><td>  NULL    <td>   TEXT    <td> Result is a NULL pointer
+** <tr><td>  NULL    <td>   BLOB    <td> Result is a NULL pointer
 ** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float
 ** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer
 ** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT
-** <tr><td>  FLOAT   <td> INTEGER   <td> Convert from float to integer
+** <tr><td>  FLOAT   <td> INTEGER   <td> [CAST] to INTEGER
 ** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float
-** <tr><td>  FLOAT   <td>   BLOB    <td> Same as FLOAT->TEXT
-** <tr><td>  TEXT    <td> INTEGER   <td> Use atoi()
-** <tr><td>  TEXT    <td>  FLOAT    <td> Use atof()
+** <tr><td>  FLOAT   <td>   BLOB    <td> [CAST] to BLOB
+** <tr><td>  TEXT    <td> INTEGER   <td> [CAST] to INTEGER
+** <tr><td>  TEXT    <td>  FLOAT    <td> [CAST] to REAL
 ** <tr><td>  TEXT    <td>   BLOB    <td> No change
-** <tr><td>  BLOB    <td> INTEGER   <td> Convert to TEXT then use atoi()
-** <tr><td>  BLOB    <td>  FLOAT    <td> Convert to TEXT then use atof()
+** <tr><td>  BLOB    <td> INTEGER   <td> [CAST] to INTEGER
+** <tr><td>  BLOB    <td>  FLOAT    <td> [CAST] to REAL
 ** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed
 ** </table>
 ** </blockquote>)^
@@ -3776,7 +3912,7 @@
 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
 ** [sqlite3_finalize()] is called.  ^The memory space used to hold strings
 ** and BLOBs is freed automatically.  Do <b>not</b> pass the pointers returned
-** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
+** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
 ** [sqlite3_free()].
 **
 ** ^(If a memory allocation error occurs during the evaluation of any
@@ -3885,15 +4021,24 @@
 **
 ** ^The fourth parameter, eTextRep, specifies what
 ** [SQLITE_UTF8 | text encoding] this SQL function prefers for
-** its parameters.  Every SQL function implementation must be able to work
-** with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be
-** more efficient with one encoding than another.  ^An application may
-** invoke sqlite3_create_function() or sqlite3_create_function16() multiple
-** times with the same function but with different values of eTextRep.
+** its parameters.  The application should set this parameter to
+** [SQLITE_UTF16LE] if the function implementation invokes 
+** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the
+** implementation invokes [sqlite3_value_text16be()] on an input, or
+** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8]
+** otherwise.  ^The same SQL function may be registered multiple times using
+** different preferred text encodings, with different implementations for
+** each encoding.
 ** ^When multiple implementations of the same function are available, SQLite
 ** will pick the one that involves the least amount of data conversion.
-** If there is only a single implementation which does not care what text
-** encoding is used, then the fourth argument should be [SQLITE_ANY].
+**
+** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC]
+** to signal that the function will always return the same result given
+** the same inputs within a single SQL statement.  Most SQL functions are
+** deterministic.  The built-in [random()] SQL function is an example of a
+** function that is not deterministic.  The SQLite query planner is able to
+** perform additional optimizations on deterministic functions, so use
+** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
 **
 ** ^(The fifth parameter is an arbitrary pointer.  The implementation of the
 ** function can gain access to this pointer using [sqlite3_user_data()].)^
@@ -3979,10 +4124,20 @@
 #define SQLITE_UTF16LE        2
 #define SQLITE_UTF16BE        3
 #define SQLITE_UTF16          4    /* Use native byte order */
-#define SQLITE_ANY            5    /* sqlite3_create_function only */
+#define SQLITE_ANY            5    /* Deprecated */
 #define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */
 
 /*
+** CAPI3REF: Function Flags
+**
+** These constants may be ORed together with the 
+** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
+** to [sqlite3_create_function()], [sqlite3_create_function16()], or
+** [sqlite3_create_function_v2()].
+*/
+#define SQLITE_DETERMINISTIC    0x800
+
+/*
 ** CAPI3REF: Deprecated Functions
 ** DEPRECATED
 **
@@ -3998,7 +4153,8 @@
 SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
 SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
 SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
-SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
+                      void*,sqlite3_int64);
 #endif
 
 /*
@@ -4078,14 +4234,17 @@
 ** In those cases, sqlite3_aggregate_context() might be called for the
 ** first time from within xFinal().)^
 **
-** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is
-** less than or equal to zero or if a memory allocate error occurs.
+** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer 
+** when first called if N is less than or equal to zero or if a memory
+** allocate error occurs.
 **
 ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
 ** determined by the N parameter on first successful call.  Changing the
 ** value of N in subsequent call to sqlite3_aggregate_context() within
 ** the same aggregate function instance will not resize the memory
-** allocation.)^
+** allocation.)^  Within the xFinal callback, it is customary to set
+** N=0 in calls to sqlite3_aggregate_context(C,N) so that no 
+** pointless memory allocations occur.
 **
 ** ^SQLite automatically frees the memory allocated by 
 ** sqlite3_aggregate_context() when the aggregate query concludes.
@@ -4128,41 +4287,49 @@
 /*
 ** CAPI3REF: Function Auxiliary Data
 **
-** The following two functions may be used by scalar SQL functions to
+** These functions may be used by (non-aggregate) SQL functions to
 ** associate metadata with argument values. If the same value is passed to
 ** multiple invocations of the same SQL function during query execution, under
-** some circumstances the associated metadata may be preserved. This may
-** be used, for example, to add a regular-expression matching scalar
-** function. The compiled version of the regular expression is stored as
-** metadata associated with the SQL value passed as the regular expression
-** pattern.  The compiled regular expression can be reused on multiple
-** invocations of the same function so that the original pattern string
-** does not need to be recompiled on each invocation.
+** some circumstances the associated metadata may be preserved.  An example
+** of where this might be useful is in a regular-expression matching
+** function. The compiled version of the regular expression can be stored as
+** metadata associated with the pattern string.  
+** Then as long as the pattern string remains the same,
+** the compiled regular expression can be reused on multiple
+** invocations of the same function.
 **
 ** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata
 ** associated by the sqlite3_set_auxdata() function with the Nth argument
-** value to the application-defined function. ^If no metadata has been ever
-** been set for the Nth argument of the function, or if the corresponding
-** function parameter has changed since the meta-data was set,
-** then sqlite3_get_auxdata() returns a NULL pointer.
-**
-** ^The sqlite3_set_auxdata() interface saves the metadata
-** pointed to by its 3rd parameter as the metadata for the N-th
-** argument of the application-defined function.  Subsequent
-** calls to sqlite3_get_auxdata() might return this data, if it has
-** not been destroyed.
-** ^If it is not NULL, SQLite will invoke the destructor
-** function given by the 4th parameter to sqlite3_set_auxdata() on
-** the metadata when the corresponding function parameter changes
-** or when the SQL statement completes, whichever comes first.
-**
-** SQLite is free to call the destructor and drop metadata on any
-** parameter of any function at any time.  ^The only guarantee is that
-** the destructor will be called before the metadata is dropped.
+** value to the application-defined function. ^If there is no metadata
+** associated with the function argument, this sqlite3_get_auxdata() interface
+** returns a NULL pointer.
+**
+** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
+** argument of the application-defined function.  ^Subsequent
+** calls to sqlite3_get_auxdata(C,N) return P from the most recent
+** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or
+** NULL if the metadata has been discarded.
+** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
+** SQLite will invoke the destructor function X with parameter P exactly
+** once, when the metadata is discarded.
+** SQLite is free to discard the metadata at any time, including: <ul>
+** <li> when the corresponding function parameter changes, or
+** <li> when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
+**      SQL statement, or
+** <li> when sqlite3_set_auxdata() is invoked again on the same parameter, or
+** <li> during the original sqlite3_set_auxdata() call when a memory 
+**      allocation error occurs. </ul>)^
+**
+** Note the last bullet in particular.  The destructor X in 
+** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
+** sqlite3_set_auxdata() interface even returns.  Hence sqlite3_set_auxdata()
+** should be called near the end of the function implementation and the
+** function implementation should not make any use of P after
+** sqlite3_set_auxdata() has been called.
 **
 ** ^(In practice, metadata is preserved between function calls for
-** expressions that are constant at compile time. This includes literal
-** values and [parameters].)^
+** function parameters that are compile-time constants, including literal
+** values and [parameters] and expressions composed from the same.)^
 **
 ** These routines must be called from the same thread in which
 ** the SQL function is running.
@@ -4183,7 +4350,7 @@
 ** the content before returning.
 **
 ** The typedef is necessary to work around problems in certain
-** C++ compilers.  See ticket #2191.
+** C++ compilers.
 */
 typedef void (*sqlite3_destructor_type)(void*);
 #define SQLITE_STATIC      ((sqlite3_destructor_type)0)
@@ -4467,6 +4634,11 @@
   sqlite3 *db,                   /* Database to be rekeyed */
   const void *pKey, int nKey     /* The key */
 );
+SQLITE_API int sqlite3_key_v2(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const char *zDbName,           /* Name of the database */
+  const void *pKey, int nKey     /* The key */
+);
 
 /*
 ** Change the key on an open database.  If the current database is not
@@ -4480,6 +4652,11 @@
   sqlite3 *db,                   /* Database to be rekeyed */
   const void *pKey, int nKey     /* The new key */
 );
+SQLITE_API int sqlite3_rekey_v2(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const char *zDbName,           /* Name of the database */
+  const void *pKey, int nKey     /* The new key */
+);
 
 /*
 ** Specify the activation key for a SEE database.  Unless 
@@ -4731,12 +4908,13 @@
 **
 ** ^The sqlite3_update_hook() interface registers a callback function
 ** with the [database connection] identified by the first argument
-** to be invoked whenever a row is updated, inserted or deleted.
+** to be invoked whenever a row is updated, inserted or deleted in
+** a rowid table.
 ** ^Any callback set by a previous call to this function
 ** for the same database connection is overridden.
 **
 ** ^The second argument is a pointer to the function to invoke when a
-** row is updated, inserted or deleted.
+** row is updated, inserted or deleted in a rowid table.
 ** ^The first argument to the callback is a copy of the third argument
 ** to sqlite3_update_hook().
 ** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
@@ -4749,6 +4927,7 @@
 **
 ** ^(The update hook is not invoked when internal system tables are
 ** modified (i.e. sqlite_master and sqlite_sequence).)^
+** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
 **
 ** ^In the current implementation, the update hook
 ** is not invoked when duplication rows are deleted because of an
@@ -4830,8 +5009,8 @@
 **
 ** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
 ** memory as possible from database connection D. Unlike the
-** [sqlite3_release_memory()] interface, this interface is effect even
-** when then [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
+** [sqlite3_release_memory()] interface, this interface is in effect even
+** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
 ** omitted.
 **
 ** See also: [sqlite3_release_memory()]
@@ -4982,11 +5161,20 @@
 ** ^This interface loads an SQLite extension library from the named file.
 **
 ** ^The sqlite3_load_extension() interface attempts to load an
-** SQLite extension library contained in the file zFile.
+** [SQLite extension] library contained in the file zFile.  If
+** the file cannot be loaded directly, attempts are made to load
+** with various operating-system specific extensions added.
+** So for example, if "samplelib" cannot be loaded, then names like
+** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
+** be tried also.
 **
 ** ^The entry point is zProc.
-** ^zProc may be 0, in which case the name of the entry point
-** defaults to "sqlite3_extension_init".
+** ^(zProc may be 0, in which case SQLite will try to come up with an
+** entry point name on its own.  It first tries "sqlite3_extension_init".
+** If that does not work, it constructs a name "sqlite3_X_init" where the
+** X is consists of the lower-case equivalent of all ASCII alphabetic
+** characters in the filename from the last "/" to the first following
+** "." and omitting any initial "lib".)^
 ** ^The sqlite3_load_extension() interface returns
 ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
 ** ^If an error occurs and pzErrMsg is not 0, then the
@@ -5012,11 +5200,11 @@
 ** CAPI3REF: Enable Or Disable Extension Loading
 **
 ** ^So as not to open security holes in older applications that are
-** unprepared to deal with extension loading, and as a means of disabling
-** extension loading while evaluating user-entered SQL, the following API
+** unprepared to deal with [extension loading], and as a means of disabling
+** [extension loading] while evaluating user-entered SQL, the following API
 ** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
 **
-** ^Extension loading is off by default. See ticket #1863.
+** ^Extension loading is off by default.
 ** ^Call the sqlite3_enable_load_extension() routine with onoff==1
 ** to turn extension loading on and call it with onoff==0 to turn
 ** it back off again.
@@ -5028,7 +5216,7 @@
 **
 ** ^This interface causes the xEntryPoint() function to be invoked for
 ** each new [database connection] that is created.  The idea here is that
-** xEntryPoint() is the entry point for a statically linked SQLite extension
+** xEntryPoint() is the entry point for a statically linked [SQLite extension]
 ** that is to be automatically loaded into all new database connections.
 **
 ** ^(Even though the function prototype shows that xEntryPoint() takes
@@ -5056,11 +5244,24 @@
 ** on the list of automatic extensions is a harmless no-op. ^No entry point
 ** will be called more than once for each database connection that is opened.
 **
-** See also: [sqlite3_reset_auto_extension()].
+** See also: [sqlite3_reset_auto_extension()]
+** and [sqlite3_cancel_auto_extension()]
 */
 SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
 
 /*
+** CAPI3REF: Cancel Automatic Extension Loading
+**
+** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
+** initialization routine X that was registered using a prior call to
+** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]
+** routine returns 1 if initialization routine X was successfully 
+** unregistered and it returns 0 if X was not on the list of initialization
+** routines.
+*/
+SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
+
+/*
 ** CAPI3REF: Reset Automatic Extension Loading
 **
 ** ^This interface disables all automatic extensions previously
@@ -5184,10 +5385,22 @@
 ** the correct order to satisfy the ORDER BY clause so that no separate
 ** sorting step is required.
 **
-** ^The estimatedCost value is an estimate of the cost of doing the
-** particular lookup.  A full scan of a table with N entries should have
-** a cost of N.  A binary search of a table of N entries should have a
-** cost of approximately log(N).
+** ^The estimatedCost value is an estimate of the cost of a particular
+** strategy. A cost of N indicates that the cost of the strategy is similar
+** to a linear scan of an SQLite table with N rows. A cost of log(N) 
+** indicates that the expense of the operation is similar to that of a
+** binary search on a unique indexed field of an SQLite table with N rows.
+**
+** ^The estimatedRows value is an estimate of the number of rows that
+** will be returned by the strategy.
+**
+** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
+** structure for SQLite version 3.8.2. If a virtual table extension is
+** used with an SQLite version earlier than 3.8.2, the results of attempting 
+** to read or write the estimatedRows field are undefined (but are likely 
+** to included crashing the application). The estimatedRows field should
+** therefore only be used if [sqlite3_libversion_number()] returns a
+** value greater than or equal to 3008002.
 */
 struct sqlite3_index_info {
   /* Inputs */
@@ -5212,7 +5425,9 @@
   char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
   int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
   int orderByConsumed;       /* True if output is already ordered */
-  double estimatedCost;      /* Estimated cost of using this index */
+  double estimatedCost;           /* Estimated cost of using this index */
+  /* Fields below are only available in SQLite 3.8.2 and later */
+  sqlite3_int64 estimatedRows;    /* Estimated number of rows returned */
 };
 
 /*
@@ -5416,6 +5631,9 @@
 ** interface.  Use the [UPDATE] SQL command to change the size of a
 ** blob.
 **
+** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
+** table.  Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
+**
 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
 ** and the built-in [zeroblob] SQL function can be used, if desired,
 ** to create an empty, zero-filled blob in which to read or write using
@@ -5939,7 +6157,10 @@
 #define SQLITE_TESTCTRL_SCRATCHMALLOC           17
 #define SQLITE_TESTCTRL_LOCALTIME_FAULT         18
 #define SQLITE_TESTCTRL_EXPLAIN_STMT            19
-#define SQLITE_TESTCTRL_LAST                    19
+#define SQLITE_TESTCTRL_NEVER_CORRUPT           20
+#define SQLITE_TESTCTRL_VDBE_COVERAGE           21
+#define SQLITE_TESTCTRL_BYTEORDER               22
+#define SQLITE_TESTCTRL_LAST                    22
 
 /*
 ** CAPI3REF: SQLite Runtime Status
@@ -6172,6 +6393,12 @@
 ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
 ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
 ** </dd>
+**
+** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
+** <dd>This parameter returns zero for the current value if and only if
+** all foreign key constraints (deferred or immediate) have been
+** resolved.)^  ^The highwater mark is always 0.
+** </dd>
 ** </dl>
 */
 #define SQLITE_DBSTATUS_LOOKASIDE_USED       0
@@ -6184,7 +6411,8 @@
 #define SQLITE_DBSTATUS_CACHE_HIT            7
 #define SQLITE_DBSTATUS_CACHE_MISS           8
 #define SQLITE_DBSTATUS_CACHE_WRITE          9
-#define SQLITE_DBSTATUS_MAX                  9   /* Largest defined DBSTATUS */
+#define SQLITE_DBSTATUS_DEFERRED_FKS        10
+#define SQLITE_DBSTATUS_MAX                 10   /* Largest defined DBSTATUS */
 
 
 /*
@@ -6238,11 +6466,21 @@
 ** A non-zero value in this counter may indicate an opportunity to
 ** improvement performance by adding permanent indices that do not
 ** need to be reinitialized each time the statement is run.</dd>
+**
+** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
+** <dd>^This is the number of virtual machine operations executed
+** by the prepared statement if that number is less than or equal
+** to 2147483647.  The number of virtual machine operations can be 
+** used as a proxy for the total work done by the prepared statement.
+** If the number of virtual machine operations exceeds 2147483647
+** then the value returned by this statement status code is undefined.
+** </dd>
 ** </dl>
 */
 #define SQLITE_STMTSTATUS_FULLSCAN_STEP     1
 #define SQLITE_STMTSTATUS_SORT              2
 #define SQLITE_STMTSTATUS_AUTOINDEX         3
+#define SQLITE_STMTSTATUS_VM_STEP           4
 
 /*
 ** CAPI3REF: Custom Page Cache Object
@@ -6379,7 +6617,7 @@
 ** parameter to help it determined what action to take:
 **
 ** <table border=1 width=85% align=center>
-** <tr><th> createFlag <th> Behaviour when page is not already in cache
+** <tr><th> createFlag <th> Behavior when page is not already in cache
 ** <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
 ** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
 **                 Otherwise return NULL.
@@ -6809,9 +7047,24 @@
 SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
 
 /*
+** CAPI3REF: String Globbing
+*
+** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches
+** the glob pattern P, and it returns non-zero if string X does not match
+** the glob pattern P.  ^The definition of glob pattern matching used in
+** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
+** SQL dialect used by SQLite.  ^The sqlite3_strglob(P,X) function is case
+** sensitive.
+**
+** Note that this routine returns zero on a match and non-zero if the strings
+** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
+*/
+SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
+
+/*
 ** CAPI3REF: Error Logging Interface
 **
-** ^The [sqlite3_log()] interface writes a message into the error log
+** ^The [sqlite3_log()] interface writes a message into the [error log]
 ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
 ** ^If logging is enabled, the zFormat string and subsequent arguments are
 ** used with [sqlite3_snprintf()] to generate the final output string.
@@ -7106,7 +7359,7 @@
 #ifdef __cplusplus
 }  /* End of the 'extern "C"' block */
 #endif
-#endif
+#endif /* _SQLITE3_H_ */
 
 /*
 ** 2010 August 30
@@ -7130,6 +7383,16 @@
 #endif
 
 typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
+typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
+
+/* The double-precision datatype used by RTree depends on the
+** SQLITE_RTREE_INT_ONLY compile-time option.
+*/
+#ifdef SQLITE_RTREE_INT_ONLY
+  typedef sqlite3_int64 sqlite3_rtree_dbl;
+#else
+  typedef double sqlite3_rtree_dbl;
+#endif
 
 /*
 ** Register a geometry callback named zGeom that can be used as part of an
@@ -7140,11 +7403,7 @@
 SQLITE_API int sqlite3_rtree_geometry_callback(
   sqlite3 *db,
   const char *zGeom,
-#ifdef SQLITE_RTREE_INT_ONLY
-  int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes),
-#else
-  int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes),
-#endif
+  int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
   void *pContext
 );
 
@@ -7156,11 +7415,60 @@
 struct sqlite3_rtree_geometry {
   void *pContext;                 /* Copy of pContext passed to s_r_g_c() */
   int nParam;                     /* Size of array aParam[] */
-  double *aParam;                 /* Parameters passed to SQL geom function */
+  sqlite3_rtree_dbl *aParam;      /* Parameters passed to SQL geom function */
   void *pUser;                    /* Callback implementation user data */
   void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */
 };
 
+/*
+** Register a 2nd-generation geometry callback named zScore that can be 
+** used as part of an R-Tree geometry query as follows:
+**
+**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
+*/
+SQLITE_API int sqlite3_rtree_query_callback(
+  sqlite3 *db,
+  const char *zQueryFunc,
+  int (*xQueryFunc)(sqlite3_rtree_query_info*),
+  void *pContext,
+  void (*xDestructor)(void*)
+);
+
+
+/*
+** A pointer to a structure of the following type is passed as the 
+** argument to scored geometry callback registered using
+** sqlite3_rtree_query_callback().
+**
+** Note that the first 5 fields of this structure are identical to
+** sqlite3_rtree_geometry.  This structure is a subclass of
+** sqlite3_rtree_geometry.
+*/
+struct sqlite3_rtree_query_info {
+  void *pContext;                   /* pContext from when function registered */
+  int nParam;                       /* Number of function parameters */
+  sqlite3_rtree_dbl *aParam;        /* value of function parameters */
+  void *pUser;                      /* callback can use this, if desired */
+  void (*xDelUser)(void*);          /* function to free pUser */
+  sqlite3_rtree_dbl *aCoord;        /* Coordinates of node or entry to check */
+  unsigned int *anQueue;            /* Number of pending entries in the queue */
+  int nCoord;                       /* Number of coordinates */
+  int iLevel;                       /* Level of current node or entry */
+  int mxLevel;                      /* The largest iLevel value in the tree */
+  sqlite3_int64 iRowid;             /* Rowid for current entry */
+  sqlite3_rtree_dbl rParentScore;   /* Score of parent node */
+  int eParentWithin;                /* Visibility of parent node */
+  int eWithin;                      /* OUT: Visiblity */
+  sqlite3_rtree_dbl rScore;         /* OUT: Write the score here */
+};
+
+/*
+** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
+*/
+#define NOT_WITHIN       0   /* Object completely outside of query region */
+#define PARTLY_WITHIN    1   /* Object partially overlaps query region */
+#define FULLY_WITHIN     2   /* Object fully contained within query region */
+
 
 #ifdef __cplusplus
 }  /* end of the 'extern "C"' block */
--- a/src/about.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/about.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : about.cpp
-// Last Change: 17-Oct-2013.
+// Last Change: 15-Dec-2014.
 //
 
 #include "common.h"
@@ -19,7 +19,7 @@
 	m_bitmap = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerOK->Add( m_bitmap, 0, wxALL, 5 );
 	
-	m_staticTextDesc = new wxStaticText( this, wxID_ANY, wxT("我に自由を!\rLet me free !"), wxDefaultPosition, wxSize(-1,50), 0 );
+	m_staticTextDesc = new wxStaticText( this, wxID_ANY, wxT("我に自由を!\rLet me free !"), wxDefaultPosition, wxSize( -1, 50 ), 0 );
 	bSizerOK->Add( m_staticTextDesc, 0, wxALL|wxALIGN_CENTRE, 5 );
 	
 	m_buttonOK = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -27,6 +27,10 @@
 	bSizerOK->Add( m_buttonOK, 0, wxALL|wxALIGN_BOTTOM, 5 );
 	
 	bSizer->Add( bSizerOK, 0, wxEXPAND, 5 );
+
+    wxString build;
+	m_staticTextBuild = new wxStaticText( this, wxID_ANY, build.Format( wxT("Build with %s\n") wxT("running under %s."), wxVERSION_STRING, wxGetOsDescription().c_str() ), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizer->Add( m_staticTextBuild, 0, wxALL, 5 );
 	
 	m_richText = new wxRichTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxVSCROLL|wxBORDER_NONE|wxWANTS_CHARS );
 	bSizer->Add( m_richText, 1, wxEXPAND|wxALL, 5 );
@@ -47,7 +51,7 @@
 {
     wxTextFile textfile;
     textfile.Open( wxGetCwd() + wxFILE_SEP_PATH + wxT("Changes") );
-    for ( int i=0; i<textfile.GetLineCount(); i++ ) {
+    for ( int i = 0; i < textfile.GetLineCount(); i++ ) {
         if ( textfile[i].StartsWith( wxT("version")) ) {
             m_richText->BeginBold();
             m_richText->BeginFontSize(16);
@@ -56,22 +60,23 @@
             m_richText->EndTextColour();
             m_richText->EndFontSize();
             m_richText->EndBold();
-            m_richText->Newline();
         }
         else if ( textfile[i].StartsWith( wxT("20")) ) {    // year
-            m_richText->BeginAlignment( wxTEXT_ALIGNMENT_RIGHT );
+            m_richText->WriteText( wxT("\t\t") );
             m_richText->BeginItalic();
             m_richText->WriteText( textfile[i] );
             m_richText->EndItalic();
-            m_richText->EndAlignment();
             m_richText->Newline();
         }
         else if ( textfile[i].StartsWith( wxT("----")) ) {
             m_richText->WriteText( textfile[i] );
             m_richText->Newline();
         }
+        else if ( textfile[i].IsEmpty() ) {
+            m_richText->Newline();
+        }
         else {
-            m_richText->BeginSymbolBullet( wxT("* "), 60, 0, wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
+            m_richText->BeginSymbolBullet( '*', 60, 0, wxTEXT_ATTR_BULLET_STYLE_SYMBOL );
             m_richText->WriteText( textfile[i] );
             m_richText->EndSymbolBullet();
             m_richText->Newline();
--- a/src/bprint.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/bprint.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : bprint.cpp
-// Last Change: 21-May-2014.
+// Last Change: 12-Aug-2014.
 //
 
 #include "bprint.h"
@@ -174,6 +174,8 @@
                 wxCopyFile( file, tmpjpg, true );
             }
             html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>");
+            html = html + wxT("<div align=right><font size=-2><u>") + m_grid->GetCellValue( r, 0 ) + wxT("</u></font></div>");
+        
             cout = dir.GetNext( &file );
             n++;
         }
--- a/src/cache.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/cache.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,33 +1,165 @@
 // Filename   : cache.cpp
-// Last Change: 21-Nov-2014.
+// Last Change: 15-Dec-2014.
 //
 
 #include "cache.h"
 #include "db.h"
 
+// キャッシュ取得ダイアログ
+CacheGetDialog::CacheGetDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) 
+    : wxDialog( parent, id, title, pos, size, style )
+{
+	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+    this->SetBackgroundColour( wxColour( wxT("WHEAT") ) );
+	
+	wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
+	
+	m_dirPicker = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a directory") );
+	bSizerTop->Add( m_dirPicker, 0, wxALL|wxEXPAND, 5 );
+	
+	wxBoxSizer* bSizerButton = new wxBoxSizer( wxHORIZONTAL );
+	
+	m_buttonGet = new wxButton( this, ID_GETCACHE, wxT("コピィ"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerButton->Add( m_buttonGet, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+	
+	m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerButton->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+	
+	bSizerTop->Add( bSizerButton, 0, wxALIGN_RIGHT, 5 );
+	
+	this->SetSizer( bSizerTop );
+	this->Layout();
+	
+	this->Centre( wxBOTH );
+}
+
+CacheGetDialog::~CacheGetDialog()
+{
+}
+
+// Event Table
+BEGIN_EVENT_TABLE( CacheGetDialog, wxDialog )
+    EVT_BUTTON( ID_GETCACHE, CacheGetDialog::OnGetCache )
+END_EVENT_TABLE()
+
+// Event Handlers & Functions
+void CacheGetDialog::OnGetCache( wxCommandEvent& WXUNUSED(event) )
+{
+    wxString fromdir = m_dirPicker->GetPath();
+
+    wxString cachedir = wxGetCwd() + wxFILE_SEP_PATH + wxT("cache");
+
+    for ( int i = 0; i < m_nocache.GetCount(); i++ ) {
+
+        wxString year = m_nocache[i].Left( 4 );
+        wxString month = m_nocache[i].Mid( 4, 2 );
+
+        if ( month.IsSameAs(wxT("01")) || month.IsSameAs(wxT("02")) || month.IsSameAs(wxT("03")) ) {
+            long y;
+            year.ToLong( &y, 10 );
+            y--;
+            year = wxString::Format( wxT("%d"), y );
+        }
+
+        wxString from = fromdir  + wxFILE_SEP_PATH + year + wxFILE_SEP_PATH + m_nocache[i];
+        wxString to   = cachedir + wxFILE_SEP_PATH + year + wxFILE_SEP_PATH + m_nocache[i];
+
+        wxArrayString files;
+        wxDir::GetAllFiles( from, &files, wxT("*.png"), wxDIR_DEFAULT );
+
+        wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), files.GetCount(), NULL, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
+        pd.SetSize( wxSize( 320, 140 ) );
+
+        for ( int j = 0; j < files.GetCount(); j++ ) {
+            wxFileName fn( files[j] );
+
+            wxString ccn = fn.GetPath().BeforeLast( wxFILE_SEP_PATH ).AfterLast( wxFILE_SEP_PATH );
+            wxString hhs = fn.GetPath().AfterLast( wxFILE_SEP_PATH );
+            wxString buf = to + wxFILE_SEP_PATH + ccn + wxFILE_SEP_PATH + hhs + wxFILE_SEP_PATH + fn.GetFullName();
+
+            wxFileName td( buf );
+            if ( !td.Exists() ) td.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
+
+            wxCopyFile( files[j], buf, true );
+            if ( j % 5 == 0 ) wxSleep( 2 ); // ディスクの負荷軽減
+
+            pd.Update( j, hhs + wxT("@") + ccn + wxT("@") + m_nocache[i] + wxT("を処理しました.") );
+        }
+    }
+
+    wxMessageBox( wxT("Getting cache done."), wxT("Message"), wxOK|wxSTAY_ON_TOP );
+    Close();
+}
+
+void CacheGetDialog::SetSyncDates( wxArrayString dates )
+{
+    m_nocache = dates;
+}
+
+// メインダイアログ
 CacheDialog::CacheDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) 
     : wxDialog( parent, id, title, pos, size, style )
 {
 	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
 	
-	wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
+	wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL );
+	
+    //
+	wxBoxSizer* bSizerList = new wxBoxSizer( wxVERTICAL );
+	
+	m_staticText = new wxStaticText( this, wxID_ANY, wxT("作成対象選択"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerList->Add( m_staticText, 0, wxALL, 5 );
 	
-	m_datePickerBgn = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
-	bSizerTop->Add( m_datePickerBgn, 0, wxALL, 5 );
+	m_listCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
+    wxListItem itemCol;
+    itemCol.SetText( wxT("通番") );
+    m_listCtrl->InsertColumn( 0, itemCol );
+    m_listCtrl->SetColumnWidth( 0, 50 );
+    itemCol.SetText( wxT("審査会年月日") );
+    m_listCtrl->InsertColumn( 1, itemCol );
+    m_listCtrl->SetColumnWidth( 1, 100 );
+    itemCol.SetText( wxT("キャッシュ有無") );
+    m_listCtrl->InsertColumn( 2, itemCol );
+    m_listCtrl->SetColumnWidth( 2, 100 );
+	bSizerList->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
 	
-	m_datePickerEnd = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
-	bSizerTop->Add( m_datePickerEnd, 0, wxALL, 5 );
+    //
+	wxBoxSizer* bSizerRange = new wxBoxSizer( wxHORIZONTAL );
+
+	m_staticTextRange = new wxStaticText( this, wxID_ANY, wxT("表示範囲指定"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerRange->Add( m_staticTextRange, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+
+	m_datePickerBgn = new wxDatePickerCtrl( this, ID_RGBGN, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
+	bSizerRange->Add( m_datePickerBgn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+	
+	m_staticTextBetween = new wxStaticText( this, wxID_ANY, wxT("~"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerRange->Add( m_staticTextBetween, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+
+	m_datePickerEnd = new wxDatePickerCtrl( this, ID_RGEND, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
+	bSizerRange->Add( m_datePickerEnd, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_buttonMake = new wxButton( this, ID_MKCACHE, wxT("作成"), wxDefaultPosition, wxDefaultSize, 0 );
-	bSizerTop->Add( m_buttonMake, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+	bSizerList->Add( bSizerRange, 0, wxALL|wxEXPAND, 5 );
+
+	bSizerTop->Add( bSizerList, 1, wxEXPAND, 5 );
+
+    //	
+	wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL );
+
+	m_buttonCache = new wxButton( this, ID_MKCACHE, wxT("作成"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerButton->Add( m_buttonCache, 0, wxALL, 5 );
 	
-	m_buttonClose = new wxButton( this, ID_CLOSE, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 );
+	m_buttonGet = new wxButton( this, ID_GET, wxT("取得"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerButton->Add( m_buttonGet, 0, wxALL, 5 );
+	
+	m_buttonClose = new wxButton( this, wxID_CANCEL, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerButton->Add( m_buttonClose, 0, wxALL, 5 );
 	m_buttonClose->SetDefault(); 
-	bSizerTop->Add( m_buttonClose, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+	
+	bSizerTop->Add( bSizerButton, 0, 0, 5 );
+	
 	
 	this->SetSizer( bSizerTop );
 	this->Layout();
-	bSizerTop->Fit( this );
 	
 	this->Centre( wxBOTH );
 }
@@ -38,8 +170,10 @@
 
 // Event Table
 BEGIN_EVENT_TABLE( CacheDialog, wxDialog )
-    EVT_BUTTON( ID_MKCACHE, CacheDialog::OnMakeCache )
-    EVT_BUTTON( ID_CLOSE,   CacheDialog::OnClose )
+    EVT_DATE_CHANGED( ID_RGBGN, CacheDialog::OnDateChange )
+    EVT_DATE_CHANGED( ID_RGEND, CacheDialog::OnDateChange )
+    EVT_BUTTON( ID_MKCACHE,     CacheDialog::OnMakeCache  )
+    EVT_BUTTON( ID_GET,         CacheDialog::OnGetCache   )
 END_EVENT_TABLE()
 
 // Event Handlers & Functions
@@ -48,46 +182,122 @@
     m_rootdir = rootdir;
     m_width   = w;
     m_height  = h;
+
+    m_datePickerBgn->SetValue( wxDateTime::Today() - wxDateSpan::Month() * 2 );
+    m_datePickerEnd->SetValue( wxDateTime::Today() );
+}
+
+void CacheDialog::Listup( void )
+{
+    nocache.Clear();
+    wxDateTime b = m_datePickerBgn->GetValue();
+    wxDateTime e = m_datePickerEnd->GetValue();
+    wxArrayString ccn = GetCcnDate();
+    
+    wxDateTime dt;
+    wxRegEx reDate( wxT("(^20[0-9]{2})([0-1][0-9])([0-3][0-9])$") );
+    m_listCtrl->DeleteAllItems();
+
+    for ( int i = 0; i < ccn.GetCount(); i++ ) {
+
+        dt.ParseFormat( ccn[i], wxT("%Y%m%d") );
+
+        if ( dt.IsBetween( b, e ) ) {
+
+            // cache exists ?
+            wxString month = dt.Format( wxT("%m") );
+            wxString year  = dt.Format( wxT("%Y") );
+
+            if ( month.IsSameAs(wxT("01")) || month.IsSameAs(wxT("02")) || month.IsSameAs(wxT("03")) ) {
+                long y;
+                year.ToLong( &y, 10 );
+                y--;
+                year = wxString::Format( wxT("%d"), y );
+            }
+            wxString cache_dir = wxGetCwd() + wxFILE_SEP_PATH + wxT("cache") + wxFILE_SEP_PATH + year + wxFILE_SEP_PATH + dt.Format( wxT("%Y%m%d") );
+
+            wxString cache_ok;
+            wxFileName cd( cache_dir );
+            if ( cd.Exists() ) 
+                cache_ok = wxT("○");
+            else
+                nocache.Insert( dt.Format( wxT("%Y%m%d") ), 0 );
+
+            m_listCtrl->InsertItem( i, -1 );
+            m_listCtrl->SetItem( i, 0, wxString::Format( wxT("%d"), i + 1 ) , -1 ); // No
+            reDate.Replace( &ccn[i], wxT("\\1-\\2-\\3") );
+            m_listCtrl->SetItem( i, 1, ccn[i], -1 );
+            if ( !cache_ok.IsEmpty() ) m_listCtrl->SetItem( i, 2, cache_ok, -1 );
+
+            if ( i % 2 ) m_listCtrl->SetItemBackgroundColour( i, wxColour( wxT("WHEAT") ) );
+        }
+    }
+}
+
+void CacheDialog::OnDateChange( wxDateEvent& WXUNUSED(event) )
+{
+    Listup();
 }
 
 void CacheDialog::OnMakeCache( wxCommandEvent& WXUNUSED(event) )	
 {
-    wxDateTime b = m_datePickerBgn->GetValue();
-    wxDateTime e = m_datePickerEnd->GetValue();
-    
-    MakeCache( b.Format( wxT("%Y%m%d")), e.Format( wxT("%Y%m%d")) );
-}
-
-void CacheDialog::MakeCache( wxString from, wxString to )
-{
-    wxArrayString path = GetPathes( from, to );
+    if ( m_listCtrl->GetSelectedItemCount() < 1 ) {
+        wxMessageBox( wxT("項目を少なくともひとつ選択してください.") );
+        return;
+    }
     wxString cachedir = wxGetCwd() + wxFILE_SEP_PATH + wxT("cache");
 
-    for ( int i = 0; i < path.GetCount(); i++ ) {
+    long item = -1;
+    bool done = false;
+    for ( ;; ) {
+        item = m_listCtrl->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+        if ( item == -1 ) break;
 
-        wxArrayString files;
-        wxDir::GetAllFiles( path[i], &files, wxT("*.jpg"), wxDIR_DEFAULT );
+        wxString c = m_listCtrl->GetItemText( item, 2 );
+        if ( c.IsEmpty() ) {
+            wxString date = m_listCtrl->GetItemText( item, 1 );
+            date.Replace( wxT("-"), wxEmptyString, true );
 
-        for ( int j = 0; j < files.GetCount(); j++ ) {
-            wxImage image( files[j], wxBITMAP_TYPE_JPEG );
-            wxImage output = image.Scale( m_width, m_height, wxIMAGE_QUALITY_HIGH );
+            wxArrayString path = GetPathesByDate( date );
+
+            wxProgressDialog pd( wxT("進行状況"), wxT("処理開始..."), path.GetCount(), NULL, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
+            pd.SetSize( wxSize( 320, 140 ) );
+
+            for ( int i = 0; i < path.GetCount(); i++ ) {
 
-            wxString buf = files[j];
-            buf.Replace( m_rootdir, cachedir, false );
-            buf = buf.BeforeLast( '.' ) + wxT(".png");
+                wxArrayString files;
+                wxDir::GetAllFiles( path[i], &files, wxT("*.jpg"), wxDIR_DEFAULT );
+
+                for ( int j = 0; j < files.GetCount(); j++ ) {
+                    wxImage image( files[j], wxBITMAP_TYPE_JPEG );
+                    wxImage output = image.Scale( m_width, m_height, wxIMAGE_QUALITY_HIGH );
 
-            wxFileName tf( buf );
-            if ( !tf.Exists() ) tf.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
-            output.SaveFile( buf, wxBITMAP_TYPE_PNG );
+                    wxString buf = files[j];
+                    buf.Replace( m_rootdir, cachedir, false );
+                    buf = buf.BeforeLast( '.' ) + wxT(".png");
+
+                    wxFileName tf( buf );
+                    if ( !tf.Exists() ) tf.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
+                    output.SaveFile( buf, wxBITMAP_TYPE_PNG );
+                }
+                pd.Update( i, path[i] + wxT("を処理しました.") );
+                wxSleep( 10 );
+            }
+            done = true;
         }
-        wxSleep( 30 );
     }
 
-    wxMessageBox( wxT("cache updated.") );
+    if ( done ) {
+        wxMessageBox( wxT("cache updated."), wxT("Message"), wxOK|wxSTAY_ON_TOP );
+        Listup();
+    }
 }
 
-void CacheDialog::OnClose( wxCommandEvent& WXUNUSED(event) )
+void CacheDialog::OnGetCache( wxCommandEvent& WXUNUSED(event) )
 {
-    Close();
+    CacheGetDialog* cd = new CacheGetDialog( this, wxID_ANY, wxT("キャッシュ取得"), wxDefaultPosition, wxSize( 500, 100 ), wxCAPTION|wxFRAME_NO_TASKBAR );
+    cd->SetSyncDates( nocache );
+    cd->ShowModal();
+    Listup();
 }
 
--- a/src/db.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/db.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : db.cpp
-// Last Change: 23-May-2014.
+// Last Change: 12-Dec-2014.
 //
 
 #include <wx/tokenzr.h>
@@ -243,13 +243,14 @@
     wxSQLite3Database ccndb;
     ccndb.Open( gszFile );
 
-    wxSQLite3Statement stmt = ccndb.PrepareStatement( "SELECT date, count(*) FROM ccn GROUP BY date ORDER BY date desc" );
+    wxSQLite3Statement stmt = ccndb.PrepareStatement( "SELECT date, count(*) FROM path GROUP BY date ORDER BY date desc" );
     wxSQLite3ResultSet q = stmt.ExecuteQuery();
 
     wxString str;
     if ( !q.IsNull(0) ) {
         while ( q.NextRow() ) {
-            str = q.GetString(0) + "_" + q.GetString(1);
+            //str = q.GetString(0) + "_" + q.GetString(1);
+            str = q.GetString(0);
             date_cnt.Add( str );
         }
     }
@@ -285,8 +286,8 @@
     return data;
 }
 
-/* 範囲日時のパスを取得 */
-wxArrayString GetPathes( wxString from, wxString to )
+/* 指定した範囲の日付のパスを取得 */
+wxArrayString GetPathesByPeriod( wxString from, wxString to )
 {
     wxArrayString path;
 
@@ -310,6 +311,30 @@
     return path;
 }
 
+/* 指定日のパスを取得 */
+wxArrayString GetPathesByDate( wxString date )
+{
+    wxArrayString path;
+
+    wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db");
+    wxSQLite3Database ccndb;
+    ccndb.Open( gszFile );
+
+    wxSQLite3Statement stmt = ccndb.PrepareStatement( "SELECT path FROM path WHERE date = ?" );
+    stmt.Bind( 1, date );
+    wxSQLite3ResultSet q = stmt.ExecuteQuery();
+
+    if ( !q.IsNull(0) ) {
+        while ( q.NextRow() ) {
+            path.Add( q.GetString(0) );
+        }
+    }
+    stmt.Finalize();
+    ccndb.Close();
+
+    return path;
+}
+
 /* 合議体から被保険者番号を取得 */
 wxArrayString GetHhsNoByCcn( wxString ccn, wxString date ) 
 {
--- a/src/hhsdb.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/hhsdb.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : hhsdb.cpp
-// Last Change: 23-May-2014.
+// Last Change: 12-Dec-2014.
 //
 
 #include "hhsdb.h"
@@ -11,14 +11,12 @@
 	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
     this->SetBackgroundColour( wxColour( wxT("WHEAT") ) );
 	
-	wxBoxSizer* bSizerTop;
-	bSizerTop = new wxBoxSizer( wxVERTICAL );
+	wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
 	
-	m_filePicker = new wxFilePickerCtrl( this, ID_FPICKR, wxEmptyString, wxT("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_USE_TEXTCTRL );
+	m_filePicker = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_USE_TEXTCTRL );
 	bSizerTop->Add( m_filePicker, 0, wxALL|wxEXPAND, 5 );
 	
-	wxBoxSizer* bSizerButton;
-	bSizerButton = new wxBoxSizer( wxHORIZONTAL );
+	wxBoxSizer* bSizerButton = new wxBoxSizer( wxHORIZONTAL );
 	
 	m_buttonUpdate = new wxButton( this, ID_UPDATE, wxT("更新処理開始"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerButton->Add( m_buttonUpdate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
--- a/src/kana.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/kana.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : kana.cpp
-// Last Change: 22-Aug-2013.
+// Last Change: 12-Dec-2014.
 //
 
 #include "kana.h"
@@ -20,10 +20,10 @@
 	m_searchCtrl->ShowSearchButton( true );
 	#endif
 	m_searchCtrl->ShowCancelButton( false );
-	bSizerSearch->Add( m_searchCtrl, 1, wxALL|wxEXPAND, 5 );
+	bSizerSearch->Add( m_searchCtrl, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 
     m_checkBox = new wxCheckBox( this, ID_FUZZY, wxT("部分一致"), wxDefaultPosition, wxDefaultSize, 0 );
-	bSizerSearch->Add( m_checkBox, 0, wxALL|wxEXPAND, 5 );
+	bSizerSearch->Add( m_checkBox, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
 
 	bSizerTop->Add( bSizerSearch, 0, wxALL|wxEXPAND, 5 );
 	
@@ -71,9 +71,11 @@
 
     this->Centre( wxBOTH );
 
+    wxString message = wxT("全角で入力してネ! (性と名の間は全角スペースで)");
+    m_searchCtrl->SetDescriptiveText( message );
+    m_searchCtrl->SetValue( message );
+    m_searchCtrl->SelectAll();
     m_searchCtrl->SetFocus();
-    m_searchCtrl->SetValue( wxT("全角で入力してネ! (性と名の間は全角スペースで)") );
-    m_searchCtrl->SelectAll();
 }
 
 KanaDialog::~KanaDialog()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/miniframe.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -0,0 +1,251 @@
+// Filename   : mini.cpp
+// Last Change: 12-Dec-2014.
+//
+#include "main.h"
+#include "db.h"
+#include "hhsdb.h"
+#include "miniframe.h"
+#include "update.h"
+
+///////////////////////////////////////////////////////////////
+// カスタム検索ボックス
+MiniSearchBox::MiniSearchBox( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style )
+    : wxSearchCtrl( parent, id, value, pos, size, style )
+{
+    SetMaxLength( 11 );
+	#ifndef __WXMAC__
+	ShowSearchButton( true );
+	#endif
+	ShowCancelButton( false );
+}
+ 
+MiniSearchBox::~MiniSearchBox()
+{
+}
+
+// Event Table
+BEGIN_EVENT_TABLE( MiniSearchBox, wxSearchCtrl )
+    EVT_CHAR( MiniSearchBox::OnKey )
+END_EVENT_TABLE()
+
+// Event Handlers & Functions
+void MiniSearchBox::OnKey( wxKeyEvent& event )
+{
+    int kc = event.GetKeyCode();
+    wxString s = GetValue();
+
+    if ( kc == 13 ) {
+        event.Skip();
+        return;
+    }
+
+    if (  kc == 45 ) {   // テンキーの '-' キーで1文字削除
+        wxString t = GetStringSelection();
+        if ( t.IsEmpty() ) {
+            long p = GetInsertionPoint();
+            if ( p > 0 ) Remove( p - 1, p );
+        }
+        else {
+            Cut();
+        }
+        return;
+    }
+
+    if ( kc == WXK_ESCAPE ) {    // clear by ESC
+        this->Clear();
+        return;
+    }
+
+    Cut();
+    event.Skip();
+}
+
+
+///////////////////////////////////////////////////////////////
+// メインフレーム
+
+// resources
+#if !defined(__WXMSW__) && !defined(__WXPM__)
+    #include "sample.xpm"
+#endif
+
+MiniFrame::MiniFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
+    : wxFrame( parent, id, title, pos, size, style )
+{
+	this->SetSizeHints( wxSize( 100, 45 ), wxSize( 100, 45 ) );
+    this->SetBackgroundColour( wxColour(wxT("WHITE")) );
+	
+    // set the frame icon
+    SetIcon(wxICON(sample));
+
+    //
+	wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL );
+	
+	m_staticText = new wxStaticText( this, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, 0 );
+	bSizerTop->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0 );
+	
+	m_searchBox = new MiniSearchBox( this, ID_MSEARCH, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
+    m_searchBox->SetFocus();
+	bSizerTop->Add( m_searchBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 0 );
+	
+    //
+	this->SetSizer( bSizerTop );
+	this->Layout();
+
+	this->Centre( wxBOTH );
+    LoadParam();
+    if ( CheckNewFiles( m_shared ) != 0 )
+        Close();
+}
+
+MiniFrame::~MiniFrame()
+{
+}
+
+// Event Table
+BEGIN_EVENT_TABLE( MiniFrame, wxFrame )
+    EVT_TEXT_ENTER( ID_MSEARCH, MiniFrame::OnCommand )
+END_EVENT_TABLE()
+
+// Event Handlers & Functions
+/* エンターキーフック */
+void MiniFrame::OnCommand( wxCommandEvent& event )
+{
+    wxString s = m_searchBox->GetLineText(0);
+
+    if ( s.IsSameAs( wxT(".") ) ) {
+        OpenAppDir();
+        return;
+    }
+
+    if ( s.IsSameAs( wxT("z") ) ) {
+        Transform( wxT("full mode") );
+        return;
+    }
+
+    if ( s.StartsWith( wxT("9") ) || s.IsSameAs( wxT("q") ) ) {
+        Close();
+        return;
+    }
+
+    wxRegEx reHhs( wxT("^0[1238][0-9]{8}.?$") );
+    if ( reHhs.Matches( s ) ) {
+
+        if ( s.Len() == 10 ) {
+            m_hhsno = s;
+        }
+        else {
+            m_hhsno = s.Left( 10 );
+        }
+
+        wxArrayString pathes = GetPathByHhsNo( m_hhsno );
+        if ( pathes.IsEmpty() ) {
+            m_searchBox->SetValue( wxT("No data.") );
+            m_searchBox->SelectAll();
+        }
+        else {
+            if ( s.Right( 1 ).IsSameAs( wxT("+") ) ) {
+                PrintImages( pathes[0] );
+                return;
+            }
+            OpenHhsDir( pathes[0] );
+        }
+        return;
+    }
+    m_searchBox->SelectAll();
+}
+/* パラメータを設定ファイルから読み込む */
+void MiniFrame::LoadParam( void )
+{
+    conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf");
+    config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
+
+    int x, y;
+
+    // Shaerd
+    config->SetPath( wxT("/Index") );
+    config->Read( wxT("shared"), &m_shared );
+
+}
+/* アプリフォルダを開く */
+void MiniFrame::OnOpenAppDir( wxCommandEvent& WXUNUSED(event) )
+{
+    OpenAppDir();
+}
+void MiniFrame::OpenAppDir( ) 
+{
+    wxString appdir = wxGetCwd();
+    wxString execmd = wxT("explorer ") + appdir;
+    wxExecute( execmd );
+}
+/* 被保険者フォルダを開く */
+void MiniFrame::OpenHhsDir( wxString path ) 
+{
+    wxString execmd = wxT("explorer ") + path;
+    wxExecute( execmd );
+}
+/* 印刷 */
+void MiniFrame::PrintImages( wxString path )
+{
+    wxDir dir( path );
+    if ( !dir.IsOpened() ) return;
+
+    wxString html;
+    html = html + wxT("<html><body>\n");
+
+    wxString file;
+    bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES );
+    int n = 0;
+    wxString tmpdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH;
+    while ( cout ) {
+        file = path + wxFILE_SEP_PATH + file;
+        file.Replace( wxFILE_SEP_PATH, wxT("/") );
+        wxString tmpjpg = wxString::Format( wxT("%stmp%d.jpg"), tmpdir, n );
+        wxCopyFile( file, tmpjpg, true );
+        html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>");
+        html = html + wxT("<div align=right><font size=-2><u>") + path.Right( 10 ) + wxT("</u></font></div>");
+        cout = dir.GetNext( &file );
+        n++;
+    }
+    html = html + wxT("</body></html>");
+
+    // start printing
+    wxHtmlPrintout hpout( wxT("Searcher03") );
+    hpout.SetMargins( 0, 0, 0, 0, 0 );
+    wxPrintDialogData pd;
+    wxPrinter p( &pd );
+
+    hpout.SetHtmlText( html, wxEmptyString, false );
+    p.Print( NULL, &hpout, true );
+}
+/* フルモードに変形 */
+void MiniFrame::Transform( wxString mode )
+{
+    wxTextFile textfile;
+    textfile.Open( wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf") );
+    for ( int i=0; i<textfile.GetLineCount(); i++ ) {
+        if ( textfile[i].StartsWith( wxT("mode=") ) ) {
+            textfile.RemoveLine( i );
+            textfile.InsertLine( wxT("mode=0"), i );
+        }
+    }
+    textfile.Write();
+    textfile.Close();
+
+    Show( false );
+    wxExecute( wxT("searcher03.exe") );
+    wxSleep( 1 );
+
+    textfile.Open( wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf") );
+    for ( int i=0; i<textfile.GetLineCount(); i++ ) {
+        if ( textfile[i].StartsWith( wxT("mode=") ) ) {
+            textfile.RemoveLine( i );
+            textfile.InsertLine( wxT("mode=1"), i );
+        }
+    }
+    textfile.Write();
+    textfile.Close();
+
+    Close();
+}
+
--- a/src/myframe.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/myframe.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.cpp
-// Last Change: 08-Dec-2014.
+// Last Change: 16-Dec-2014.
 //
 #include "main.h"
 #include "db.h"
@@ -21,6 +21,14 @@
 MySearchBox::MySearchBox( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style )
     : wxSearchCtrl( parent, id, value, pos, size, style )
 {
+    SetMaxLength( 10 );
+	#ifndef __WXMAC__
+	ShowSearchButton( true );
+	#endif
+	ShowCancelButton( false );
+
+    wxFont font( 12, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
+    SetFont( font );
 }
  
 MySearchBox::~MySearchBox()
@@ -149,6 +157,19 @@
 }
 
 // Functions
+/* 初期化 */
+void ThumbnailPanel::Initialize( void )
+{
+    wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
+    wxBitmap bmp = wxBitmap( thumb, wxBITMAP_TYPE_PNG );
+	
+    m_bitmap0->SetBitmap( bmp );
+    m_bitmap1->SetBitmap( bmp );
+    m_bitmap2->SetBitmap( bmp );
+    m_bitmap3->SetBitmap( bmp );
+    m_bitmap4->SetBitmap( bmp );
+    m_bitmap5->SetBitmap( bmp );
+}
 /* サムネイル表示 */
 void ThumbnailPanel::SetCacheImages( wxString dirpath )
 {
@@ -156,7 +177,10 @@
     wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
 
     wxDir dir( dirpath );
-    if ( !dir.IsOpened() ) return;
+    if ( !dir.IsOpened() ) {
+        Initialize();
+        return;
+    }
 
     m_imagefiles.Clear();
     wxDir::GetAllFiles( dirpath, &m_imagefiles, wxT("*.jpg"), wxDIR_FILES );
@@ -165,13 +189,7 @@
     wxString cachedir = wxT("cache") + dirpath.AfterLast( ':' );
     wxDir cdir( cachedir );
     if ( !cdir.IsOpened() ) {
-        bmp.LoadFile( thumb, wxBITMAP_TYPE_PNG );
-        m_bitmap0->SetBitmap( bmp );
-        m_bitmap1->SetBitmap( bmp );
-        m_bitmap2->SetBitmap( bmp );
-        m_bitmap3->SetBitmap( bmp );
-        m_bitmap4->SetBitmap( bmp );
-        m_bitmap5->SetBitmap( bmp );
+        Initialize();
         return;
     }
 
@@ -315,14 +333,10 @@
 	m_staticText = new wxStaticText( m_panelMain, wxID_ANY, wxT("コマンド?"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerCmd->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_searchBox = new MySearchBox( m_panelMain, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
+	m_searchBox = new MySearchBox( m_panelMain, ID_SEARCH, wxEmptyString, wxDefaultPosition, wxSize( -1, 24 ), wxTE_PROCESS_ENTER );
     m_searchBox->SetJudgedHhs( GetJudgedHhsNo() );
-	#ifndef __WXMAC__
-	m_searchBox->ShowSearchButton( true );
-	#endif
-	m_searchBox->ShowCancelButton( false );
     m_searchBox->SetFocus();
-	bSizerCmd->Add( m_searchBox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
+	bSizerCmd->Add( m_searchBox, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_buttonPaste = new wxButton( m_panelMain, ID_PASTE, wxT("貼付検索"), wxDefaultPosition, wxSize( 65, -1 ), 0 );
 	bSizerCmd->Add( m_buttonPaste, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
@@ -331,7 +345,7 @@
 	bSizerCmd->Add( m_buttonKana, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_buttonHist = new wxButton( m_panelMain, ID_HIST, wxT("検索履歴"), wxDefaultPosition, wxSize( 65, -1 ), 0 );
-	bSizerCmd->Add( m_buttonHist, 0, wxALL, 5 );
+	bSizerCmd->Add( m_buttonHist, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
     //
 	bSizerMain->Add( bSizerCmd, 0, wxEXPAND, 5 );
@@ -596,6 +610,7 @@
 
     CacheDialog* cache = new CacheDialog( this, wxID_ANY, wxT("キャッシュ作成"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxSTAY_ON_TOP );
     cache->Setting( rootdir, THUMB_W, THUMB_H );
+    cache->Listup();
     cache->ShowModal();
 }
 /* 被保険者DB更新 */
@@ -763,7 +778,7 @@
 /* カナ検索ダイアログ */
 void MyFrame::OnKana( wxCommandEvent& WXUNUSED(event) )
 {
-    KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 640, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
+    KanaDialog* kana = new KanaDialog( this, wxID_ANY, wxT("カナ氏名で被保番を検索"), wxDefaultPosition, wxSize( 680, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR|wxRESIZE_BORDER|wxSTAY_ON_TOP|wxTAB_TRAVERSAL );
     kana->ShowWithEffect( wxSHOW_EFFECT_SLIDE_TO_BOTTOM );
 
     if ( kana->ShowModal() == wxID_OK ) {
@@ -815,13 +830,13 @@
         return;
     }
 
-    wxRegEx reDate(wxT("(^.*20[0-9]{2}.)(20[0-9]{2})([0-2][0-9])([0-9]{2})(.*$)"));
+    wxRegEx reDate( wxT("(^.*20[0-9]{2}.)(20[0-9]{2})([0-1][0-9])([0-3][0-9])(.*$)") );
     for ( int i = 0; i < path.GetCount(); i++ ) {
         wxString date = path[i];
         reDate.ReplaceAll( &date, wxT("\\2-\\3-\\4") );
 
         m_listCtrl->InsertItem( i, -1 );
-        m_listCtrl->SetItem( i, 0,wxString::Format( wxT("%d"), i + 1 ) , -1 ); // No
+        m_listCtrl->SetItem( i, 0, wxString::Format( wxT("%d"), i + 1 ) , -1 ); // No
         m_listCtrl->SetItem( i, 1, date, -1 );
         m_listCtrl->SetItem( i, 2, path[i], -1 );
 
@@ -908,7 +923,7 @@
 /* アバウトダイアログ */
 void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
 {
-    AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize(320,280), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP ); 
+    AboutDialog* aboutDlg = new AboutDialog( this, wxID_ANY, wxT("About this Software"), wxDefaultPosition, wxSize( 360, 280 ), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP ); 
     aboutDlg->ShowModal();
 }
 
--- a/src/wxsqlite3.cpp	Mon Dec 08 19:47:42 2014 +0900
+++ b/src/wxsqlite3.cpp	Wed Dec 17 00:52:43 2014 +0900
@@ -97,6 +97,19 @@
 #include "wx/wxsqlite3dyn.h"
 #undef DYNFUNC
 
+#else
+// Define Windows specific SQLite API functions (not defined in sqlite3.h)
+#if SQLITE_VERSION_NUMBER >= 3007014
+#if defined(__WXMSW__)
+#ifdef __cplusplus
+extern "C" {
+#endif
+SQLITE_API int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue);
+#ifdef __cplusplus
+}
+#endif
+#endif
+#endif
 #endif // wxUSE_DYNAMIC_SQLITE3_LOAD
 
 // Error messages
@@ -137,10 +150,11 @@
 
 const char* wxERRMSG_INITIALIZE    = wxTRANSLATE("Initialization of SQLite failed");
 const char* wxERRMSG_SHUTDOWN      = wxTRANSLATE("Shutdown of SQLite failed");
-
-const char* wxERRMSG_SOURCEDB_BUSY = wxTRANSLATE("Source database is busy");
-const char* wxERRMSG_DBOPEN_FAILED = wxTRANSLATE("Database open failed");
-const char* wxERRMSG_DBCLOSE_FAILED = wxTRANSLATE("Database close failed");
+const char* wxERRMSG_TEMPDIR       = wxTRANSLATE("Setting temporary directory failed");
+
+const char* wxERRMSG_SOURCEDB_BUSY   = wxTRANSLATE("Source database is busy");
+const char* wxERRMSG_DBOPEN_FAILED   = wxTRANSLATE("Database open failed");
+const char* wxERRMSG_DBCLOSE_FAILED  = wxTRANSLATE("Database close failed");
 const char* wxERRMSG_DBASSIGN_FAILED = wxTRANSLATE("Database assignment failed");
 const char* wxERRMSG_FINALIZE_FAILED = wxTRANSLATE("Finalize failed");
 #else
@@ -179,10 +193,11 @@
 
 const wxChar* wxERRMSG_INITIALIZE    = wxTRANSLATE("Initialization of SQLite failed");
 const wxChar* wxERRMSG_SHUTDOWN      = wxTRANSLATE("Shutdown of SQLite failed");
+const wxChar* wxERRMSG_TEMPDIR       = wxTRANSLATE("Setting temporary directory failed");
 
 const wxChar* wxERRMSG_SOURCEDB_BUSY   = wxTRANSLATE("Source database is busy");
 const wxChar* wxERRMSG_DBOPEN_FAILED   = wxTRANSLATE("Database open failed");
-const wxChar* wxERRMSG_DBCLOSE_FAILED   = wxTRANSLATE("Database close failed");
+const wxChar* wxERRMSG_DBCLOSE_FAILED  = wxTRANSLATE("Database close failed");
 const wxChar* wxERRMSG_DBASSIGN_FAILED = wxTRANSLATE("Database assignment failed");
 const wxChar* wxERRMSG_FINALIZE_FAILED = wxTRANSLATE("Finalize failed");
 #endif
@@ -2206,6 +2221,16 @@
 #endif
 }
 
+int wxSQLite3Statement::Status(wxSQLite3StatementStatus opCode, bool resetFlag)
+{
+  int count = 0;
+#if SQLITE_VERSION_NUMBER >= 3007000
+  CheckStmt();
+  count = sqlite3_stmt_status(m_stmt->m_stmt, (int) opCode, (resetFlag) ? 1 : 0 );
+#endif
+  return count;
+}
+
 void wxSQLite3Statement::CheckDatabase()
 {
   if (m_db == NULL || m_db->m_db == NULL || !m_db->m_isValid)
@@ -3503,24 +3528,38 @@
 #endif
 }
 
-bool wxSQLite3Database::CreateFunction(const wxString& funcName, int argCount, wxSQLite3ScalarFunction& function)
+bool wxSQLite3Database::CreateFunction(const wxString& funcName, int argCount, wxSQLite3ScalarFunction& function, bool isDeterministic)
 {
   CheckDatabase();
   wxCharBuffer strFuncName = funcName.ToUTF8();
   const char* localFuncName = strFuncName;
+  int flags = SQLITE_UTF8;
+#if SQLITE_VERSION_NUMBER >= 3008003
+  if (isDeterministic)
+  {
+    flags |= SQLITE_DETERMINISTIC;
+  }
+#endif
   int rc = sqlite3_create_function(m_db->m_db, localFuncName, argCount,
-                                   SQLITE_UTF8, &function,
+                                   flags, &function,
                                    (void (*)(sqlite3_context*,int,sqlite3_value**)) wxSQLite3FunctionContext::ExecScalarFunction, NULL, NULL);
   return rc == SQLITE_OK;
 }
 
-bool wxSQLite3Database::CreateFunction(const wxString& funcName, int argCount, wxSQLite3AggregateFunction& function)
+bool wxSQLite3Database::CreateFunction(const wxString& funcName, int argCount, wxSQLite3AggregateFunction& function, bool isDeterministic)
 {
   CheckDatabase();
   wxCharBuffer strFuncName = funcName.ToUTF8();
   const char* localFuncName = strFuncName;
+  int flags = SQLITE_UTF8;
+#if SQLITE_VERSION_NUMBER >= 3008003
+  if (isDeterministic)
+  {
+    flags |= SQLITE_DETERMINISTIC;
+  }
+#endif
   int rc = sqlite3_create_function(m_db->m_db, localFuncName, argCount,
-                                   SQLITE_UTF8, &function,
+                                   flags, &function,
                                    NULL,
                                    (void (*)(sqlite3_context*,int,sqlite3_value**)) wxSQLite3FunctionContext::ExecAggregateStep,
                                    (void (*)(sqlite3_context*)) wxSQLite3FunctionContext::ExecAggregateFinalize);
@@ -3916,6 +3955,31 @@
 }
 
 /* static */
+bool wxSQLite3Database::SetTemporaryDirectory(const wxString& tempDirectory)
+{
+  bool ok = false;
+#if SQLITE_VERSION_NUMBER >= 3007014
+#if defined(__WXMSW__)
+  DWORD SQLITE_WIN32_TEMP_DIRECTORY_TYPE = 2; 
+#if wxUSE_UNICODE
+  const wxChar* zValue = tempDirectory.wc_str();
+#else
+  const wxWCharBuffer zValue = tempDirectory.wc_str(wxConvLocal);
+#endif
+  int rc = sqlite3_win32_set_directory(SQLITE_WIN32_TEMP_DIRECTORY_TYPE, zValue);
+  ok = (rc == SQLITE_OK);
+#if 0
+  if (rc != SQLITE_OK)
+  {
+    throw wxSQLite3Exception(rc, wxERRMSG_TEMPDIR);
+  }
+#endif
+#endif
+#endif
+  return ok;
+}
+
+/* static */
 bool wxSQLite3Database::Randomness(int n, wxMemoryBuffer& random)
 {
   bool ok = false;
@@ -4232,7 +4296,8 @@
   wxT("SQLITE_SELECT"),            wxT("SQLITE_TRANSACTION"),       wxT("SQLITE_UPDATE"),
   wxT("SQLITE_ATTACH"),            wxT("SQLITE_DETACH"),            wxT("SQLITE_ALTER_TABLE"),
   wxT("SQLITE_REINDEX"),           wxT("SQLITE_ANALYZE"),           wxT("SQLITE_CREATE_VTABLE"),
-  wxT("SQLITE_DROP_VTABLE"),       wxT("SQLITE_FUNCTION"),          wxT("SQLITE_SAVEPOINT")
+  wxT("SQLITE_DROP_VTABLE"),       wxT("SQLITE_FUNCTION"),          wxT("SQLITE_SAVEPOINT"),
+  wxT("SQLITE_RECURSIVE")
 };