diff src/db.cpp @ 21:a2ad87cad48b

Enhanced the convenience of Cache dialog.
author pyon@macmini
date Wed, 17 Dec 2014 00:52:43 +0900
parents bbd65edf71d4
children
line wrap: on
line diff
--- 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 ) 
 {