comparison src/db.cpp @ 8:4967d1e2b30c

Alert when not mask in batch print mode.
author pyon@macmini
date Fri, 01 Nov 2013 18:44:37 +0900
parents 7ac7d28699af
children b455f2d8aac9
comparison
equal deleted inserted replaced
7:7ac7d28699af 8:4967d1e2b30c
1 // Filename : db.cpp 1 // Filename : db.cpp
2 // Last Change: 16-Oct-2013. 2 // Last Change: 01-Nov-2013.
3 // 3 //
4 4
5 #include "db.h" 5 #include "db.h"
6 #include "wx/wxsqlite3.h" 6 #include "wx/wxsqlite3.h"
7 7
195 195
196 return hhsno; 196 return hhsno;
197 } 197 }
198 198
199 /* インデックスを更新 */ 199 /* インデックスを更新 */
200 void UpdateIndex( wxString datedir, wxString date ) 200 void UpdateIndex( wxString datadir, wxString date )
201 { 201 {
202 wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); 202 wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db");
203 wxSQLite3Database ccndb; 203 wxSQLite3Database ccndb;
204 ccndb.Open( gszFile ); 204 ccndb.Open( gszFile );
205 205
207 stmt.Bind( 1, date ); 207 stmt.Bind( 1, date );
208 stmt.ExecuteQuery(); 208 stmt.ExecuteQuery();
209 stmt.Finalize(); 209 stmt.Finalize();
210 210
211 wxString ccndir; 211 wxString ccndir;
212 wxDir dated( datedir ); 212 wxDir dated( datadir );
213 if ( !dated.IsOpened() ) { 213 if ( !dated.IsOpened() ) {
214 return; 214 return;
215 } 215 }
216 216
217 wxRegEx reSinsei( wxT("^00000") ); 217 wxRegEx reSinsei( wxT("^00000") );
221 pd.SetSize( wxSize( 320, 140 ) ); 221 pd.SetSize( wxSize( 320, 140 ) );
222 int count = 0; 222 int count = 0;
223 223
224 while ( cont ) { 224 while ( cont ) {
225 225
226 wxDir ccnd( datedir + wxFILE_SEP_PATH + ccndir ); 226 wxDir ccnd( datadir + wxFILE_SEP_PATH + ccndir );
227 if ( !ccnd.IsOpened() ) return; 227 if ( !ccnd.IsOpened() ) return;
228 wxString hhsdir; 228 wxString hhsdir;
229 bool c = ccnd.GetFirst( &hhsdir, wxEmptyString, wxDIR_DIRS ); 229 bool c = ccnd.GetFirst( &hhsdir, wxEmptyString, wxDIR_DIRS );
230 230
231 while ( c ) { 231 while ( c ) {
232 if ( ! reSinsei.Matches( hhsdir ) ) { 232 if ( ! reSinsei.Matches( hhsdir ) ) {
233 233
234 wxString path = datedir + wxFILE_SEP_PATH + ccndir + wxFILE_SEP_PATH + hhsdir; 234 wxString path = datadir + wxFILE_SEP_PATH + ccndir + wxFILE_SEP_PATH + hhsdir;
235 235
236 stmt = ccndb.PrepareStatement( "INSERT INTO path VALUES( ?, ?, ?, datetime( 'now', 'localtime' ) );" ); 236 stmt = ccndb.PrepareStatement( "INSERT INTO path VALUES( ?, ?, ?, datetime( 'now', 'localtime' ) );" );
237 stmt.Bind( 1, hhsdir ); 237 stmt.Bind( 1, hhsdir );
238 stmt.Bind( 2, path ); 238 stmt.Bind( 2, path );
239 stmt.Bind( 3, date ); 239 stmt.Bind( 3, date );