Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

date.hh

00001 /*
00002 *  Name:      date.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   UESQLC base SQL type date
00005 *  Date:      $Date: 2003/10/06 13:21:35 $
00006 *  Revision:  $Revision: 1.1 $
00007 *
00008 *  Copyright (C) 2002  Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
00009 *
00010 *  This program is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  This program is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with this program; if not, write to the Free Software
00022 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 *  MA 02111-1307, USA.
00024 */
00025 
00026 #ifndef _UESQL_DATE__
00027 #define _UESQL_DATE__
00028 
00029 #include <mpcl/text/local_date.hh>
00030 #include <mpcl/text/string.hh>
00031 #include "type.hh"
00032 
00033 
00035 namespace uesqlc
00036 {
00037 
00038   using std::string;
00039 
00041   class TDate                     :
00042     public mpcl::text::TLocalDate ,
00043     public IType
00044   {
00045 
00046     public:
00047 
00048       //
00049       //  C O N S T R U C T O R S
00050       //
00051 
00053       TDate (void)    :
00054         TLocalDate () ,
00055         IType      () {}
00056 
00058       TDate (const TDate& rktDATE) :
00059         TLocalDate (rktDATE)       ,
00060         IType      ()
00061       {
00062         setNull (rktDATE.isNull());
00063       }
00064 
00065       TDate (const EDateType keDATE_TYPE) :
00066         TLocalDate (keDATE_TYPE)          ,
00067         IType      ()
00068       {
00069         setNull (false);
00070       }
00071 
00072       TDate (const int kiYEAR, const int kiMONTH, const int kiDAY) :
00073         TLocalDate (kiYEAR, kiMONTH, kiDAY)                        ,
00074         IType      ()
00075       {
00076         setNull (false);
00077       }
00078 
00079       explicit TDate (const char* pkcDATE) :
00080         TLocalDate (eEmpty)                ,
00081         IType      ()
00082       {
00083         set (pkcDATE);
00084       }
00085 
00086       explicit TDate (const string& rkyDATE) :
00087         TLocalDate (eEmpty)                  ,
00088         IType      ()
00089       {
00090         set (rkyDATE);
00091       }
00092 
00099       void set (const char* pkcVALUE);
00100 
00107       void set (const string& rkyVALUE)
00108       {
00109         set (rkyVALUE.c_str());
00110       }
00111 
00112 
00113     public:
00114 
00115       //
00116       //  S E L E C T O R S
00117       //
00118 
00119       mpcl::text::TString get (void) const
00120       {
00121         mpcl::text::TString   yResult;
00122 
00123         if ( isNull() )
00124         {
00125           yResult = "null";
00126         }
00127         else
00128         {
00129           yResult = TLocalDate::get ("'%Y-%m-%d'");
00130         }
00131         return yResult;
00132       }
00133 
00142       mpcl::text::TString get (const char* pkcDATE_FORMAT) const
00143       {
00144         mpcl::text::TString   yResult;
00145 
00146         if ( isNull() )
00147         {
00148           yResult = "null";
00149         }
00150         else
00151         {
00152           yResult = TLocalDate::get (pkcDATE_FORMAT);
00153         }
00154         return yResult;
00155       }
00156 
00157   };  // class TDate
00158 
00159 }  // namespace uesqlc
00160 
00161 
00162 #endif  // not _UESQL_DATE__

Generated on Mon Oct 13 02:40:10 2003 for UESQLC by doxygen1.2.18