1 mike 1.2 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 mike 1.2 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
26 // Modified By:
27 //
28 //%/////////////////////////////////////////////////////////////////////////////
29
30 #include <Pegasus/Common/Config.h>
31 #include <Pegasus/Common/Exception.h>
|
75 mike 1.3 void WQLParser::parse(
76 const Array<Sint8>& text,
77 WQLSelectStatement& statement)
78 {
79 if (text.size() == 0 || text[text.size() - 1] != '\0')
80 throw MissingNullTerminator();
81
82 parse(text.getData(), statement);
83 }
84
85 void WQLParser::parse(
86 const String& text,
87 WQLSelectStatement& statement)
88 {
89 char* tmpText = text.allocateCString();
90 ArrayDestroyer<char> destroyer(tmpText);
91 parse(tmpText, statement);
92 }
93
|
94 mike 1.2 void WQLParser::cleanup()
95 {
96 Array<char*>& arr = globalParserState->outstandingStrings;
97
98 for (Uint32 i = 0, n = arr.size(); i < n; i++)
99 delete [] arr[i];
100
101 arr.clear();
102 }
103
104 PEGASUS_NAMESPACE_END
105
106 PEGASUS_USING_PEGASUS;
107
108 int WQL_error(char* errorMessage)
109 {
110 globalParserState->error = true;
111 globalParserState->errorMessage = errorMessage;
112 return -1;
113 }
114
115 mike 1.2 int WQLInput(char* buffer, int& numRead, int numRequested)
116 {
117 //
118 // Be sure to account for the null terminator (the size of the text will
119 // be one or more; this is fixed checked beforehand by WQLParser::parse()).
120 //
121
122 int remaining =
|