1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 #include "FDatabaseMetaDataResultSetMetaData.hxx"
27 #include <com/sun/star/sdbc/DataType.hpp>
28 #include <com/sun/star/sdbc/ProcedureResult.hpp>
29 #include <com/sun/star/sdbc/ColumnValue.hpp>
30 
31 using namespace connectivity;
32 using namespace ::com::sun::star::beans;
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::sdbcx;
35 using namespace ::com::sun::star::sdbc;
36 using namespace ::com::sun::star::container;
37 using namespace ::com::sun::star::lang;
38 
39 // -------------------------------------------------------------------------
~ODatabaseMetaDataResultSetMetaData()40 ODatabaseMetaDataResultSetMetaData::~ODatabaseMetaDataResultSetMetaData()
41 {
42 }
43 // -------------------------------------------------------------------------
getColumnDisplaySize(sal_Int32 column)44 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
45 {
46 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
47 		return (*m_mColumnsIter).second.getColumnDisplaySize();
48 
49 	return 0;
50 }
51 // -------------------------------------------------------------------------
52 
getColumnType(sal_Int32 column)53 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
54 {
55 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
56 		return (*m_mColumnsIter).second.getColumnType();
57 	return 1;
58 }
59 // -------------------------------------------------------------------------
60 
getColumnCount()61 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnCount(  ) throw(SQLException, RuntimeException)
62 {
63 	return m_mColumns.size();
64 }
65 // -------------------------------------------------------------------------
66 
isCaseSensitive(sal_Int32 column)67 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
68 {
69 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
70 		return (*m_mColumnsIter).second.isCaseSensitive();
71 	return sal_True;
72 }
73 // -------------------------------------------------------------------------
74 
getSchemaName(sal_Int32)75 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
76 {
77 	return ::rtl::OUString();
78 }
79 // -------------------------------------------------------------------------
80 
getColumnName(sal_Int32 column)81 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
82 {
83 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
84 		return (*m_mColumnsIter).second.getColumnName();
85 	return ::rtl::OUString();
86 }
87 // -------------------------------------------------------------------------
getTableName(sal_Int32 column)88 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
89 {
90 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
91 		return (*m_mColumnsIter).second.getTableName();
92 	return ::rtl::OUString();
93 }
94 // -------------------------------------------------------------------------
getCatalogName(sal_Int32)95 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
96 {
97 	return ::rtl::OUString();
98 }
99 // -------------------------------------------------------------------------
getColumnTypeName(sal_Int32 column)100 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
101 {
102 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
103 		return (*m_mColumnsIter).second.getColumnTypeName();
104 	return ::rtl::OUString();
105 }
106 // -------------------------------------------------------------------------
getColumnLabel(sal_Int32 column)107 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
108 {
109 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
110 		return (*m_mColumnsIter).second.getColumnLabel();
111 	return getColumnName(column);
112 }
113 // -------------------------------------------------------------------------
getColumnServiceName(sal_Int32 column)114 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
115 {
116 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
117 		return (*m_mColumnsIter).second.getColumnServiceName();
118 	return ::rtl::OUString();
119 }
120 // -------------------------------------------------------------------------
121 
isCurrency(sal_Int32 column)122 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
123 {
124 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
125 		return (*m_mColumnsIter).second.isCurrency();
126 	return sal_False;
127 }
128 // -------------------------------------------------------------------------
129 
isAutoIncrement(sal_Int32 column)130 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
131 {
132 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
133 		return (*m_mColumnsIter).second.isAutoIncrement();
134 	return sal_False;
135 }
136 // -------------------------------------------------------------------------
137 
138 
isSigned(sal_Int32 column)139 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
140 {
141 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
142 		return (*m_mColumnsIter).second.isSigned();
143 	return sal_False;
144 }
145 // -------------------------------------------------------------------------
getPrecision(sal_Int32 column)146 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
147 {
148 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
149 		return (*m_mColumnsIter).second.getPrecision();
150 	return 0;
151 }
152 // -------------------------------------------------------------------------
getScale(sal_Int32 column)153 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
154 {
155 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
156 		return (*m_mColumnsIter).second.getScale();
157 
158 	return 0;
159 }
160 // -------------------------------------------------------------------------
161 
isNullable(sal_Int32 column)162 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
163 {
164 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
165 		return (*m_mColumnsIter).second.isNullable();
166 
167 	return sal_False;
168 }
169 // -------------------------------------------------------------------------
170 
isSearchable(sal_Int32 column)171 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
172 {
173 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
174 		return (*m_mColumnsIter).second.isSearchable();
175 	return sal_True;
176 }
177 // -------------------------------------------------------------------------
178 
isReadOnly(sal_Int32)179 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isReadOnly( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
180 {
181 //	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
182 //		return (*m_mColumnsIter).second.isReadOnly();
183 
184 	return sal_True;
185 }
186 // -------------------------------------------------------------------------
187 
isDefinitelyWritable(sal_Int32)188 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isDefinitelyWritable( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
189 {
190 //	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
191 //		return (*m_mColumnsIter).second.isDefinitelyWritable();
192 
193 	return sal_False;
194 ;
195 }
196 // -------------------------------------------------------------------------
isWritable(sal_Int32 column)197 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
198 {
199 //	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
200 //		return (*m_mColumnsIter).second.isWritable();
201 	return isDefinitelyWritable(column);
202 }
203 // -------------------------------------------------------------------------
setColumnPrivilegesMap()204 void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap()
205 {
206     setColumnMap();
207 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTOR"),
208                 ColumnValue::NULLABLE,
209 		3,3,0,
210                 DataType::VARCHAR);
211 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTEE"),
212                 ColumnValue::NULLABLE,
213 		3,3,0,
214                 DataType::VARCHAR);
215 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"),
216                 ColumnValue::NULLABLE,
217 		3,3,0,
218                 DataType::VARCHAR);
219 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"),
220                 ColumnValue::NULLABLE,
221 		3,3,0,
222                 DataType::VARCHAR);
223 }
224 // -----------------------------------------------------------------------------
setTableNameMap()225 void ODatabaseMetaDataResultSetMetaData::setTableNameMap()
226 {
227     m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_CAT"),
228                 ColumnValue::NULLABLE,
229 		3,3,0,
230                 DataType::VARCHAR);
231 	m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_SCHEM"),
232                 ColumnValue::NULLABLE,
233 		3,3,0,
234                 DataType::VARCHAR);
235 	m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_NAME"),
236                 ColumnValue::NO_NULLS,
237 		3,3,0,
238                 DataType::VARCHAR);
239 }
240 // -----------------------------------------------------------------------------
setColumnMap()241 void ODatabaseMetaDataResultSetMetaData::setColumnMap()
242 {
243     setTableNameMap();
244 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"),
245                 ColumnValue::NO_NULLS,
246 		3,3,0,
247                 DataType::VARCHAR);
248 }
249 // -------------------------------------------------------------------------
setColumnsMap()250 void ODatabaseMetaDataResultSetMetaData::setColumnsMap()
251 {
252     setColumnMap();
253 
254 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"),
255                 ColumnValue::NO_NULLS,
256 		0,0,0,
257                 DataType::INTEGER);
258 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"),
259                 ColumnValue::NO_NULLS,
260 		0,0,0,
261                 DataType::VARCHAR);
262 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_SIZE"),
263                 ColumnValue::NO_NULLS,
264 		3,3,0,
265                 DataType::INTEGER);
266 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("BUFFER_LENGTH"),
267                 ColumnValue::NULLABLE,
268 		3,3,0,
269                 DataType::INTEGER);
270 	m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DECIMAL_DIGITS"),
271                 ColumnValue::NO_NULLS,
272 		0,0,0,
273                 DataType::INTEGER);
274 	m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"),
275                 ColumnValue::NO_NULLS,
276 		0,0,0,
277                 DataType::INTEGER);
278 	m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"),
279                 ColumnValue::NO_NULLS,
280 		1,1,0,
281                 DataType::INTEGER);
282 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
283                 ColumnValue::NULLABLE,
284 		0,0,0,
285                 DataType::VARCHAR);
286 	m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_DEF"),
287                 ColumnValue::NULLABLE,
288 		0,0,0,
289                 DataType::VARCHAR);
290 	m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"),
291                 ColumnValue::NO_NULLS,
292 		1,1,0,
293                 DataType::INTEGER);
294 	m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"),
295                 ColumnValue::NO_NULLS,
296 		1,1,0,
297                 DataType::INTEGER);
298 	m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CHAR_OCTET_LENGTH"),
299                 ColumnValue::NO_NULLS,
300 		1,1,0,
301                 DataType::INTEGER);
302 	m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ORDINAL_POSITION"),
303                 ColumnValue::NO_NULLS,
304 		1,1,0,
305                 DataType::INTEGER);
306 	m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_NULLABLE"),
307                 ColumnValue::NO_NULLS,
308 		1,1,0,
309                 DataType::VARCHAR);
310 }
311 // -------------------------------------------------------------------------
setTablesMap()312 void ODatabaseMetaDataResultSetMetaData::setTablesMap()
313 {
314     setTableNameMap();
315 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_TYPE"),
316                 ColumnValue::NO_NULLS,
317 		0,0,0,
318                 DataType::VARCHAR);
319 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
320                 ColumnValue::NULLABLE,
321 		0,0,0,
322                 DataType::VARCHAR);
323 }
324 // -------------------------------------------------------------------------
setProcedureNameMap()325 void ODatabaseMetaDataResultSetMetaData::setProcedureNameMap()
326 {
327    m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_CAT"),
328                 ColumnValue::NULLABLE,
329 		0,0,0,
330                 DataType::VARCHAR);
331 	m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_SCHEM"),
332                 ColumnValue::NULLABLE,
333 		0,0,0,
334                 DataType::VARCHAR);
335 	m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_NAME"),
336                 ColumnValue::NO_NULLS,
337 		0,0,0,
338                 DataType::VARCHAR);
339 }
340 // -------------------------------------------------------------------------
setProcedureColumnsMap()341 void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap()
342 {
343     setProcedureNameMap();
344 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"),
345                 ColumnValue::NO_NULLS,
346 		0,0,0,
347                 DataType::VARCHAR);
348 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_TYPE"),
349                 ColumnValue::NO_NULLS,
350 		0,0,0,
351                 DataType::INTEGER);
352 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"),
353                 ColumnValue::NO_NULLS,
354 		0,0,0,
355                 DataType::INTEGER);
356 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"),
357                 ColumnValue::NULLABLE,
358 		0,0,0,
359                 DataType::VARCHAR);
360 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"),
361                 ColumnValue::NO_NULLS,
362 		0,0,0,
363                 DataType::INTEGER);
364 	m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LENGTH"),
365                 ColumnValue::NO_NULLS,
366 		0,0,0,
367                 DataType::INTEGER);
368 	m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SCALE"),
369                 ColumnValue::NO_NULLS,
370 		0,0,0,
371                 DataType::INTEGER);
372 	m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RADIX"),
373                 ColumnValue::NO_NULLS,
374 		0,0,0,
375                 DataType::INTEGER);
376 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"),
377                 ColumnValue::NO_NULLS,
378 		0,0,0,
379                 DataType::INTEGER);
380 	m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
381                 ColumnValue::NULLABLE,
382 		0,0,0,
383                 DataType::VARCHAR);
384 
385 }
386 // -------------------------------------------------------------------------
setPrimaryKeysMap()387 void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap()
388 {
389     setColumnMap();
390 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"),
391                 ColumnValue::NO_NULLS,
392 		1,1,0,
393                 DataType::INTEGER);
394 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"),
395                 ColumnValue::NULLABLE,
396 		0,0,0,
397                 DataType::VARCHAR);
398 }
399 // -------------------------------------------------------------------------
setIndexInfoMap()400 void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap()
401 {
402     setTableNameMap();
403 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NON_UNIQUE"),
404                 ColumnValue::NO_NULLS,
405 		1,1,0,
406                 DataType::BIT);
407 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_QUALIFIER"),
408                 ColumnValue::NULLABLE,
409 		0,0,0,
410                 DataType::VARCHAR);
411 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_NAME"),
412                 ColumnValue::NULLABLE,
413 		0,0,0,
414                 DataType::VARCHAR);
415 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE"),
416                 ColumnValue::NO_NULLS,
417 		0,0,0,
418                 DataType::INTEGER);
419 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ORDINAL_POSITION"),
420                 ColumnValue::NO_NULLS,
421 		0,0,0,
422                 DataType::INTEGER);
423 	m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"),
424                 ColumnValue::NO_NULLS,
425 		0,0,0,
426                 DataType::VARCHAR);
427 	m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ASC_OR_DESC"),
428                 ColumnValue::NULLABLE,
429 		0,0,0,
430                 DataType::VARCHAR);
431 	m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CARDINALITY"),
432                 ColumnValue::NO_NULLS,
433 		0,0,0,
434                 DataType::INTEGER);
435 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PAGES"),
436                 ColumnValue::NO_NULLS,
437 		0,0,0,
438                 DataType::INTEGER);
439 	m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FILTER_CONDITION"),
440                 ColumnValue::NULLABLE,
441 		0,0,0,
442                 DataType::VARCHAR);
443 }
444 // -------------------------------------------------------------------------
setTablePrivilegesMap()445 void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap()
446 {
447     setTableNameMap();
448 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTOR"),
449                 ColumnValue::NULLABLE,
450 		0,0,0,
451                 DataType::VARCHAR);
452 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTEE"),
453                 ColumnValue::NO_NULLS,
454 		0,0,0,
455                 DataType::VARCHAR);
456 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"),
457                 ColumnValue::NULLABLE,
458 		0,0,0,
459                 DataType::VARCHAR);
460 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"),
461                 ColumnValue::NULLABLE,
462 		0,0,0,
463                 DataType::VARCHAR);
464 }
465 // -------------------------------------------------------------------------
setCrossReferenceMap()466 void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap()
467 {
468 	m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKTABLE_CAT"),
469                 ColumnValue::NULLABLE,
470 		0,0,0,
471                 DataType::VARCHAR);
472 	m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKTABLE_SCHEM"),
473                 ColumnValue::NULLABLE,
474 		0,0,0,
475                 DataType::VARCHAR);
476 	m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKTABLE_NAME"),
477                 ColumnValue::NO_NULLS,
478 		0,0,0,
479                 DataType::VARCHAR);
480 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKCOLUMN_NAME"),
481                 ColumnValue::NO_NULLS,
482 		0,0,0,
483                 DataType::VARCHAR);
484 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKTABLE_CAT"),
485                 ColumnValue::NULLABLE,
486 		0,0,0,
487                 DataType::VARCHAR);
488 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKTABLE_SCHEM"),
489                 ColumnValue::NULLABLE,
490 		0,0,0,
491                 DataType::VARCHAR);
492 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKTABLE_NAME"),
493                 ColumnValue::NO_NULLS,
494 		0,0,0,
495                 DataType::VARCHAR);
496 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKCOLUMN_NAME"),
497                 ColumnValue::NO_NULLS,
498 		0,0,0,
499                 DataType::VARCHAR);
500 
501 	m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"),
502                 ColumnValue::NO_NULLS,
503 		1,1,0,
504                 DataType::INTEGER);
505 	m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("UPDATE_RULE"),
506                 ColumnValue::NO_NULLS,
507 		1,1,0,
508                 DataType::INTEGER);
509 	m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DELETE_RULE"),
510                 ColumnValue::NO_NULLS,
511 		1,1,0,
512                 DataType::INTEGER);
513 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FK_NAME"),
514                 ColumnValue::NULLABLE,
515 		0,0,0,
516                 DataType::VARCHAR);
517 	m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"),
518                 ColumnValue::NULLABLE,
519 		0,0,0,
520                 DataType::VARCHAR);
521 	m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DEFERRABILITY"),
522                 ColumnValue::NO_NULLS,
523 		1,1,0,
524                 DataType::INTEGER);
525 }
526 // -------------------------------------------------------------------------
setTypeInfoMap()527 void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap()
528 {
529 	m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"),
530                 ColumnValue::NO_NULLS,
531 		0,0,0,
532                 DataType::VARCHAR);
533 	m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"),
534                 ColumnValue::NO_NULLS,
535 		1,1,0,
536                 DataType::INTEGER);
537 	m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"),
538                 ColumnValue::NO_NULLS,
539 		1,1,0,
540                 DataType::INTEGER);
541 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LITERAL_PREFIX"),
542                 ColumnValue::NULLABLE,
543 		0,0,0,
544                 DataType::VARCHAR);
545 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LITERAL_SUFFIX"),
546                 ColumnValue::NULLABLE,
547 		0,0,0,
548                 DataType::VARCHAR);
549 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CREATE_PARAMS"),
550                 ColumnValue::NULLABLE,
551 		0,0,0,
552                 DataType::VARCHAR);
553 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"),
554                 ColumnValue::NO_NULLS,
555 		1,1,0,
556                 DataType::INTEGER);
557 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CASE_SENSITIVE"),
558                 ColumnValue::NO_NULLS,
559 		1,1,0,
560                 DataType::BIT);
561 	m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SEARCHABLE"),
562                 ColumnValue::NO_NULLS,
563 		1,1,0,
564                 DataType::INTEGER);
565 	m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("UNSIGNED_ATTRIBUTE"),
566                 ColumnValue::NO_NULLS,
567 		1,1,0,
568                 DataType::BIT);
569 	m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FIXED_PREC_SCALE"),
570                 ColumnValue::NO_NULLS,
571 		1,1,0,
572                 DataType::BIT);
573 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("AUTO_INCREMENT"),
574                 ColumnValue::NO_NULLS,
575 		1,1,0,
576                 DataType::BIT);
577 	m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LOCAL_TYPE_NAME"),
578                 ColumnValue::NO_NULLS,
579 		0,0,0,
580                 DataType::VARCHAR);
581 	m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("MINIMUM_SCALE"),
582                 ColumnValue::NO_NULLS,
583 		0,0,0,
584                 DataType::INTEGER);
585 	m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("MAXIMUM_SCALE"),
586                 ColumnValue::NO_NULLS,
587 		0,0,0,
588                 DataType::INTEGER);
589 	m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"),
590                 ColumnValue::NO_NULLS,
591 		1,1,0,
592                 DataType::INTEGER);
593 	m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"),
594                 ColumnValue::NO_NULLS,
595 		1,1,0,
596                 DataType::INTEGER);
597 	m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"),
598                 ColumnValue::NO_NULLS,
599 		1,1,0,
600                 DataType::INTEGER);
601 }
602 // -------------------------------------------------------------------------
setProceduresMap()603 void ODatabaseMetaDataResultSetMetaData::setProceduresMap()
604 {
605 	setProcedureNameMap();
606 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RESERVED1"),
607                 ColumnValue::NULLABLE,
608 		0,0,0,
609                 DataType::VARCHAR);
610 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RESERVED2"),
611                 ColumnValue::NULLABLE,
612 		0,0,0,
613                 DataType::VARCHAR);
614 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RESERVED3"),
615                 ColumnValue::NULLABLE,
616 		0,0,0,
617                 DataType::VARCHAR);
618 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
619                 ColumnValue::NULLABLE,
620 		0,0,0,
621                 DataType::VARCHAR);
622 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_TYPE"),
623                 ColumnValue::NO_NULLS,
624 		1,1,0,
625                 DataType::INTEGER);
626 }
627 // -------------------------------------------------------------------------
setTableTypes()628 void ODatabaseMetaDataResultSetMetaData::setTableTypes()
629 {
630 	m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_TYPE"),
631                 ColumnValue::NULLABLE,
632 		0,0,0,
633                 DataType::VARCHAR);
634 }
635 // -------------------------------------------------------------------------
setCatalogsMap()636 void ODatabaseMetaDataResultSetMetaData::setCatalogsMap()
637 {
638 	m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_CAT"),
639                 ColumnValue::NULLABLE,
640 		0,0,0,
641                 DataType::VARCHAR);
642 }
643 // -------------------------------------------------------------------------
setSchemasMap()644 void ODatabaseMetaDataResultSetMetaData::setSchemasMap()
645 {
646 	m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_SCHEM"),
647                 ColumnValue::NULLABLE,
648 		0,0,0,
649                 DataType::VARCHAR);
650 }
651 // -------------------------------------------------------------------------
setVersionColumnsMap()652 void ODatabaseMetaDataResultSetMetaData::setVersionColumnsMap()
653 {
654    m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SCOPE"),
655                 ColumnValue::NO_NULLS,
656 		0,0,0,
657                 DataType::INTEGER);
658 	m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"),
659                 ColumnValue::NO_NULLS,
660 		0,0,0,
661                 DataType::VARCHAR);
662 	m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"),
663                 ColumnValue::NO_NULLS,
664 		0,0,0,
665                 DataType::INTEGER);
666 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"),
667                 ColumnValue::NO_NULLS,
668 		0,0,0,
669                 DataType::VARCHAR);
670 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_SIZE"),
671                 ColumnValue::NO_NULLS,
672 		0,0,0,
673                 DataType::INTEGER);
674 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("BUFFER_LENGTH"),
675                 ColumnValue::NO_NULLS,
676 		0,0,0,
677                 DataType::INTEGER);
678 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DECIMAL_DIGITS"),
679                 ColumnValue::NULLABLE,
680 		0,0,0,
681                 DataType::INTEGER);
682 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PSEUDO_COLUMN"),
683                 ColumnValue::NO_NULLS,
684 		0,0,0,
685                 DataType::INTEGER);
686 }
687 
688 
689