Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:22:06

0001 // $Id: TSQLTypes.cxx,v 1.1.1.1 2004/02/18 20:58:02 dave Exp $
0002 //*-- Author : Valeriy Onuchin 14/02/2000
0003 //
0004 
0005 ////////////////////////////////////////////////////////////////////
0006 //
0007 //
0008 // ESQLTypes::kBIGINT =    SQL BIGINT        
0009 // ESQLTypes::kBINARY =    SQL BINARY (fixed length) 
0010 // ESQLTypes::kBIT    =    SQL BIT    
0011 // ESQLTypes::kCHAR   =    SQL CHAR (fixed length)     
0012 // ESQLTypes::kDATE   =    SQL DATE  
0013 // ESQLTypes::kDECIMAL=    SQL DECIMAL (precision,scale) 
0014 // ESQLTypes::kDOUBLE =    SQL DOUBLE 
0015 // ESQLTypes::kFLOAT  =    SQL FLOAT 
0016 // ESQLTypes::kINTEGER =   SQL INTEGER 
0017 // ESQLTypes::kLONGVARBINARY= SQL LONGVARBINARY (variable length, huge) 
0018 // ESQLTypes::kLONGVARCHAR =  SQL LONGVARCHAR (variable length, huge) 
0019 // ESQLTypes::kNUMERIC =   SQL NUMERIC (precision,scale) 
0020 // ESQLTypes::kREAL =      SQL REAL   
0021 // ESQLTypes::kSMALLINTSQL =  SMALLINT 
0022 // ESQLTypes::kTIME =      SQL TIME 
0023 // ESQLTypes::kTIMESTAMP = SQL TIMESTAMP 
0024 // ESQLTypes::kTINYINT =   SQL TINYINT 
0025 // ESQLTypes::kVARBINARY = SQL VARBINARY (variable length less than 256)
0026 // ESQLTypes::kVARCHAR =   SQL VARCHAR (variable length less than 256) 
0027 //
0028 // See also:
0029 //             TSQL
0030 //
0031 // TSQLDate TSQLTime TSQLTimestamp
0032 //
0033 ////////////////////////////////////////////////////////////////////
0034 
0035 #include <RDBC/TSQLTypes.h>
0036 
0037 ClassImp(TSQLDate)
0038 ClassImp(TSQLTime)
0039 ClassImp(TSQLTimestamp)
0040 
0041 /////////////////////////////////////////////////////////////////////
0042 //___________________________________________________________________
0043 TSQLDate::TSQLDate( Int_t year, Int_t month, Int_t day ) 
0044 {
0045    // ctor
0046    
0047    Set(year,month,day,0,0,0);
0048 }
0049 
0050 //___________________________________________________________________
0051 void TSQLDate::SetYear( Int_t year ) 
0052 {
0053    // Sets the year of this date
0054    
0055    Set( year*10000+100*GetMonth()+GetDay(),GetTime() );
0056 }
0057 
0058 //___________________________________________________________________
0059 void TSQLDate::SetMonth( Int_t month ) 
0060 {
0061    // Sets the month of this date
0062     
0063    Set( 10000*GetYear()+100*month+GetDay(),GetTime() );
0064 }
0065 
0066 //___________________________________________________________________
0067 void TSQLDate::SetDay( Int_t day ) 
0068 {
0069    //  Sets the day of this date 
0070 
0071    Set( 10000*GetYear()+100*GetMonth()+day,GetTime() );
0072 }
0073 
0074 //___________________________________________________________________
0075 TString TSQLDate::ToString() const
0076 {
0077    // Gets the date as a string in the YYYY-MM-DD format
0078    // not implemented ...
0079 
0080    TString str;
0081    str = AsSQLString();
0082    return str;
0083 }
0084 
0085 /////////////////////////////////////////////////////////////////////
0086 //___________________________________________________________________
0087 TSQLTime::TSQLTime( Int_t hour, Int_t minute, Int_t second ) 
0088 {
0089    // ctor
0090    
0091    Set(0,0,0,hour,minute,second);
0092 }
0093 
0094 //___________________________________________________________________
0095 void TSQLTime::SetHour( Int_t hour ) 
0096 {
0097    // sets hour of this time
0098    
0099    Set( GetDate(),10000*hour+100*GetMinute()+GetSecond() );
0100 }
0101 
0102 //___________________________________________________________________
0103 void TSQLTime::SetMinute( Int_t minute ) 
0104 {
0105    // Sets the minute of this time
0106     
0107    Set( GetDate(),10000*GetHour()+100*minute+GetSecond() );
0108 }
0109 
0110 //___________________________________________________________________
0111 void TSQLTime::SetSecond( Int_t second ) 
0112 {
0113    //  Sets the second of this time 
0114 
0115    Set( GetDate(),10000*GetHour()+100*GetMinute()+second );
0116 }
0117 
0118 //___________________________________________________________________
0119 TString TSQLTime::ToString() const
0120 {
0121    // Gets the date as a string in the  HH:MM:SS format
0122    // not implemented
0123 
0124    TString str;
0125    str = AsSQLString();
0126    return str;
0127 }
0128 
0129 /////////////////////////////////////////////////////////////////////
0130 //___________________________________________________________________
0131 TString TSQLTimestamp::ToString() const
0132 {
0133    // Gets the date as a string in the 
0134    // YYYY-MM-DD HH:MM:SS[.NNN...] format
0135    // not implemented
0136    
0137    TString str;
0138    str = AsString();
0139    return str;
0140 }
0141 
0142 //___________________________________________________________________
0143 void TSQLTimestamp::SetYear( Int_t year ) 
0144 {
0145    // Sets the year of this date
0146    
0147    Set( year*10000+100*GetMonth()+GetDay(),GetTime() );
0148 }
0149 
0150 //___________________________________________________________________
0151 void TSQLTimestamp::SetMonth( Int_t month ) 
0152 {
0153    // Sets the month of this date
0154     
0155    Set( 10000*GetYear()+100*month+GetDay(),GetTime() );
0156 }
0157 
0158 //___________________________________________________________________
0159 void TSQLTimestamp::SetDay( Int_t day ) 
0160 {
0161    //  Sets the day of this date 
0162 
0163    Set( 10000*GetYear()+100*GetMonth()+day,GetTime() );
0164 }
0165 
0166 //___________________________________________________________________
0167 void TSQLTimestamp::SetHour( Int_t hour ) 
0168 {
0169    // Sets hour of this time
0170    
0171    Set( GetDate(),10000*hour+100*GetMinute()+GetSecond() );
0172 }
0173 
0174 //___________________________________________________________________
0175 void TSQLTimestamp::SetMinute( Int_t minute ) 
0176 {
0177    // Sets the minute of this time
0178     
0179    Set( GetDate(),10000*GetHour()+100*minute+GetSecond() );
0180 }
0181 
0182 //___________________________________________________________________
0183 void TSQLTimestamp::SetSecond( Int_t second ) 
0184 {
0185    //  Sets the second of this time 
0186 
0187    Set( GetDate(),10000*GetHour()+100*GetMinute()+second );
0188 }