1 karl 1.23 //%2006////////////////////////////////////////////////////////////////////////
|
2 chuck 1.3 //
|
3 karl 1.17 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 chuck 1.3 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.17 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.23 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 chuck 1.3 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Authors: David Rosckes (rosckes@us.ibm.com)
33 // Bert Rivero (hurivero@us.ibm.com)
34 chuck 1.3 // Chuck Carmack (carmack@us.ibm.com)
35 // Brian Lucier (lucier@us.ibm.com)
36 //
|
37 vijay.eli 1.22 // Modified By: Vijay Eli, IBM (vijayeli@in.ibm.com) bug#3590
|
38 chuck 1.3 //
39 //%/////////////////////////////////////////////////////////////////////////////
40
|
41 humberto 1.1 #include <Pegasus/CQL/CQLFunctionRep.h>
|
42 lucier 1.4
43 // CQL includes
|
44 humberto 1.1 #include <Pegasus/CQL/CQLFactory.h>
|
45 chuck 1.3 #include <Pegasus/CQL/CQLUtilities.h>
|
46 lucier 1.4 #include <Pegasus/CQL/CQLValue.h>
|
47 david.dillard 1.20 #include <Pegasus/CQL/CQLValueRep.h>
|
48 lucier 1.4
49 // Common Query includes
50 #include <Pegasus/Query/QueryCommon/QueryContext.h>
51
52 // Common Pegasus includes
53 #include <Pegasus/Common/CIMName.h>
54 #include <Pegasus/Common/CIMObjectPath.h>
|
55 lucier 1.5 #include <Pegasus/Common/Tracer.h>
|
56 lucier 1.4
|
57 humberto 1.1 PEGASUS_NAMESPACE_BEGIN
|
58 lucier 1.5
|
59 humberto 1.16 CQLFunctionRep::CQLFunctionRep(): _funcOpType(UNKNOWN), _parms() {}
60
|
61 lucier 1.5 CQLFunctionRep::CQLFunctionRep(CQLIdentifier inOpType, Array<CQLPredicate> inParms): _funcOpType(UNKNOWN), _parms(inParms)
|
62 humberto 1.1 {
|
63 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::CQLFunctionRep()");
64
65 String opType(inOpType.getName().getString());
66
67 if(String::compareNoCase(opType,String("DATETIMETOMICROSECOND")) == 0){
68 _funcOpType = DATETIMETOMICROSECOND;
69 }
70 else if(String::compareNoCase(opType, String("STRINGTOUINT")) == 0){
71 _funcOpType = STRINGTOUINT;
72 }
73 else if(String::compareNoCase(opType, String("STRINGTOSINT")) == 0){
74 _funcOpType = STRINGTOSINT;
75 }
76 else if(String::compareNoCase(opType, String("STRINGTOREAL")) == 0){
77 _funcOpType = STRINGTOREAL;
78 }
79 else if(String::compareNoCase(opType, String("STRINGTONUMERIC")) == 0){
80 _funcOpType = STRINGTONUMERIC;
81 }
82 else if(String::compareNoCase(opType, String("UPPERCASE")) == 0){
83 _funcOpType = UPPERCASE;
84 lucier 1.5 }
85 else if(String::compareNoCase(opType, String("NUMERICTOSTRING")) == 0){
86 _funcOpType = NUMERICTOSTRING;
87 }
88 else if(String::compareNoCase(opType, String("REFERENCETOSTRING")) == 0){
89 _funcOpType = REFERENCETOSTRING;
90 }
91 else if(String::compareNoCase(opType, String("CLASSNAME")) == 0){
92 _funcOpType = CLASSNAME;
93 }
94 else if(String::compareNoCase(opType, String("NAMESPACENAME")) == 0){
95 _funcOpType = NAMESPACENAME;
96 }
97 else if(String::compareNoCase(opType, String("NAMESPACETYPE")) == 0){
98 _funcOpType = NAMESPACETYPE;
99 }
100 else if(String::compareNoCase(opType, String("HOSTPORT")) == 0){
101 _funcOpType = HOSTPORT;
102 }
103 else if(String::compareNoCase(opType, String("MODELPATH")) == 0){
104 _funcOpType = MODELPATH;
105 lucier 1.5 }
106 else if(String::compareNoCase(opType, String("CLASSPATH")) == 0){
107 _funcOpType = CLASSPATH;
108 }
109 else if(String::compareNoCase(opType, String("OBJECTPATH")) == 0){
110 _funcOpType = OBJECTPATH;
111 }
112 else if(String::compareNoCase(opType, String("INSTANCETOREFERENCE")) == 0){
113 _funcOpType = INSTANCETOREFERENCE;
114 }
115 else if(String::compareNoCase(opType, String("CURRENTDATETIME")) == 0){
116 _funcOpType = CURRENTDATETIME;
117 }
118 else if(String::compareNoCase(opType, String("DATETIME")) == 0){
119 _funcOpType = DATETIME;
120 }
121 else if(String::compareNoCase(opType, String("MICROSECONDTOTIMESTAMP")) == 0){
122 _funcOpType = MICROSECONDTOTIMESTAMP;
123 }
124 else if(String::compareNoCase(opType, String("MICROSECONDTOINTERVAL")) == 0){
125 _funcOpType = MICROSECONDTOINTERVAL;
126 lucier 1.5 }
127 else
128 {
129 // Unknown function
130 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_FUNCTION"),
131 String("Function: $0 is not a supported function."),
132 opType);
133 throw CQLSyntaxErrorException(mload);
134 }
135 PEG_METHOD_EXIT();
|
136 chuck 1.3 }
|
137 lucier 1.5 CQLFunctionRep::CQLFunctionRep(const CQLFunctionRep* rep) : _funcOpType(rep->_funcOpType), _parms(rep->_parms)
|
138 humberto 1.1 {
139 }
140
|
141 lucier 1.5 CQLFunctionRep::~CQLFunctionRep()
142 {
|
143 chuck 1.3 }
|
144 humberto 1.1
|
145 chuck 1.3 CQLValue CQLFunctionRep::resolveValue(const CIMInstance& CI,const QueryContext& queryCtx)
146 {
|
147 lucier 1.5 switch(_funcOpType)
148 {
149 case DATETIMETOMICROSECOND:
150 return dateTimeToMicrosecond(CI, queryCtx);
151 case STRINGTOUINT:
152 return stringToUint(CI, queryCtx);
153 case STRINGTOSINT:
154 return stringToSint(CI, queryCtx);
155 case STRINGTOREAL:
156 return stringToReal(CI, queryCtx);
157 case STRINGTONUMERIC:
158 return stringToNumeric(CI, queryCtx);
159 case UPPERCASE:
160 return upperCase(CI, queryCtx);
161 case NUMERICTOSTRING:
162 return numericToString(CI, queryCtx);
163 case REFERENCETOSTRING:
164 return referenceToString(CI, queryCtx);
165 case CLASSNAME:
166 return className(CI, queryCtx);
167 case NAMESPACENAME:
168 lucier 1.5 return nameSpaceName(CI, queryCtx);
169 case NAMESPACETYPE:
170 return nameSpaceType(CI, queryCtx);
171 case HOSTPORT:
172 return hostPort(CI, queryCtx);
173 case MODELPATH:
174 return modelPath(CI, queryCtx);
175 case CLASSPATH:
176 return classPath(CI, queryCtx);
177 case OBJECTPATH:
178 return objectPath(CI, queryCtx);
179 case INSTANCETOREFERENCE:
180 return instanceToReference(CI, queryCtx);
181 case CURRENTDATETIME:
182 return currentDateTime();
183 case DATETIME:
184 return dateTime(CI, queryCtx);
185 case MICROSECONDTOTIMESTAMP:
186 return microsecondToTimestamp(CI, queryCtx);
187 case MICROSECONDTOINTERVAL:
188 return microsecondToInterval(CI, queryCtx);
189 lucier 1.5 case UNKNOWN:
190 {
191 // Unknown function
192 char buf[10];
193 sprintf(buf, "%d", _funcOpType);
194 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_FUNCTION_ID"),
195 String("Function ID: $0 is not a supported function ID."),
196 String(buf));
197 throw CQLSyntaxErrorException(mload);
198 }
199 }
200 // Unknown function
201 char buf[10];
202 sprintf(buf, "%d", _funcOpType);
203 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_FUNCTION_ID"),
204 String("Function ID: $0 is not a supported function ID."),
205 String(buf));
206 throw CQLSyntaxErrorException(mload);
|
207 humberto 1.1 }
208
|
209 lucier 1.5 String CQLFunctionRep::toString() const
|
210 humberto 1.1 {
|
211 lucier 1.6 String returnStr = functionTypeToString();
212
213 returnStr.append("(");
214 Uint32 parmSize = _parms.size();
215 for(Uint32 i = 0; i < parmSize; ++i)
216 {
217 returnStr.append(_parms[i].toString());
218 if (i+1 < parmSize)
219 returnStr.append(", ");
220 }
221 returnStr.append(")");
222 return returnStr;
223 }
224
225 String CQLFunctionRep::functionTypeToString() const
226 {
|
227 lucier 1.5 String returnStr;
|
228 chuck 1.3
|
229 lucier 1.5 switch(_funcOpType)
230 {
|
231 chuck 1.3 case DATETIMETOMICROSECOND:
|
232 lucier 1.5 returnStr.append("DATETIMETOMICROSECOND");
233 break;
|
234 chuck 1.3 case STRINGTOUINT:
|
235 lucier 1.5 returnStr.append("STRINGTOUINT");
236 break;
|
237 chuck 1.3 case STRINGTOSINT:
|
238 lucier 1.5 returnStr.append("STRINGTOSINT");
239 break;
|
240 chuck 1.3 case STRINGTOREAL:
|
241 lucier 1.5 returnStr.append("STRINGTOREAL");
242 break;
|
243 lucier 1.10 case STRINGTONUMERIC:
244 returnStr.append("STRINGTONUMERIC");
245 break;
|
246 chuck 1.3 case UPPERCASE:
|
247 lucier 1.5 returnStr.append("UPPERCASE");
248 break;
|
249 chuck 1.3 case NUMERICTOSTRING:
|
250 lucier 1.5 returnStr.append("NUMERICTOSTRING");
251 break;
|
252 chuck 1.3 case REFERENCETOSTRING:
|
253 lucier 1.5 returnStr.append("REFERENCETOSTRING");
254 break;
|
255 humberto 1.1 case CLASSNAME:
|
256 lucier 1.5 returnStr.append("CLASSNAME");
257 break;
|
258 chuck 1.3 case NAMESPACENAME:
|
259 lucier 1.5 returnStr.append("NAMESPACENAME");
260 break;
|
261 chuck 1.3 case NAMESPACETYPE:
|
262 lucier 1.5 returnStr.append("NAMESPACETYPE");
263 break;
|
264 chuck 1.3 case HOSTPORT:
|
265 lucier 1.5 returnStr.append("HOSTPORT");
266 break;
|
267 chuck 1.3 case MODELPATH:
|
268 lucier 1.5 returnStr.append("MODELPATH");
269 break;
|
270 humberto 1.1 case CLASSPATH:
|
271 lucier 1.5 returnStr.append("CLASSPATH");
272 break;
|
273 chuck 1.3 case OBJECTPATH:
|
274 lucier 1.5 returnStr.append("OBJECTPATH");
275 break;
|
276 chuck 1.3 case INSTANCETOREFERENCE:
|
277 lucier 1.5 returnStr.append("INSTANCETOREFERENCE");
278 break;
|
279 chuck 1.3 case CURRENTDATETIME:
|
280 lucier 1.5 returnStr.append("CURRENTDATETIME");
281 break;
|
282 humberto 1.1 case DATETIME:
|
283 lucier 1.5 returnStr.append("DATETIME");
284 break;
|
285 chuck 1.3 case MICROSECONDTOTIMESTAMP:
|
286 lucier 1.5 returnStr.append("MICROSECONDTOTIMESTAMP");
287 break;
|
288 chuck 1.3 case MICROSECONDTOINTERVAL:
|
289 lucier 1.5 returnStr.append("MICROSECONDTOINTERVAL");
290 break;
291 case UNKNOWN:
|
292 humberto 1.16 returnStr.append("UNKNOWN");
|
293 humberto 1.1 default:
|
294 humberto 1.16 returnStr.append("UNKNOWN");
|
295 lucier 1.5 break;
296 }
297 return returnStr;
|
298 humberto 1.1 }
299
|
300 chuck 1.3 Array<CQLPredicate> CQLFunctionRep::getParms()const
|
301 humberto 1.1 {
302 return _parms;
303 }
304
|
305 chuck 1.3 FunctionOpType CQLFunctionRep::getFunctionType()const
|
306 humberto 1.1 {
307 return _funcOpType;
308 }
309
|
310 vijay.eli 1.22 void CQLFunctionRep::applyContext(const QueryContext& inContext)
|
311 humberto 1.1 {
|
312 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::applyContext()");
313
|
314 humberto 1.1 for(Uint32 i = 0; i < _parms.size(); ++i)
315 {
|
316 chuck 1.3 _parms[i].applyContext(inContext);
|
317 humberto 1.1 }
|
318 lucier 1.5 PEG_METHOD_EXIT();
|
319 humberto 1.1 }
|
320 humberto 1.16 /*
|
321 chuck 1.3 Boolean CQLFunctionRep::operator==(const CQLFunctionRep& func)const
322 {
323 if(_funcOpType != func._funcOpType || _parms.size() != func._parms.size())
|
324 lucier 1.5 {
325 return false;
326 }
|
327 chuck 1.3
|
328 lucier 1.5 // for(Uint32 i = 0; i < _parms.size(); ++i)
329 // {
330 // if(!(_parms[i] == func._parms[i]))
331 // {
332 // return false;
333 // }
334 // }
|
335 chuck 1.3
336 return true;
|
337 humberto 1.1 }
|
338 humberto 1.16
|
339 chuck 1.3 Boolean CQLFunctionRep::operator!=(const CQLFunctionRep& func)const{
|
340 humberto 1.1 return (!operator==(func));
341 }
|
342 humberto 1.16 */
|
343 lucier 1.6
|
344 lucier 1.4 CQLValue CQLFunctionRep::dateTimeToMicrosecond(const CIMInstance& CI, const QueryContext& queryCtx) const
|
345 chuck 1.3 {
|
346 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::dateTimeToMicrosecond()");
|
347 lucier 1.10
348 if(_parms.size() != 1)
|
349 lucier 1.4 {
|
350 lucier 1.5 char buf[10];
351 sprintf(buf, "%d", _parms.size());
|
352 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
353 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
354 lucier 1.6 functionTypeToString(),
|
355 lucier 1.5 String(buf),
356 String("1"), String("1"));
357 throw CQLRuntimeException(mload);
|
358 lucier 1.4 }
359
|
360 lucier 1.5 // resolve the parameter
|
361 lucier 1.4 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
362
363 if(cqlVal.getValueType() != CQLValue::CIMDateTime_type)
364 {
|
365 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
366 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
367 lucier 1.5 String("1"),
|
368 lucier 1.12 functionTypeToString(),
|
369 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
370 CQLValueRep::valueTypeToString(CQLValue::CIMDateTime_type));
|
371 lucier 1.5 throw CQLRuntimeException(mload);
|
372 lucier 1.4 }
373
|
374 lucier 1.5 PEG_METHOD_EXIT();
|
375 lucier 1.12 return CQLValue(cqlVal.getDateTime().toMicroSeconds());
|
376 chuck 1.3 }
377
|
378 lucier 1.4 CQLValue CQLFunctionRep::stringToUint(const CIMInstance& CI, const QueryContext& queryCtx) const
|
379 chuck 1.3 {
|
380 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::stringToUint()");
|
381 chuck 1.3 if(_parms.size() != 1)
|
382 lucier 1.5 {
383 char buf[10];
384 sprintf(buf, "%d", _parms.size());
|
385 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
386 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
387 lucier 1.6 functionTypeToString(),
|
388 lucier 1.5 String(buf),
389 String("1"), String("1"));
390 throw CQLRuntimeException(mload);
391 }
|
392 chuck 1.3
393 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
394
395 if(cqlVal.getValueType() != CQLValue::String_type)
|
396 lucier 1.5 {
|
397 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
398 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
399 lucier 1.5 String("1"),
|
400 lucier 1.12 functionTypeToString(),
|
401 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
402 CQLValueRep::valueTypeToString(CQLValue::String_type));
|
403 lucier 1.5 throw CQLRuntimeException(mload);
404 }
|
405 chuck 1.3
|
406 lucier 1.5 PEG_METHOD_EXIT();
|
407 chuck 1.3 return CQLValue(CQLUtilities::stringToUint64(cqlVal.getString()));
408 }
409
|
410 lucier 1.4 CQLValue CQLFunctionRep::stringToSint(const CIMInstance& CI, const QueryContext& queryCtx) const
|
411 chuck 1.3 {
|
412 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::stringToSint()");
|
413 chuck 1.3 if(_parms.size() != 1)
|
414 lucier 1.5 {
415 char buf[10];
416 sprintf(buf, "%d", _parms.size());
|
417 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
418 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
419 lucier 1.6 functionTypeToString(),
|
420 lucier 1.5 String(buf),
421 String("1"), String("1"));
422 throw CQLRuntimeException(mload);
423 }
|
424 chuck 1.3
425 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
426
427 if(cqlVal.getValueType() != CQLValue::String_type)
|
428 lucier 1.5 {
|
429 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
430 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
431 lucier 1.5 String("1"),
|
432 lucier 1.12 functionTypeToString(),
|
433 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
434 CQLValueRep::valueTypeToString(CQLValue::String_type));
|
435 lucier 1.5 throw CQLRuntimeException(mload);
436 }
|
437 chuck 1.3
|
438 lucier 1.5 PEG_METHOD_EXIT();
|
439 chuck 1.3 return CQLValue(CQLUtilities::stringToSint64(cqlVal.getString()));
440 }
441
|
442 lucier 1.4 CQLValue CQLFunctionRep::stringToReal(const CIMInstance& CI, const QueryContext& queryCtx) const
|
443 chuck 1.3 {
|
444 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::stringToReal()");
|
445 chuck 1.3 if(_parms.size() != 1)
|
446 lucier 1.5 {
447 char buf[10];
448 sprintf(buf, "%d", _parms.size());
|
449 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
450 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
451 lucier 1.6 functionTypeToString(),
|
452 lucier 1.5 String(buf),
453 String("1"), String("1"));
454 throw CQLRuntimeException(mload);
455 }
|
456 chuck 1.3
457 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
458
459 if(cqlVal.getValueType() != CQLValue::String_type)
|
460 lucier 1.5 {
|
461 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
462 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
463 lucier 1.5 String("1"),
|
464 lucier 1.12 functionTypeToString(),
|
465 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
466 CQLValueRep::valueTypeToString(CQLValue::String_type));
|
467 lucier 1.5 throw CQLRuntimeException(mload);
|
468 chuck 1.3 }
469
|
470 lucier 1.5 PEG_METHOD_EXIT();
|
471 chuck 1.3 return CQLValue(CQLUtilities::stringToReal64(cqlVal.getString()));
472 }
473
|
474 lucier 1.4 CQLValue CQLFunctionRep::stringToNumeric(const CIMInstance& CI, const QueryContext& queryCtx) const
|
475 chuck 1.3 {
476 return stringToReal(CI, queryCtx);
477 }
478
|
479 lucier 1.4 CQLValue CQLFunctionRep::upperCase(const CIMInstance& CI, const QueryContext& queryCtx) const
|
480 chuck 1.3 {
|
481 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::upperCase()");
|
482 lucier 1.4 if(_parms.size() != 1)
|
483 lucier 1.5 {
484 char buf[10];
485 sprintf(buf, "%d", _parms.size());
|
486 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
487 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
488 lucier 1.6 functionTypeToString(),
|
489 lucier 1.5 String(buf),
490 String("1"), String("1"));
491 throw CQLRuntimeException(mload);
492 }
|
493 chuck 1.3
494 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
495
496 if(cqlVal.getValueType() != CQLValue::String_type)
|
497 lucier 1.5 {
|
498 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
499 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
500 lucier 1.5 String("1"),
|
501 lucier 1.12 functionTypeToString(),
|
502 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
503 CQLValueRep::valueTypeToString(CQLValue::String_type));
|
504 lucier 1.5 throw CQLRuntimeException(mload);
505 }
|
506 chuck 1.3
507 String tmpStr = cqlVal.getString();
508 tmpStr.toUpper();
509
|
510 lucier 1.5 PEG_METHOD_EXIT();
|
511 chuck 1.3 return CQLValue(tmpStr);
512 }
513
|
514 lucier 1.4 CQLValue CQLFunctionRep::numericToString(const CIMInstance& CI, const QueryContext& queryCtx) const
515 {
|
516 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::numericToString()");
|
517 lucier 1.4 char buffer[128];
518
519 if(_parms.size() != 1)
|
520 lucier 1.5 {
521 char buf[10];
522 sprintf(buf, "%d", _parms.size());
|
523 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
524 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
525 lucier 1.6 functionTypeToString(),
|
526 lucier 1.5 String(buf),
527 String("1"), String("1"));
528 throw CQLRuntimeException(mload);
529 }
|
530 lucier 1.4
531 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
|
532 lucier 1.8
|
533 lucier 1.4 CQLValue::CQLValueType valType = cqlVal.getValueType();
534 if (valType == CQLValue::Sint64_type)
535 {
|
536 lucier 1.10 sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", cqlVal.getSint());
|
537 lucier 1.4 }
538 else if (valType == CQLValue::Uint64_type)
539 {
540 sprintf(buffer, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", cqlVal.getUint());
541 }
542 else if (valType == CQLValue::Real_type)
|
543 lucier 1.6 sprintf(buffer, "%.16E", cqlVal.getReal());
|
544 lucier 1.4 else
545 {
|
546 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
547 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
548 lucier 1.5 String("1"),
|
549 lucier 1.12 functionTypeToString(),
|
550 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
551 lucier 1.5 String("Integer or Real"));
552 throw CQLRuntimeException(mload);
|
553 lucier 1.4 }
|
554 lucier 1.10 String num(buffer);
555 if (valType == CQLValue::Real_type)
556 {
|
557 lucier 1.15 // format the exponent
558 num = CQLUtilities::formatRealStringExponent(num);
|
559 lucier 1.10 }
|
560 lucier 1.4
|
561 lucier 1.5 PEG_METHOD_EXIT();
|
562 lucier 1.10 return CQLValue(num);
|
563 lucier 1.4 }
564
565 CQLValue CQLFunctionRep::referenceToString(const CIMInstance& CI, const QueryContext& queryCtx) const
566 {
|
567 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::referenceToString()");
|
568 lucier 1.4 if(_parms.size() != 1)
|
569 lucier 1.5 {
570 char buf[10];
571 sprintf(buf, "%d", _parms.size());
|
572 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
573 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
574 lucier 1.6 functionTypeToString(),
|
575 lucier 1.5 String(buf),
576 String("1"), String("1"));
577 throw CQLRuntimeException(mload);
578 }
|
579 lucier 1.4
580 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
|
581 lucier 1.10 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
582 {
583 PEG_METHOD_EXIT();
584 return CQLValue(cqlVal.getReference().toString());
585 }
586
587 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
588 {
589 PEG_METHOD_EXIT();
590 return CQLValue(cqlVal.getObject().getPath().toString());
591 }
592
593 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
594 lucier 1.4 {
|
595 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
596 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
597 lucier 1.5 String("1"),
|
598 lucier 1.12 functionTypeToString(),
|
599 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
600 lucier 1.10 String("Reference, or Object"));
|
601 lucier 1.5 throw CQLRuntimeException(mload);
|
602 lucier 1.4 }
603 }
604
605 CQLValue CQLFunctionRep::className(const CIMInstance& CI, const QueryContext& queryCtx) const
606 {
|
607 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::className()");
|
608 lucier 1.4 int parmSize = _parms.size();
609 if(parmSize != 0 && parmSize != 1)
610 {
|
611 lucier 1.5 char buf[10];
612 sprintf(buf, "%d", _parms.size());
|
613 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
614 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
615 lucier 1.6 functionTypeToString(),
|
616 lucier 1.5 String(buf),
617 String("0"), String("1"));
618 throw CQLRuntimeException(mload);
|
619 lucier 1.4 }
620
621 // If there are no parameters, the default behavior is to return the class name for the instance being examined (CI).
622 if (parmSize == 0)
|
623 lucier 1.5 {
624 PEG_METHOD_EXIT();
|
625 lucier 1.10 //printf("ClassName --> %s\n", (const char *)CI.getClassName().getString().getCString());
|
626 lucier 1.4 return CQLValue(CI.getClassName().getString());
|
627 lucier 1.5 }
|
628 lucier 1.4
629 // We have a parameter, so resolve it first before we use it.
630 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
631
632 // If we have a String parameter, then we'll use it to create a CIMObjectPath in order to verify the format is correct. We will then get the class from the object path and return it.
633 if (cqlVal.getValueType() == CQLValue::String_type)
634 {
635 CIMObjectPath objPath(cqlVal.getString());
|
636 lucier 1.5 PEG_METHOD_EXIT();
|
637 lucier 1.10 //printf("ClassName --> %s\n", (const char *)objPath.getClassName().getString().getCString());
|
638 lucier 1.4 return CQLValue(objPath.getClassName().getString());
639 }
640
641 // If we have a CIMReference parameter, then we will just get the class name from the reference and return it. A refernce is a CIMObjectPath.
642 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
|
643 lucier 1.5 {
644 PEG_METHOD_EXIT();
|
645 lucier 1.10 //printf("ClassName --> %s\n", (const char *)cqlVal.getReference().getClassName().getString().getCString());
|
646 lucier 1.4 return CQLValue(cqlVal.getReference().getClassName().getString());
|
647 lucier 1.5 }
|
648 lucier 1.4
649 // If we have a CIMObject, then we return the class name of the obejct
650 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
|
651 lucier 1.5 {
652 PEG_METHOD_EXIT();
|
653 lucier 1.10 //printf("ClassName --> %s\n", (const char *)cqlVal.getObject().getClassName().getString().getCString());
|
654 lucier 1.4 return CQLValue(cqlVal.getObject().getClassName().getString());
|
655 lucier 1.5 }
|
656 lucier 1.4
657 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
658 lucier 1.5 {
|
659 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
660 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
661 lucier 1.5 String("1"),
|
662 lucier 1.12 functionTypeToString(),
|
663 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
664 lucier 1.5 String("Reference, String, or Object"));
665 throw CQLRuntimeException(mload);
666 }
|
667 lucier 1.4 }
668
669 CQLValue CQLFunctionRep::nameSpaceName(const CIMInstance& CI, const QueryContext& queryCtx) const
|
670 chuck 1.3 {
|
671 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::nameSpaceName()");
|
672 lucier 1.4 int parmSize = _parms.size();
673 if(parmSize != 0 && parmSize != 1)
674 {
|
675 lucier 1.5 char buf[10];
676 sprintf(buf, "%d", _parms.size());
|
677 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
678 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
679 lucier 1.6 functionTypeToString(),
|
680 lucier 1.5 String(buf),
681 String("0"), String("1"));
682 throw CQLRuntimeException(mload);
|
683 lucier 1.4 }
684
685 // The default beavior for this function will first look at the object path of the instance being examined (CI). If the path contains a namespace, we will return it. If it does not, then we will return the default namespace from the query context.
686 // *** NOTE *** This does not function entirely according to the CQL spec. The CQL spec says to return the namespace of the instance regardless if it is set or not. However, with the current implementation (CQL phase 1 PEP 193) we only operate a query engine within a single namespace and so we can assume the default namespace.
687 if (parmSize == 0)
688 {
689 CIMNamespaceName ns = CI.getPath().getNameSpace();
690 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
691 ns = queryCtx.getNamespace();
|
692 lucier 1.5 PEG_METHOD_EXIT();
|
693 lucier 1.10 //printf("Namespace --> %s\n", (const char *)ns.getString().getCString());
|
694 lucier 1.4 return CQLValue(ns.getString());
695 }
696
697 // We have a parameter, so resolve it first before we use it.
698 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
699
|
700 humberto 1.16 // If we have a String parameter, then we'll use it to create a CIMObjectPath in order to verify the format is correct. We will then get the namespace from the object path and return it. If there is no namespace in the path given, then an empty string will be returned.
|
701 lucier 1.4 if (cqlVal.getValueType() == CQLValue::String_type)
702 {
703 CIMObjectPath objPath(cqlVal.getString());
|
704 lucier 1.5 PEG_METHOD_EXIT();
|
705 lucier 1.10 //printf("Namespace --> %s\n", (const char *)objPath.getNameSpace().getString().getCString());
|
706 lucier 1.4 return CQLValue(objPath.getNameSpace().getString());
707 }
708
|
709 humberto 1.16 // If we have a CIMReference parameter, then we will just get the namespace name from the reference and return it. A refernce is a CIMObjectPath. If there is no namespace in the path given, then an empty string will be returned.
|
710 lucier 1.4 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
|
711 lucier 1.5 {
712 PEG_METHOD_EXIT();
|
713 lucier 1.10 //printf("Namespace --> %s\n", (const char *)cqlVal.getReference().getNameSpace().getString().getCString());
|
714 lucier 1.4 return CQLValue(cqlVal.getReference().getNameSpace().getString());
|
715 lucier 1.5 }
|
716 lucier 1.4
717 // If we have a CIMObject, then we retrieve the path of the obejct and check to see if it has a namespace set in it. If the path contains a namespace, we will return it. If it does not, then we will return the default namespace from the query context.
718 // *** NOTE *** This does not function entirely according to the CQL spec. The CQL spec says to return the namespace of the instance regardless if it is set or not. However, with the current implementation (CQL phase 1 PEP 193) we only operate a query engine within a single namespace and so we can assume the default namespace.
719 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
720 {
721 CIMNamespaceName ns = cqlVal.getObject().getPath().getNameSpace();
722 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
723 ns = queryCtx.getNamespace();
|
724 lucier 1.5 PEG_METHOD_EXIT();
|
725 lucier 1.10 //printf("Namespace --> %s\n", (const char *)ns.getString().getCString());
|
726 lucier 1.4 return CQLValue(ns.getString());
727 }
728
729 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
730 lucier 1.5 {
|
731 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
732 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
733 lucier 1.5 String("1"),
|
734 lucier 1.12 functionTypeToString(),
|
735 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
736 lucier 1.5 String("Reference, String, or Object"));
737 throw CQLRuntimeException(mload);
738 }
|
739 chuck 1.3 }
740
|
741 lucier 1.4 CQLValue CQLFunctionRep::nameSpaceType(const CIMInstance& CI, const QueryContext& queryCtx) const
|
742 chuck 1.3 {
|
743 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::nameSpaceType()");
|
744 lucier 1.4 // This is currently (as of CQL Phase 1, PEP 193) not supported in Pegasus since Pegasus does not yet support WEBM URI references. Nothing in the current object path can be used to represent the name space type (i.e. the protocol).
|
745 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
746 lucier 1.10 String("Function $0 is not supported."),
747 functionTypeToString());
748 throw CQLRuntimeException(mload);
749
|
750 gs.keenan 1.19 PEGASUS_UNREACHABLE(
|
751 lucier 1.4 int parmSize = _parms.size();
752 if(parmSize != 0 && parmSize != 1)
753 {
|
754 lucier 1.5 char buf[10];
755 sprintf(buf, "%d", _parms.size());
|
756 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
757 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
758 lucier 1.6 functionTypeToString(),
|
759 lucier 1.5 String(buf),
760 String("0"), String("1"));
761 throw CQLRuntimeException(mload);
|
762 lucier 1.4 }
763
|
764 lucier 1.5 PEG_METHOD_EXIT();
|
765 lucier 1.4 return CQLValue(Uint64(0));
|
766 gs.keenan 1.21 ) // End PEGASUS_UNREACHABLE
|
767 chuck 1.3 }
768
|
769 lucier 1.4 CQLValue CQLFunctionRep::hostPort(const CIMInstance& CI, const QueryContext& queryCtx) const
|
770 chuck 1.3 {
|
771 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::hostPort()");
|
772 lucier 1.4 // Pegasus currently (as of CQL Phase 1, PEP 193) does not support WEBM URI references, however the current object path dose have a host on it which we will return. Until Pegasus supportse WEBM URI, it is not guaranteed that this will onform to the format defined in WBEM URI, and therefore this function is not entirely in accordance with the CQL Specification.
773 // In addition, the CQL specification allows for the parameter to be left off when the query is executed as a result of an ExecuteQuery operation. However, right now (as of CQL Phase 1, PEP 193) we are only using this for Indications, and so we are assuming a "Mode" of operation. For this function to be completely compliant with the CQL specification, it will eventually need to be "mode" aware.
774
775 if(_parms.size() != 1)
776 {
|
777 lucier 1.5 char buf[10];
778 sprintf(buf, "%d", _parms.size());
|
779 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
780 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
781 lucier 1.6 functionTypeToString(),
|
782 lucier 1.5 String(buf),
783 String("1"), String("1"));
784 throw CQLRuntimeException(mload);
|
785 lucier 1.4 }
786
787 // We have a parameter, so resolve it first before we use it.
788 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
789
|
790 humberto 1.16 // If we have a String parameter, then we'll use it to create a CIMObjectPath in order to verify the format is correct. We will then get the host from the object path and return it. If there is no host in the path given, then an empty string will be returned.
|
791 lucier 1.4 if (cqlVal.getValueType() == CQLValue::String_type)
792 {
793 CIMObjectPath objPath(cqlVal.getString());
|
794 lucier 1.5 PEG_METHOD_EXIT();
|
795 lucier 1.10 //printf("HostPort -> %s\n", (const char *)objPath.getHost().getCString());
|
796 lucier 1.4 return CQLValue(objPath.getHost());
797 }
798
|
799 humberto 1.16 // If we have a CIMReference parameter, then we will just get the host name from the reference and return it. A reference is a CIMObjectPath. If there is no host in the path given, then an empty string will be returned.
|
800 lucier 1.4 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
|
801 lucier 1.5 {
802 PEG_METHOD_EXIT();
|
803 lucier 1.10 //printf("HostPort -> %s\n", (const char *)cqlVal.getReference().getHost().getCString());
|
804 lucier 1.4 return CQLValue(cqlVal.getReference().getHost());
|
805 lucier 1.5 }
|
806 lucier 1.4
|
807 humberto 1.16 // If we have a CIMObject, then we retrieve the path of the obejct and return the host from the path. If there is no host in the path given, then an empty string will be returned.
|
808 lucier 1.4 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
|
809 lucier 1.5 {
810 PEG_METHOD_EXIT();
|
811 lucier 1.10 //printf("HostPort -> %s\n", (const char *)cqlVal.getObject().getPath().getHost().getCString());
|
812 lucier 1.5 return CQLValue(cqlVal.getObject().getPath().getHost());
813 }
|
814 lucier 1.4
815 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
816 lucier 1.5 {
|
817 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
818 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
819 lucier 1.5 String("1"),
|
820 lucier 1.12 functionTypeToString(),
|
821 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
822 lucier 1.5 String("Reference, String, or Object"));
823 throw CQLRuntimeException(mload);
824 }
|
825 chuck 1.3 }
826
|
827 lucier 1.4 CQLValue CQLFunctionRep::modelPath(const CIMInstance& CI, const QueryContext& queryCtx) const
|
828 chuck 1.3 {
|
829 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::modelPath()");
|
830 lucier 1.4 // This method returns the model path portion of an object path. The model path is the class name and the key bindings (if included)..
831
832 int parmSize = _parms.size();
833 if(parmSize != 0 && parmSize != 1)
834 {
|
835 lucier 1.5 char buf[10];
836 sprintf(buf, "%d", _parms.size());
|
837 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
838 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
839 lucier 1.6 functionTypeToString(),
|
840 lucier 1.5 String(buf),
841 String("0"), String("1"));
842 throw CQLRuntimeException(mload);
|
843 lucier 1.4 }
844
845 // The default behavior for this function will be to retrieve the object path from the instance being examined (CI) and then return the model path from that.
846 if (parmSize == 0)
|
847 lucier 1.5 {
848 PEG_METHOD_EXIT();
|
849 lucier 1.4 return buildModelPath(CI.getPath());
|
850 lucier 1.5 }
|
851 lucier 1.4
852 // We have a parameter, so resolve it first before we use it.
853 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
854
855 // If we have a String parameter, then we'll use it to create a CIMObjectPath in order to verify the format is correct. We will then get model path from the object path and return it.
856 if (cqlVal.getValueType() == CQLValue::String_type)
857 {
858 CIMObjectPath objPath(cqlVal.getString());
|
859 lucier 1.5 PEG_METHOD_EXIT();
|
860 lucier 1.4 return buildModelPath(objPath);
861 }
862
863 // If we have a CIMReference parameter, then we will get the model path from the reference and return it. A reference is a CIMObjectPath.
864 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
|
865 lucier 1.5 {
866 PEG_METHOD_EXIT();
|
867 lucier 1.4 return buildModelPath(cqlVal.getReference());
|
868 lucier 1.5 }
|
869 lucier 1.4
870 // If we have a CIMObject, then we retrieve the path of the obejct and return the model path.
871 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
|
872 lucier 1.5 {
873 PEG_METHOD_EXIT();
874 return buildModelPath(cqlVal.getObject().getPath());
875 }
|
876 lucier 1.4
877 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
878 lucier 1.5 {
|
879 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
880 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
881 lucier 1.5 String("1"),
|
882 lucier 1.12 functionTypeToString(),
|
883 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
884 lucier 1.5 String("Reference, String, or Object"));
885 throw CQLRuntimeException(mload);
886 }
|
887 chuck 1.3 }
888
|
889 lucier 1.4 CQLValue CQLFunctionRep::buildModelPath(const CIMObjectPath& objPath) const
|
890 chuck 1.3 {
|
891 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::buildModelPath()");
|
892 lucier 1.4 // This method will take an existing objet path, pick out the key bindings and the class name, and use those parts to build a new object path with just those parts in it. This is used to represent the model path.
893 CIMObjectPath newPath;
894 newPath.setClassName(objPath.getClassName());
895 newPath.setKeyBindings(objPath.getKeyBindings());
|
896 lucier 1.12 //printf("ModelPath --> %s\n", (const char *)newPath.toString().getCString());
|
897 lucier 1.5 PEG_METHOD_EXIT();
|
898 lucier 1.4 return CQLValue(newPath.toString());
|
899 chuck 1.3 }
900
|
901 lucier 1.4 CQLValue CQLFunctionRep::classPath(const CIMInstance& CI, const QueryContext& queryCtx) const
|
902 chuck 1.3 {
|
903 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::classPath()");
|
904 lucier 1.4 // This method returns a class path. The class path will only have a namespace and a class name in it. All other path information will be stripped off.
905 int parmSize = _parms.size();
906 if(parmSize != 0 && parmSize != 1)
907 {
|
908 lucier 1.5 char buf[10];
909 sprintf(buf, "%d", _parms.size());
|
910 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
911 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
912 lucier 1.6 functionTypeToString(),
|
913 lucier 1.5 String(buf),
914 String("0"), String("1"));
915 throw CQLRuntimeException(mload);
|
916 lucier 1.4 }
917
918 // The default behavior for this function will be to retrieve the object path from the instance being examined (CI) and build the class path from it. If the path does not have a namespace, then the default namespace is used.
919 if (parmSize == 0)
920 {
921 CIMObjectPath objPath(CI.getPath());
922 CIMNamespaceName ns = objPath.getNameSpace();
923 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
924 ns = queryCtx.getNamespace();
|
925 lucier 1.5 PEG_METHOD_EXIT();
|
926 lucier 1.4 return buildClassPath(objPath, ns);
927 }
928
929 // We have a parameter, so resolve it first before we use it.
930 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
931
932 // If we have a String parameter, then we'll use it to create a CIMObjectPath in order to verify the format is correct. We will then build the class path from the object path and return it. If the namespace is NOT set in the object path, it will remain unset in the returned reference.
933 if (cqlVal.getValueType() == CQLValue::String_type)
934 {
935 CIMObjectPath objPath(cqlVal.getString());
|
936 lucier 1.5 PEG_METHOD_EXIT();
|
937 lucier 1.4 return buildClassPath(objPath, objPath.getNameSpace());
938 }
939
940 // If we have a CIMReference parameter, then we will build the class path from the reference and return it. If the namespace is NOT set in the object path, it will remain unset in the returned reference.
941 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
942 {
943 CIMObjectPath objPath = cqlVal.getReference();
|
944 lucier 1.5 PEG_METHOD_EXIT();
|
945 lucier 1.4 return buildClassPath(objPath, objPath.getNameSpace());
946 }
947
948 // If we have a CIMObject, then we retrieve the object path and build the class path from it. If the path does not have a namespace, then the default namespace is used.
949 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
950 {
951 CIMObjectPath objPath = cqlVal.getObject().getPath();
952 CIMNamespaceName ns = objPath.getNameSpace();
953 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
954 ns = queryCtx.getNamespace();
|
955 lucier 1.5 PEG_METHOD_EXIT();
|
956 lucier 1.4 return buildClassPath(objPath, ns);
957 }
958
959 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
960 lucier 1.5 {
|
961 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
962 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
963 lucier 1.5 String("1"),
|
964 lucier 1.12 functionTypeToString(),
|
965 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
966 lucier 1.5 String("Reference, String, or Object"));
967 throw CQLRuntimeException(mload);
968 }
|
969 chuck 1.3 }
970
|
971 lucier 1.4 CQLValue CQLFunctionRep::buildClassPath(const CIMObjectPath& objPath, const CIMNamespaceName& ns) const
|
972 chuck 1.3 {
|
973 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::buildClassPath()");
|
974 lucier 1.7 // This method will take the object path pass in and pick out the host, the class name and the namespace. The 2 parts are then combined together into a new object path which will be used as the class path and returned.
|
975 lucier 1.4 CIMObjectPath newPath;
|
976 lucier 1.7 newPath.setHost(objPath.getHost());
|
977 lucier 1.4 newPath.setClassName(objPath.getClassName());
978 newPath.setNameSpace(ns);
|
979 lucier 1.12 // printf("ClassPath --> %s\n", (const char *)newPath.toString().getCString());
|
980 lucier 1.5 PEG_METHOD_EXIT();
|
981 lucier 1.4 return CQLValue(newPath);
|
982 chuck 1.3 }
983
|
984 lucier 1.4
985 CQLValue CQLFunctionRep::objectPath(const CIMInstance& CI, const QueryContext& queryCtx) const
|
986 chuck 1.3 {
|
987 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::objectPath()");
|
988 lucier 1.4 // This method returns an object path. The object path will only have a namespace, a class name, and key bindings if it is a path to an instance. All other path information will be stripped off.
989
990 int parmSize = _parms.size();
991 if(parmSize != 0 && parmSize != 1)
992 {
|
993 lucier 1.5 char buf[10];
994 sprintf(buf, "%d", _parms.size());
|
995 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
996 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
997 lucier 1.6 functionTypeToString(),
|
998 lucier 1.5 String(buf),
999 String("0"), String("1"));
1000 throw CQLRuntimeException(mload);
|
1001 lucier 1.4 }
1002
1003 // The default behavior for this function will be to retrieve the object path from the instance being examined (CI) and build the object path from it. If the path does not have a namespace, then the default namespace is used.
1004 if (parmSize == 0)
1005 {
1006 CIMObjectPath objPath(CI.getPath());
1007 CIMNamespaceName ns = objPath.getNameSpace();
1008 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
1009 ns = queryCtx.getNamespace();
|
1010 lucier 1.5 PEG_METHOD_EXIT();
|
1011 lucier 1.4 return buildObjectPath(objPath, ns);
1012 }
1013
1014 // We have a parameter, so resolve it first before we use it.
1015 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
1016
1017 // If we have a String parameter, then we'll use it to create a CIMObjectPath in order to verify the format is correct. We will then build the object path from the object path and return it. If the namespace is NOT set in the object path, it will remain unset in the returned reference.
1018 if (cqlVal.getValueType() == CQLValue::String_type)
1019 {
1020 CIMObjectPath objPath(cqlVal.getString());
|
1021 lucier 1.5 PEG_METHOD_EXIT();
|
1022 lucier 1.4 return buildObjectPath(objPath, objPath.getNameSpace());
1023 }
1024
|
1025 lucier 1.6
|
1026 lucier 1.4 // If we have a CIMReference parameter, then we will build the object path from the reference and return it. If the namespace is NOT set in the object path, it will remain unset in the returned reference.
1027 if (cqlVal.getValueType() == CQLValue::CIMReference_type)
1028 {
1029 CIMObjectPath objPath = cqlVal.getReference();
|
1030 lucier 1.5 PEG_METHOD_EXIT();
|
1031 lucier 1.4 return buildObjectPath(objPath, objPath.getNameSpace());
1032 }
1033
1034 // If we have a CIMObject, then we retrieve the object path of the obejct and build the object path from it. If the path does not have a namespace, then the default namespace is used.
1035 if (cqlVal.getValueType() == CQLValue::CIMObject_type)
1036 {
1037 CIMObjectPath objPath = cqlVal.getObject().getPath();
1038 CIMNamespaceName ns = objPath.getNameSpace();
1039 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
1040 ns = queryCtx.getNamespace();
|
1041 lucier 1.5 PEG_METHOD_EXIT();
|
1042 lucier 1.4 return buildObjectPath(objPath, ns);
1043 }
1044
1045 // If it makes it to this block of code, then no valid type was found, and hence no return was made. Throw invalid parameter type exception.
|
1046 lucier 1.5 {
|
1047 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
1048 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
1049 lucier 1.5 String("1"),
|
1050 lucier 1.12 functionTypeToString(),
|
1051 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
1052 lucier 1.5 String("Reference, String, or Object"));
1053 throw CQLRuntimeException(mload);
1054 }
|
1055 chuck 1.3 }
1056
|
1057 lucier 1.4 CQLValue CQLFunctionRep::buildObjectPath(const CIMObjectPath& objPath, const CIMNamespaceName& ns) const
|
1058 chuck 1.3 {
|
1059 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::buildObjectPath()");
|
1060 lucier 1.7 // This method will take the object path passed in and pick out the host, the class name, the namespace, and the key bindings. The parts are then combined together into a new object path which will be used as the object path and returned.
|
1061 lucier 1.4 CIMObjectPath newPath;
|
1062 lucier 1.7 newPath.setHost(objPath.getHost());
|
1063 lucier 1.4 newPath.setClassName(objPath.getClassName());
1064 newPath.setNameSpace(ns);
1065 newPath.setKeyBindings(objPath.getKeyBindings());
|
1066 lucier 1.12 // printf("ObjectPath --> %s\n", (const char *)newPath.toString().getCString());
|
1067 lucier 1.5 PEG_METHOD_EXIT();
|
1068 lucier 1.4 return CQLValue(newPath);
|
1069 chuck 1.3 }
1070
|
1071 lucier 1.4 CQLValue CQLFunctionRep::instanceToReference(const CIMInstance& CI, const QueryContext& queryCtx) const
|
1072 chuck 1.3 {
|
1073 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::instanceToReference()");
|
1074 lucier 1.4 // The parameter to this function MUST be an instance object. We will use buildPath on the instance to make the path. If there is no namespace on the instance, then the default namespace will be inserted. The completed path is then returned. Note, this could, and should be a more complete reference than the other path functions.
|
1075 lucier 1.5
|
1076 lucier 1.4 int parmSize = _parms.size();
1077 if(parmSize != 0 && parmSize != 1)
1078 {
|
1079 lucier 1.5 char buf[10];
1080 sprintf(buf, "%d", _parms.size());
|
1081 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
1082 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
1083 lucier 1.6 functionTypeToString(),
1084 String(buf),
|
1085 lucier 1.5 String("0"), String("1"));
1086 throw CQLRuntimeException(mload);
|
1087 lucier 1.4 }
1088 CIMInstance *inst = NULL;
|
1089 lucier 1.12 Boolean cleanup = false; // whether or not to delete the memory
|
1090 lucier 1.8 CIMObject obj;
|
1091 lucier 1.4
1092 // The default behavior is to use the instance being examined as the source instance (CI).
1093 if (parmSize == 0)
1094 inst = (CIMInstance *)&CI;
|
1095 lucier 1.8 else
1096 {
1097 // We have a parameter, so resolve it first before we use it.
1098 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
|
1099 lucier 1.4
|
1100 lucier 1.8 // Parameter MUST be an instance object
1101 if (cqlVal.getValueType() != CQLValue::CIMObject_type)
1102 {
|
1103 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
1104 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
1105 lucier 1.8 String("1"),
|
1106 lucier 1.12 functionTypeToString(),
|
1107 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
1108 CQLValueRep::valueTypeToString(CQLValue::CIMObject_type));
|
1109 lucier 1.8 throw CQLRuntimeException(mload);
1110 }
|
1111 lucier 1.4
|
1112 lucier 1.8 // REVIEW question. Inefficient since the CIMobject is copied via the return by value, then it is copied again via the assignment. Is there a better way to handle this?
1113 obj = cqlVal.getObject();
1114 if (!obj.isInstance())
1115 {
|
1116 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_OBJECT_TYPE"),
1117 String("Parameter $0 for function $1 must be a CIM instance."),
1118 String("1"),
1119 functionTypeToString());
|
1120 lucier 1.8 throw CQLRuntimeException(mload);
1121 }
|
1122 lucier 1.9 // Make a CIM Instance
|
1123 lucier 1.12 inst = new CIMInstance(obj);
1124 cleanup = true;
|
1125 lucier 1.4 }
|
1126 lucier 1.9
|
1127 lucier 1.4 // Get the class and build the path
1128 CIMConstClass cls = queryCtx.getClass(inst->getClassName());
1129 CIMObjectPath objPath = inst->buildPath(cls);
1130 CIMNamespaceName ns = objPath.getNameSpace();
1131 if (ns.isNull() || String::equal(ns.getString(), String::EMPTY))
1132 objPath.setNameSpace(queryCtx.getNamespace());
|
1133 lucier 1.5
|
1134 lucier 1.12 if (cleanup)
1135 {
1136 delete inst;
1137 inst = NULL;
1138 }
|
1139 lucier 1.5 PEG_METHOD_EXIT();
1140 return CQLValue(objPath);
|
1141 chuck 1.3 }
1142
|
1143 lucier 1.4 CQLValue CQLFunctionRep::currentDateTime() const
|
1144 chuck 1.3 {
|
1145 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::currentDateTime()");
|
1146 lucier 1.4 if(_parms.size() != 0)
1147 {
|
1148 lucier 1.5 char buf[10];
1149 sprintf(buf, "%d", _parms.size());
|
1150 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
1151 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
1152 lucier 1.6 functionTypeToString(),
|
1153 lucier 1.5 String(buf),
1154 String("0"), String("0"));
1155 throw CQLRuntimeException(mload);
|
1156 lucier 1.4 }
1157
|
1158 lucier 1.5 PEG_METHOD_EXIT();
|
1159 lucier 1.10 return(CQLValue(CIMDateTime::getCurrentDateTime()));
|
1160 chuck 1.3 }
1161
|
1162 lucier 1.4 CQLValue CQLFunctionRep::dateTime(const CIMInstance& CI, const QueryContext& queryCtx) const
|
1163 chuck 1.3 {
|
1164 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::dateTime()");
|
1165 lucier 1.4 if(_parms.size() != 1)
1166 {
|
1167 lucier 1.5 char buf[10];
1168 sprintf(buf, "%d", _parms.size());
|
1169 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
1170 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
1171 lucier 1.6 functionTypeToString(),
|
1172 lucier 1.5 String(buf),
1173 String("1"), String("1"));
1174 throw CQLRuntimeException(mload);
|
1175 lucier 1.4 }
1176
1177 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
1178 if(cqlVal.getValueType() != CQLValue::String_type)
1179 {
|
1180 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
1181 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
1182 lucier 1.5 String("1"),
|
1183 lucier 1.12 functionTypeToString(),
|
1184 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
1185 CQLValueRep::valueTypeToString(CQLValue::String_type));
|
1186 lucier 1.5 throw CQLRuntimeException(mload);
|
1187 lucier 1.4 }
1188
|
1189 lucier 1.10 CIMDateTime dt(cqlVal.getString());
1190 PEG_METHOD_EXIT();
1191 return(CQLValue(dt));
|
1192 chuck 1.3 }
1193
|
1194 lucier 1.4 CQLValue CQLFunctionRep::microsecondToTimestamp(const CIMInstance& CI, const QueryContext& queryCtx) const
|
1195 chuck 1.3 {
|
1196 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::microsecondToTimestamp()");
1197 if(_parms.size() != 1)
|
1198 lucier 1.4 {
|
1199 lucier 1.5 char buf[10];
1200 sprintf(buf, "%d", _parms.size());
|
1201 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
1202 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
1203 lucier 1.6 functionTypeToString(),
|
1204 lucier 1.5 String(buf),
1205 String("1"), String("1"));
1206 throw CQLRuntimeException(mload);
|
1207 lucier 1.4 }
1208
1209 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
1210 CQLValue::CQLValueType valType = cqlVal.getValueType();
1211 if(valType != CQLValue::Uint64_type &&
1212 valType != CQLValue::Sint64_type)
1213 {
|
1214 lucier 1.6
|
1215 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
1216 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
1217 lucier 1.5 String("1"),
|
1218 lucier 1.12 functionTypeToString(),
|
1219 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
1220 lucier 1.5 String("Integer"));
1221 throw CQLRuntimeException(mload);
|
1222 lucier 1.4 }
1223
1224 Uint64 uIntVal = 0;
1225 if (valType == CQLValue::Sint64_type)
1226 {
1227 Sint64 intVal = cqlVal.getSint();
1228 if (intVal < 0)
1229 {
|
1230 lucier 1.5 char negVal[100];
|
1231 kumpf 1.18 sprintf(negVal, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", intVal);
|
1232 lucier 1.5 MessageLoaderParms mload(String("CQL.CQLFunctionRep.NEGATIVE_INT_ERROR"),
|
1233 humberto 1.16 String("Parameter $0 for function $1 has a value of $2. It must be non-negative."),
|
1234 lucier 1.5 String("1"),
|
1235 humberto 1.16 functionTypeToString(),
|
1236 lucier 1.5 String(negVal));
1237 throw CQLRuntimeException(mload);
|
1238 lucier 1.4 }
1239 uIntVal = intVal;
1240 }
1241 else
1242 uIntVal = cqlVal.getUint();
1243
|
1244 lucier 1.10 PEG_METHOD_EXIT();
|
1245 chuck 1.11
|
1246 lucier 1.12 return CQLValue(CIMDateTime(uIntVal, false));
|
1247 chuck 1.3 }
1248
|
1249 lucier 1.4 CQLValue CQLFunctionRep::microsecondToInterval(const CIMInstance& CI, const QueryContext& queryCtx) const
|
1250 chuck 1.3 {
|
1251 lucier 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFunctionRep::microsecondToInterval()");
1252 if(_parms.size() != 1)
|
1253 lucier 1.4 {
|
1254 lucier 1.5 char buf[10];
1255 sprintf(buf, "%d", _parms.size());
|
1256 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_COUNT"),
|
1257 lucier 1.8 String("Function $0 has $1 parameters. It must have between $2 and $3."),
|
1258 lucier 1.6 functionTypeToString(),
|
1259 lucier 1.5 String(buf),
1260 String("1"), String("1"));
1261 throw CQLRuntimeException(mload);
|
1262 lucier 1.4 }
1263
1264 CQLValue cqlVal = _parms[0].getSimplePredicate().getLeftExpression().resolveValue(CI,queryCtx);
1265 CQLValue::CQLValueType valType = cqlVal.getValueType();
1266 if(valType != CQLValue::Uint64_type &&
1267 valType != CQLValue::Sint64_type)
1268 {
|
1269 humberto 1.16 MessageLoaderParms mload(String("CQL.CQLFunctionRep.INVALID_PARM_TYPE"),
|
1270 lucier 1.12 String("Parameter $0 for function $1 has type $2. It must be type $3."),
|
1271 lucier 1.5 String("1"),
|
1272 lucier 1.12 functionTypeToString(),
|
1273 humberto 1.16 CQLValueRep::valueTypeToString(cqlVal.getValueType()),
|
1274 lucier 1.5 String("Integer"));
1275 throw CQLRuntimeException(mload);
|
1276 lucier 1.4 }
1277
1278 Uint64 uIntVal = 0;
1279
1280 if (valType == CQLValue::Sint64_type)
1281 {
1282 Sint64 intVal = cqlVal.getSint();
1283 if (intVal < 0)
1284 {
|
1285 lucier 1.5 char negVal[100];
|
1286 kumpf 1.18 sprintf(negVal, "%" PEGASUS_64BIT_CONVERSION_WIDTH "d", intVal);
|
1287 lucier 1.5 MessageLoaderParms mload(String("CQL.CQLFunctionRep.NEGATIVE_INT_ERROR"),
|
1288 humberto 1.16 String("Parameter $0 for function $1 has a value of $2. It must be non-negative."),
|
1289 lucier 1.5 String("1"),
|
1290 humberto 1.16 functionTypeToString(),
|
1291 lucier 1.5 String(negVal));
1292 throw CQLRuntimeException(mload);
|
1293 lucier 1.4 }
1294 uIntVal = intVal;
1295 }
1296 else
1297 uIntVal = cqlVal.getUint();
1298
|
1299 lucier 1.10 PEG_METHOD_EXIT();
|
1300 lucier 1.12 return CQLValue(CIMDateTime(uIntVal, true));
|
1301 chuck 1.3 }
1302
|
1303 humberto 1.1 PEGASUS_NAMESPACE_END
|