Mercurial > mercurial > hgweb_mover2.cgi
diff include/marksheet.h @ 27:d21de4693652 v2.2dev v2.3
add hhsname
author | pyon@macmini |
---|---|
date | Sat, 05 Nov 2011 10:13:41 +0900 |
parents | 5c99c6fa50df |
children |
line wrap: on
line diff
--- a/include/marksheet.h Thu Nov 03 15:48:26 2011 +0900 +++ b/include/marksheet.h Sat Nov 05 10:13:41 2011 +0900 @@ -1,9 +1,11 @@ // Filename : marksheet.h -// Last Change: 02-Nov-2011. +// Last Change: 05-Nov-2011. // #ifndef __marksheet__ #define __marksheet__ +#include "wx/wxsqlite3.h" + bool IsBlack( int r, int g, int b ) { if ( r == 0 && g == 0 && b == 0 ) { @@ -116,15 +118,38 @@ return false; }; +wxString GetHhsName( wxString& hhsno ) +{ + wxString name; + + wxString gszFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("hhs.db"); + wxSQLite3Database hhsdb; + hhsdb.Open( gszFile ); + + wxSQLite3Statement stmt = hhsdb.PrepareStatement("SELECT name FROM hhs_master WHERE hhsno = ?"); + stmt.Bind( 1, hhsno ); + wxSQLite3ResultSet q = stmt.ExecuteQuery(); + if ( !q.IsNull(0) ) { + while ( q.NextRow() ) { + name = q.GetString(0); + } + } + stmt.Finalize(); + hhsdb.Close(); + + return name; +}; + int IsHhsno( wxString& hhsno, wxString& name ) { wxRegEx reHhs(wxT("^0[1238][0-9]{8}$")); // $BHoJ]HV%A%'%C%/(B if ( reHhs.Matches( hhsno) ) { - if ( 0 ) { // DB$B$K$"$k(B - return 2; + name = GetHhsName( hhsno ); + if ( name.IsEmpty() ) { // DB$B$K$J$$(B + return 1; } - return 1; + return 2; } else { return 0;