Mercurial > mercurial > hgweb_searcher03.cgi
diff src/db.cpp @ 9:b455f2d8aac9
Implement Preview.
author | pyon@macmini |
---|---|
date | Thu, 24 Apr 2014 18:31:39 +0900 |
parents | 4967d1e2b30c |
children | dfcf8c973219 |
line wrap: on
line diff
--- a/src/db.cpp Fri Nov 01 18:44:37 2013 +0900 +++ b/src/db.cpp Thu Apr 24 18:31:39 2014 +0900 @@ -1,5 +1,5 @@ // Filename : db.cpp -// Last Change: 01-Nov-2013. +// Last Change: 16-Apr-2014. // #include "db.h" @@ -35,6 +35,39 @@ } } +// 被保険者番号リストから氏名を取得 +wxArrayString GetHhsInfoByHhsNoList( wxArrayString hhsno ) +{ + wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("hhs.db"); + wxSQLite3Database hhsdb; + hhsdb.Open( gszFile ); + + wxString sql = wxT( "SELECT name FROM hhs_master WHERE hhsno = ?;" ); + wxSQLite3Statement stmt; + wxSQLite3ResultSet q; + + wxArrayString result; + for ( unsigned int i = 0; i < hhsno.GetCount(); i++ ) { + wxString str = hhsno[i]; + str.Append( wxT("_") ); + + stmt = hhsdb.PrepareStatement( sql ); + stmt.Bind( 1, hhsno[i] ); + q = stmt.ExecuteQuery(); + if ( !q.IsNull(0) ) { + while ( q.NextRow() ) { + str.Append( q.GetString(0) ); + } + } + + result.Add( str ); + } + stmt.Finalize(); + hhsdb.Close(); + + return result; +} + // 氏名カナで被保険者情報を検索 wxArrayString GetHhsInfoByKana( wxString kana, bool fuzzy ) { @@ -99,6 +132,31 @@ return path; } +// 審査会情報のある被保険者を取得 +wxArrayString GetJudgedHhsNo( void ) +{ + wxArrayString hhsno; + + wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); + wxSQLite3Database ccndb; + ccndb.Open( gszFile ); + + //wxString sql = wxT( "SELECT DISTINCT hhsno FROM path;" ); + wxString sql = wxT( "SELECT hhsno FROM path ORDER BY path DESC LIMIT 200;" ); + wxSQLite3Statement stmt = ccndb.PrepareStatement( sql ); + wxSQLite3ResultSet q = stmt.ExecuteQuery(); + + if ( !q.IsNull(0) ) { + while ( q.NextRow() ) { + hhsno.Add( q.GetString(0) ); + } + } + stmt.Finalize(); + ccndb.Close(); + + return hhsno; +} + /* 被保険者が審査会にかかったかどうか */ bool IsHhsJudged( wxString hhsno ) {