Mercurial > mercurial > hgweb_searcher03.cgi
comparison src/db.cpp @ 9:b455f2d8aac9
Implement Preview.
author | pyon@macmini |
---|---|
date | Thu, 24 Apr 2014 18:31:39 +0900 |
parents | 4967d1e2b30c |
children | dfcf8c973219 |
comparison
equal
deleted
inserted
replaced
8:4967d1e2b30c | 9:b455f2d8aac9 |
---|---|
1 // Filename : db.cpp | 1 // Filename : db.cpp |
2 // Last Change: 01-Nov-2013. | 2 // Last Change: 16-Apr-2014. |
3 // | 3 // |
4 | 4 |
5 #include "db.h" | 5 #include "db.h" |
6 #include "wx/wxsqlite3.h" | 6 #include "wx/wxsqlite3.h" |
7 | 7 |
31 return wxEmptyString; | 31 return wxEmptyString; |
32 } | 32 } |
33 else { | 33 else { |
34 return name + wxT("_") + addr; | 34 return name + wxT("_") + addr; |
35 } | 35 } |
36 } | |
37 | |
38 // 被保険者番号リストから氏名を取得 | |
39 wxArrayString GetHhsInfoByHhsNoList( wxArrayString hhsno ) | |
40 { | |
41 wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("hhs.db"); | |
42 wxSQLite3Database hhsdb; | |
43 hhsdb.Open( gszFile ); | |
44 | |
45 wxString sql = wxT( "SELECT name FROM hhs_master WHERE hhsno = ?;" ); | |
46 wxSQLite3Statement stmt; | |
47 wxSQLite3ResultSet q; | |
48 | |
49 wxArrayString result; | |
50 for ( unsigned int i = 0; i < hhsno.GetCount(); i++ ) { | |
51 wxString str = hhsno[i]; | |
52 str.Append( wxT("_") ); | |
53 | |
54 stmt = hhsdb.PrepareStatement( sql ); | |
55 stmt.Bind( 1, hhsno[i] ); | |
56 q = stmt.ExecuteQuery(); | |
57 if ( !q.IsNull(0) ) { | |
58 while ( q.NextRow() ) { | |
59 str.Append( q.GetString(0) ); | |
60 } | |
61 } | |
62 | |
63 result.Add( str ); | |
64 } | |
65 stmt.Finalize(); | |
66 hhsdb.Close(); | |
67 | |
68 return result; | |
36 } | 69 } |
37 | 70 |
38 // 氏名カナで被保険者情報を検索 | 71 // 氏名カナで被保険者情報を検索 |
39 wxArrayString GetHhsInfoByKana( wxString kana, bool fuzzy ) | 72 wxArrayString GetHhsInfoByKana( wxString kana, bool fuzzy ) |
40 { | 73 { |
95 } | 128 } |
96 stmt.Finalize(); | 129 stmt.Finalize(); |
97 ccndb.Close(); | 130 ccndb.Close(); |
98 | 131 |
99 return path; | 132 return path; |
133 } | |
134 | |
135 // 審査会情報のある被保険者を取得 | |
136 wxArrayString GetJudgedHhsNo( void ) | |
137 { | |
138 wxArrayString hhsno; | |
139 | |
140 wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); | |
141 wxSQLite3Database ccndb; | |
142 ccndb.Open( gszFile ); | |
143 | |
144 //wxString sql = wxT( "SELECT DISTINCT hhsno FROM path;" ); | |
145 wxString sql = wxT( "SELECT hhsno FROM path ORDER BY path DESC LIMIT 200;" ); | |
146 wxSQLite3Statement stmt = ccndb.PrepareStatement( sql ); | |
147 wxSQLite3ResultSet q = stmt.ExecuteQuery(); | |
148 | |
149 if ( !q.IsNull(0) ) { | |
150 while ( q.NextRow() ) { | |
151 hhsno.Add( q.GetString(0) ); | |
152 } | |
153 } | |
154 stmt.Finalize(); | |
155 ccndb.Close(); | |
156 | |
157 return hhsno; | |
100 } | 158 } |
101 | 159 |
102 /* 被保険者が審査会にかかったかどうか */ | 160 /* 被保険者が審査会にかかったかどうか */ |
103 bool IsHhsJudged( wxString hhsno ) | 161 bool IsHhsJudged( wxString hhsno ) |
104 { | 162 { |