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 #ifndef _OSL_DIAGNOSE_H_
23 #include <osl/diagnose.h>
24 #endif
25 #include "mysqlc_propertyids.hxx"
26
27 using ::rtl::OUString;
28
29 namespace connectivity
30 {
31 namespace mysqlc
32 {
getPROPERTY_QUERYTIMEOUT()33 const sal_Char* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; }
getPROPERTY_MAXFIELDSIZE()34 const sal_Char* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; }
getPROPERTY_MAXROWS()35 const sal_Char* getPROPERTY_MAXROWS() { return "MaxRows"; }
getPROPERTY_CURSORNAME()36 const sal_Char* getPROPERTY_CURSORNAME() { return "CursorName"; }
getPROPERTY_RESULTSETCONCURRENCY()37 const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; }
getPROPERTY_RESULTSETTYPE()38 const sal_Char* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; }
getPROPERTY_FETCHDIRECTION()39 const sal_Char* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; }
getPROPERTY_FETCHSIZE()40 const sal_Char* getPROPERTY_FETCHSIZE() { return "FetchSize"; }
getPROPERTY_ESCAPEPROCESSING()41 const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; }
getPROPERTY_USEBOOKMARKS()42 const sal_Char* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; }
43
getPROPERTY_NAME()44 const sal_Char* getPROPERTY_NAME() { return "Name"; }
getPROPERTY_TYPE()45 const sal_Char* getPROPERTY_TYPE() { return "Type"; }
getPROPERTY_TYPENAME()46 const sal_Char* getPROPERTY_TYPENAME() { return "TypeName"; }
getPROPERTY_PRECISION()47 const sal_Char* getPROPERTY_PRECISION() { return "Precision"; }
getPROPERTY_SCALE()48 const sal_Char* getPROPERTY_SCALE() { return "Scale"; }
getPROPERTY_ISNULLABLE()49 const sal_Char* getPROPERTY_ISNULLABLE() { return "IsNullable"; }
getPROPERTY_ISAUTOINCREMENT()50 const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; }
getPROPERTY_ISROWVERSION()51 const sal_Char* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; }
getPROPERTY_DESCRIPTION()52 const sal_Char* getPROPERTY_DESCRIPTION() { return "Description"; }
getPROPERTY_DEFAULTVALUE()53 const sal_Char* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; }
54
getPROPERTY_REFERENCEDTABLE()55 const sal_Char* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; }
getPROPERTY_UPDATERULE()56 const sal_Char* getPROPERTY_UPDATERULE() { return "UpdateRule"; }
getPROPERTY_DELETERULE()57 const sal_Char* getPROPERTY_DELETERULE() { return "DeleteRule"; }
getPROPERTY_CATALOG()58 const sal_Char* getPROPERTY_CATALOG() { return "Catalog"; }
getPROPERTY_ISUNIQUE()59 const sal_Char* getPROPERTY_ISUNIQUE() { return "IsUnique"; }
getPROPERTY_ISPRIMARYKEYINDEX()60 const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; }
getPROPERTY_ISCLUSTERED()61 const sal_Char* getPROPERTY_ISCLUSTERED() { return "IsClustered"; }
getPROPERTY_ISASCENDING()62 const sal_Char* getPROPERTY_ISASCENDING() { return "IsAscending"; }
getPROPERTY_SCHEMANAME()63 const sal_Char* getPROPERTY_SCHEMANAME() { return "SchemaName"; }
getPROPERTY_CATALOGNAME()64 const sal_Char* getPROPERTY_CATALOGNAME() { return "CatalogName"; }
getPROPERTY_COMMAND()65 const sal_Char* getPROPERTY_COMMAND() { return "Command"; }
getPROPERTY_CHECKOPTION()66 const sal_Char* getPROPERTY_CHECKOPTION() { return "CheckOption"; }
getPROPERTY_PASSWORD()67 const sal_Char* getPROPERTY_PASSWORD() { return "Password"; }
getPROPERTY_RELATEDCOLUMN()68 const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; }
69
getSTAT_INVALID_INDEX()70 const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; }
71
getPROPERTY_FUNCTION()72 const sal_Char* getPROPERTY_FUNCTION() { return "Function"; }
getPROPERTY_TABLENAME()73 const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; }
getPROPERTY_REALNAME()74 const sal_Char* getPROPERTY_REALNAME() { return "RealName"; }
getPROPERTY_DBASEPRECISIONCHANGED()75 const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; }
getPROPERTY_ISCURRENCY()76 const sal_Char* getPROPERTY_ISCURRENCY() { return "IsCurrency"; }
getPROPERTY_ISBOOKMARKABLE()77 const sal_Char* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; }
78
getPROPERTY_FORMATKEY()79 const sal_Char* getPROPERTY_FORMATKEY() { return "FormatKey"; }
getPROPERTY_LOCALE()80 const sal_Char* getPROPERTY_LOCALE() { return "Locale"; }
81
getPROPERTY_AUTOINCREMENTCREATION()82 const sal_Char* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; }
getPROPERTY_PRIVILEGES()83 const sal_Char* getPROPERTY_PRIVILEGES() { return "Privileges"; }
84 //============================================================
85 //= error messages
86 //============================================================
getERRORMSG_SEQUENCE()87 const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; }
getSQLSTATE_SEQUENCE()88 const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; }
getSQLSTATE_GENERAL()89 const sal_Char* getSQLSTATE_GENERAL() { return "HY0000"; }
getSTR_DELIMITER()90 const sal_Char* getSTR_DELIMITER() { return "/"; }
91
92
93
94 /* {{{ OPropertyMap::~OPropertyMap() -I- */
~OPropertyMap()95 OPropertyMap::~OPropertyMap()
96 {
97 ::std::map<sal_Int32 , rtl_uString*>::iterator aIter = m_aPropertyMap.begin();
98 for(; aIter != m_aPropertyMap.end(); ++aIter) {
99 if (aIter->second) {
100 rtl_uString_release(aIter->second);
101 }
102 }
103 }
104 /* }}} */
105
106
107 /* {{{ OPropertyMap::getNameByIndex() -I- */
getNameByIndex(sal_Int32 idx) const108 OUString OPropertyMap::getNameByIndex(sal_Int32 idx) const
109 {
110 OUString sRet;
111 ::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(idx);
112 if (aIter == m_aPropertyMap.end()) {
113 sRet = const_cast<OPropertyMap*>(this)->fillValue(idx);
114 } else {
115 sRet = aIter->second;
116 }
117 return sRet;
118 }
119 /* }}} */
120
121 typedef const sal_Char * (*property_callback)();
122
123 static const property_callback property_callbacks[PROPERTY_ID_LAST] =
124 {
125 NULL, /* PROPERTY_ID_FIRST */
126 getPROPERTY_QUERYTIMEOUT,
127 getPROPERTY_MAXFIELDSIZE,
128 getPROPERTY_MAXROWS,
129 getPROPERTY_CURSORNAME,
130 getPROPERTY_RESULTSETCONCURRENCY,
131 getPROPERTY_RESULTSETTYPE,
132 getPROPERTY_FETCHDIRECTION,
133 getPROPERTY_FETCHSIZE,
134 getPROPERTY_ESCAPEPROCESSING,
135 getPROPERTY_USEBOOKMARKS,
136 // Column
137 getPROPERTY_NAME,
138 getPROPERTY_TYPE,
139 getPROPERTY_TYPENAME,
140 getPROPERTY_PRECISION,
141 getPROPERTY_SCALE,
142 getPROPERTY_ISNULLABLE,
143 getPROPERTY_ISAUTOINCREMENT,
144 getPROPERTY_ISROWVERSION,
145 getPROPERTY_DESCRIPTION,
146 getPROPERTY_DEFAULTVALUE,
147
148 getPROPERTY_REFERENCEDTABLE,
149 getPROPERTY_UPDATERULE,
150 getPROPERTY_DELETERULE,
151 getPROPERTY_CATALOG,
152 getPROPERTY_ISUNIQUE,
153 getPROPERTY_ISPRIMARYKEYINDEX,
154 getPROPERTY_ISCLUSTERED,
155 getPROPERTY_ISASCENDING,
156 getPROPERTY_SCHEMANAME,
157 getPROPERTY_CATALOGNAME,
158
159 getPROPERTY_COMMAND,
160 getPROPERTY_CHECKOPTION,
161 getPROPERTY_PASSWORD,
162 getPROPERTY_RELATEDCOLUMN,
163
164 getPROPERTY_FUNCTION,
165 getPROPERTY_TABLENAME,
166 getPROPERTY_REALNAME,
167 getPROPERTY_DBASEPRECISIONCHANGED,
168 getPROPERTY_ISCURRENCY,
169 getPROPERTY_ISBOOKMARKABLE,
170 getSTAT_INVALID_INDEX,
171 getERRORMSG_SEQUENCE,
172 getSQLSTATE_SEQUENCE,
173 getSQLSTATE_GENERAL,
174 getSTR_DELIMITER,
175 getPROPERTY_FORMATKEY,
176 getPROPERTY_LOCALE,
177 getPROPERTY_AUTOINCREMENTCREATION,
178 getPROPERTY_PRIVILEGES,
179 };
180
181
182 /* {{{ OPropertyMap::fillValue() -I- */
fillValue(sal_Int32 idx)183 OUString OPropertyMap::fillValue(sal_Int32 idx)
184 {
185 rtl_uString* pStr = NULL;
186 rtl_uString_newFromAscii(&pStr, property_callbacks[idx]());
187 m_aPropertyMap[idx] = pStr;
188 return pStr;
189 }
190 /* }}} */
191
192 } /* mysqlc */
193 } /* connectivity */
194
195 /*
196 * Local variables:
197 * tab-width: 4
198 * c-basic-offset: 4
199 * End:
200 * vim600: noet sw=4 ts=4 fdm=marker
201 * vim<600: noet sw=4 ts=4
202 */
203