Mercurial > mercurial > hgweb_searcher03.cgi
diff src/db.cpp @ 1:7b6dab24f4b8
Gui parts complete.
author | pyon@macmini |
---|---|
date | Sun, 04 Aug 2013 21:42:49 +0900 |
parents | 0c0701a935f8 |
children | c066fde99517 |
line wrap: on
line diff
--- a/src/db.cpp Sun Jul 21 16:07:19 2013 +0900 +++ b/src/db.cpp Sun Aug 04 21:42:49 2013 +0900 @@ -1,34 +1,41 @@ // Filename : db.cpp -// Last Change: 21-Jul-2013. +// Last Change: 02-Aug-2013. // #include "db.h" #include "wx/wxsqlite3.h" -/* $BHoJ]81<THV9f$+$iHoJ]81<TL>$r<hF@(B */ -wxString GetHhsNameByNo( wxString hhsno ) +/* $BHoJ]HV$GHoJ]81<T>pJs$r<hF@(B */ +wxString GetHhsInfoByHhsNo( wxString hhsno ) { - wxString name; + wxString name, addr; 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 = ?"); + wxSQLite3Statement stmt = hhsdb.PrepareStatement("SELECT name, addr FROM hhs_master WHERE hhsno = ?"); stmt.Bind( 1, hhsno ); wxSQLite3ResultSet q = stmt.ExecuteQuery(); if ( !q.IsNull(0) ) { while ( q.NextRow() ) { name = q.GetString(0); + addr = q.GetString(1); } } stmt.Finalize(); hhsdb.Close(); - return name; + if ( name.IsEmpty() ) { + return wxEmptyString; + } + else { + return name + wxT("_") + addr; + } } -/* $B%+%J$+$iHoJ]81<T>pJs$r<hF@(B */ -wxArrayString GetHhsByKana( wxString kana, bool fuzzy ) + +// $B;aL>%+%J$GHoJ]81<T>pJs$r8!:w(B +wxArrayString GetHhsInfoByKana( wxString kana, bool fuzzy ) { wxArrayString data; @@ -36,7 +43,10 @@ wxSQLite3Database hhsdb; hhsdb.Open( gszFile ); - wxSQLite3Statement stmt = hhsdb.PrepareStatement("SELECT hhs_no, kana, name, birth, addr FROM hhs_master WHERE kana = ? ORDER BY kana, birth DESC"); + wxString sql = wxT( "SELECT hhsno, kana, name, birth, addr FROM hhs_master WHERE kana = ? ORDER BY kana, birth;" ); + //if ( fuzzy ) ;//***** + + wxSQLite3Statement stmt = hhsdb.PrepareStatement( sql ); stmt.Bind( 1, kana ); wxSQLite3ResultSet q = stmt.ExecuteQuery(); @@ -82,7 +92,7 @@ return date_path; } -/* $B3+:EF|$r<hF@(B */ +/* $B9g5DBN3+:EF|$r<hF@(B */ wxArrayString GetCcnDate( void ) { wxArrayString date_cnt; @@ -107,7 +117,7 @@ return date_cnt; } -/* $B9g5DBN$r<hF@(B */ +/* $BF|IU$+$i?3::2q$r<hF@(B */ wxArrayString GetCcnByDate( wxString date ) { wxArrayString ccn_cnt; @@ -133,7 +143,7 @@ return ccn_cnt; } -/* $BHoJ]81<THV9f$r<hF@(B */ +/* $B9g5DBN$+$iHoJ]81<THV9f$r<hF@(B */ wxArrayString GetHhsNoByCcn( wxString ccn, wxString date ) { wxArrayString hhsno;