Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSQLTypes.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TSQLTypes.cxx
1 // $Id: TSQLTypes.cxx,v 1.1.1.1 2004/02/18 20:58:02 dave Exp $
2 //*-- Author : Valeriy Onuchin 14/02/2000
3 //
4 
6 //
7 //
8 // ESQLTypes::kBIGINT = SQL BIGINT
9 // ESQLTypes::kBINARY = SQL BINARY (fixed length)
10 // ESQLTypes::kBIT = SQL BIT
11 // ESQLTypes::kCHAR = SQL CHAR (fixed length)
12 // ESQLTypes::kDATE = SQL DATE
13 // ESQLTypes::kDECIMAL= SQL DECIMAL (precision,scale)
14 // ESQLTypes::kDOUBLE = SQL DOUBLE
15 // ESQLTypes::kFLOAT = SQL FLOAT
16 // ESQLTypes::kINTEGER = SQL INTEGER
17 // ESQLTypes::kLONGVARBINARY= SQL LONGVARBINARY (variable length, huge)
18 // ESQLTypes::kLONGVARCHAR = SQL LONGVARCHAR (variable length, huge)
19 // ESQLTypes::kNUMERIC = SQL NUMERIC (precision,scale)
20 // ESQLTypes::kREAL = SQL REAL
21 // ESQLTypes::kSMALLINTSQL = SMALLINT
22 // ESQLTypes::kTIME = SQL TIME
23 // ESQLTypes::kTIMESTAMP = SQL TIMESTAMP
24 // ESQLTypes::kTINYINT = SQL TINYINT
25 // ESQLTypes::kVARBINARY = SQL VARBINARY (variable length less than 256)
26 // ESQLTypes::kVARCHAR = SQL VARCHAR (variable length less than 256)
27 //
28 // See also:
29 // TSQL
30 //
31 // TSQLDate TSQLTime TSQLTimestamp
32 //
34 
35 #include <RDBC/TSQLTypes.h>
36 
40 
42 //___________________________________________________________________
43 TSQLDate::TSQLDate( Int_t year, Int_t month, Int_t day )
44 {
45  // ctor
46 
47  Set(year,month,day,0,0,0);
48 }
49 
50 //___________________________________________________________________
51 void TSQLDate::SetYear( Int_t year )
52 {
53  // Sets the year of this date
54 
55  Set( year*10000+100*GetMonth()+GetDay(),GetTime() );
56 }
57 
58 //___________________________________________________________________
59 void TSQLDate::SetMonth( Int_t month )
60 {
61  // Sets the month of this date
62 
63  Set( 10000*GetYear()+100*month+GetDay(),GetTime() );
64 }
65 
66 //___________________________________________________________________
67 void TSQLDate::SetDay( Int_t day )
68 {
69  // Sets the day of this date
70 
71  Set( 10000*GetYear()+100*GetMonth()+day,GetTime() );
72 }
73 
74 //___________________________________________________________________
75 TString TSQLDate::ToString() const
76 {
77  // Gets the date as a string in the YYYY-MM-DD format
78  // not implemented ...
79 
80  TString str;
81  str = AsSQLString();
82  return str;
83 }
84 
86 //___________________________________________________________________
87 TSQLTime::TSQLTime( Int_t hour, Int_t minute, Int_t second )
88 {
89  // ctor
90 
91  Set(0,0,0,hour,minute,second);
92 }
93 
94 //___________________________________________________________________
95 void TSQLTime::SetHour( Int_t hour )
96 {
97  // sets hour of this time
98 
99  Set( GetDate(),10000*hour+100*GetMinute()+GetSecond() );
100 }
101 
102 //___________________________________________________________________
103 void TSQLTime::SetMinute( Int_t minute )
104 {
105  // Sets the minute of this time
106 
107  Set( GetDate(),10000*GetHour()+100*minute+GetSecond() );
108 }
109 
110 //___________________________________________________________________
111 void TSQLTime::SetSecond( Int_t second )
112 {
113  // Sets the second of this time
114 
115  Set( GetDate(),10000*GetHour()+100*GetMinute()+second );
116 }
117 
118 //___________________________________________________________________
119 TString TSQLTime::ToString() const
120 {
121  // Gets the date as a string in the HH:MM:SS format
122  // not implemented
123 
124  TString str;
125  str = AsSQLString();
126  return str;
127 }
128 
130 //___________________________________________________________________
131 TString TSQLTimestamp::ToString() const
132 {
133  // Gets the date as a string in the
134  // YYYY-MM-DD HH:MM:SS[.NNN...] format
135  // not implemented
136 
137  TString str;
138  str = AsString();
139  return str;
140 }
141 
142 //___________________________________________________________________
143 void TSQLTimestamp::SetYear( Int_t year )
144 {
145  // Sets the year of this date
146 
147  Set( year*10000+100*GetMonth()+GetDay(),GetTime() );
148 }
149 
150 //___________________________________________________________________
151 void TSQLTimestamp::SetMonth( Int_t month )
152 {
153  // Sets the month of this date
154 
155  Set( 10000*GetYear()+100*month+GetDay(),GetTime() );
156 }
157 
158 //___________________________________________________________________
159 void TSQLTimestamp::SetDay( Int_t day )
160 {
161  // Sets the day of this date
162 
163  Set( 10000*GetYear()+100*GetMonth()+day,GetTime() );
164 }
165 
166 //___________________________________________________________________
167 void TSQLTimestamp::SetHour( Int_t hour )
168 {
169  // Sets hour of this time
170 
171  Set( GetDate(),10000*hour+100*GetMinute()+GetSecond() );
172 }
173 
174 //___________________________________________________________________
175 void TSQLTimestamp::SetMinute( Int_t minute )
176 {
177  // Sets the minute of this time
178 
179  Set( GetDate(),10000*GetHour()+100*minute+GetSecond() );
180 }
181 
182 //___________________________________________________________________
183 void TSQLTimestamp::SetSecond( Int_t second )
184 {
185  // Sets the second of this time
186 
187  Set( GetDate(),10000*GetHour()+100*GetMinute()+second );
188 }