1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <osl/diagnose.h>
21 #include "mysqlc_propertyids.hxx"
24 namespace connectivity
28 const sal_Char
* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; }
29 const sal_Char
* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; }
30 const sal_Char
* getPROPERTY_MAXROWS() { return "MaxRows"; }
31 const sal_Char
* getPROPERTY_CURSORNAME() { return "CursorName"; }
32 const sal_Char
* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; }
33 const sal_Char
* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; }
34 const sal_Char
* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; }
35 const sal_Char
* getPROPERTY_FETCHSIZE() { return "FetchSize"; }
36 const sal_Char
* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; }
37 const sal_Char
* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; }
39 const sal_Char
* getPROPERTY_NAME() { return "Name"; }
40 const sal_Char
* getPROPERTY_TYPE() { return "Type"; }
41 const sal_Char
* getPROPERTY_TYPENAME() { return "TypeName"; }
42 const sal_Char
* getPROPERTY_PRECISION() { return "Precision"; }
43 const sal_Char
* getPROPERTY_SCALE() { return "Scale"; }
44 const sal_Char
* getPROPERTY_ISNULLABLE() { return "IsNullable"; }
45 const sal_Char
* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; }
46 const sal_Char
* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; }
47 const sal_Char
* getPROPERTY_DESCRIPTION() { return "Description"; }
48 const sal_Char
* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; }
50 const sal_Char
* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; }
51 const sal_Char
* getPROPERTY_UPDATERULE() { return "UpdateRule"; }
52 const sal_Char
* getPROPERTY_DELETERULE() { return "DeleteRule"; }
53 const sal_Char
* getPROPERTY_CATALOG() { return "Catalog"; }
54 const sal_Char
* getPROPERTY_ISUNIQUE() { return "IsUnique"; }
55 const sal_Char
* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; }
56 const sal_Char
* getPROPERTY_ISCLUSTERED() { return "IsClustered"; }
57 const sal_Char
* getPROPERTY_ISASCENDING() { return "IsAscending"; }
58 const sal_Char
* getPROPERTY_SCHEMANAME() { return "SchemaName"; }
59 const sal_Char
* getPROPERTY_CATALOGNAME() { return "CatalogName"; }
60 const sal_Char
* getPROPERTY_COMMAND() { return "Command"; }
61 const sal_Char
* getPROPERTY_CHECKOPTION() { return "CheckOption"; }
62 const sal_Char
* getPROPERTY_PASSWORD() { return "Password"; }
63 const sal_Char
* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; }
65 const sal_Char
* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; }
67 const sal_Char
* getPROPERTY_FUNCTION() { return "Function"; }
68 const sal_Char
* getPROPERTY_TABLENAME() { return "TableName"; }
69 const sal_Char
* getPROPERTY_REALNAME() { return "RealName"; }
70 const sal_Char
* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; }
71 const sal_Char
* getPROPERTY_ISCURRENCY() { return "IsCurrency"; }
72 const sal_Char
* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; }
74 const sal_Char
* getPROPERTY_FORMATKEY() { return "FormatKey"; }
75 const sal_Char
* getPROPERTY_LOCALE() { return "Locale"; }
77 const sal_Char
* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; }
78 const sal_Char
* getPROPERTY_PRIVILEGES() { return "Privileges"; }
79 //============================================================
81 //============================================================
82 const sal_Char
* getERRORMSG_SEQUENCE() { return "Function sequence error"; }
83 const sal_Char
* getSQLSTATE_SEQUENCE() { return "HY010"; }
84 const sal_Char
* getSQLSTATE_GENERAL() { return "HY0000"; }
85 const sal_Char
* getSTR_DELIMITER() { return "/"; }
89 /* {{{ OPropertyMap::~OPropertyMap() -I- */
90 OPropertyMap::~OPropertyMap()
92 ::std::map
<sal_Int32
, rtl_uString
*>::iterator aIter
= m_aPropertyMap
.begin();
93 for(; aIter
!= m_aPropertyMap
.end(); ++aIter
) {
95 rtl_uString_release(aIter
->second
);
102 /* {{{ OPropertyMap::getNameByIndex() -I- */
103 OUString
OPropertyMap::getNameByIndex(sal_Int32 idx
) const
106 ::std::map
<sal_Int32
, rtl_uString
*>::const_iterator aIter
= m_aPropertyMap
.find(idx
);
107 if (aIter
== m_aPropertyMap
.end()) {
108 sRet
= const_cast<OPropertyMap
*>(this)->fillValue(idx
);
110 sRet
= aIter
->second
;
116 typedef const sal_Char
* (*property_callback
)();
118 static const property_callback property_callbacks
[PROPERTY_ID_LAST
] =
120 NULL
, /* PROPERTY_ID_FIRST */
121 getPROPERTY_QUERYTIMEOUT
,
122 getPROPERTY_MAXFIELDSIZE
,
124 getPROPERTY_CURSORNAME
,
125 getPROPERTY_RESULTSETCONCURRENCY
,
126 getPROPERTY_RESULTSETTYPE
,
127 getPROPERTY_FETCHDIRECTION
,
128 getPROPERTY_FETCHSIZE
,
129 getPROPERTY_ESCAPEPROCESSING
,
130 getPROPERTY_USEBOOKMARKS
,
134 getPROPERTY_TYPENAME
,
135 getPROPERTY_PRECISION
,
137 getPROPERTY_ISNULLABLE
,
138 getPROPERTY_ISAUTOINCREMENT
,
139 getPROPERTY_ISROWVERSION
,
140 getPROPERTY_DESCRIPTION
,
141 getPROPERTY_DEFAULTVALUE
,
143 getPROPERTY_REFERENCEDTABLE
,
144 getPROPERTY_UPDATERULE
,
145 getPROPERTY_DELETERULE
,
147 getPROPERTY_ISUNIQUE
,
148 getPROPERTY_ISPRIMARYKEYINDEX
,
149 getPROPERTY_ISCLUSTERED
,
150 getPROPERTY_ISASCENDING
,
151 getPROPERTY_SCHEMANAME
,
152 getPROPERTY_CATALOGNAME
,
155 getPROPERTY_CHECKOPTION
,
156 getPROPERTY_PASSWORD
,
157 getPROPERTY_RELATEDCOLUMN
,
159 getPROPERTY_FUNCTION
,
160 getPROPERTY_TABLENAME
,
161 getPROPERTY_REALNAME
,
162 getPROPERTY_DBASEPRECISIONCHANGED
,
163 getPROPERTY_ISCURRENCY
,
164 getPROPERTY_ISBOOKMARKABLE
,
165 getSTAT_INVALID_INDEX
,
166 getERRORMSG_SEQUENCE
,
167 getSQLSTATE_SEQUENCE
,
170 getPROPERTY_FORMATKEY
,
172 getPROPERTY_AUTOINCREMENTCREATION
,
173 getPROPERTY_PRIVILEGES
,
177 /* {{{ OPropertyMap::fillValue() -I- */
178 OUString
OPropertyMap::fillValue(sal_Int32 idx
)
180 rtl_uString
* pStr
= NULL
;
181 rtl_uString_newFromAscii(&pStr
, property_callbacks
[idx
]());
182 m_aPropertyMap
[idx
] = pStr
;
195 * vim600: noet sw=4 ts=4 fdm=marker
196 * vim<600: noet sw=4 ts=4
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */