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 _CONNECTIVITY_PROPERTYIDS_HXX_
23 #define _CONNECTIVITY_PROPERTYIDS_HXX_
24 
25 // this define has to be set to split the names into different dll's or so's
26 // every dll has his own set of property names
27 #ifndef _RTL_USTRING_
28 #include <rtl/ustring.hxx>
29 #endif
30 #ifndef _MAP_
31 #include <map>
32 #endif
33 
34 namespace connectivity
35 {
36 namespace mysqlc
37 {
38 	class OPropertyMap
39 	{
40 		::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap;
41 
42 		::rtl::OUString fillValue(sal_Int32 _nIndex);
43 	public:
OPropertyMap()44 		OPropertyMap()
45 		{
46 		}
47 		~OPropertyMap();
48 		::rtl::OUString getNameByIndex(sal_Int32 _nIndex) const;
49 
getPropMap()50 		static OPropertyMap& getPropMap()
51 		{
52 			static OPropertyMap s_aPropMap;
53 			return s_aPropMap;
54 		}
55 	};
56 
57 
58 	typedef const sal_Char* (*PVFN)();
59 
60 	struct UStringDescription
61 	{
62 		const sal_Char*	pZeroTerminatedName;
63 		sal_Int32 nLength;
64 
65 		UStringDescription(PVFN _fCharFkt);
operator ::rtl::OUStringconnectivity::mysqlc::UStringDescription66 		operator ::rtl::OUString() const { return ::rtl::OUString(pZeroTerminatedName,nLength,RTL_TEXTENCODING_ASCII_US); }
67 		~UStringDescription();
68 	private:
69 		UStringDescription();
70 	};
71 
72 
73 enum
74 {
75 	PROPERTY_ID_FIRST = 0,
76 	PROPERTY_ID_QUERYTIMEOUT,
77 	PROPERTY_ID_MAXFIELDSIZE,
78 	PROPERTY_ID_MAXROWS,
79 	PROPERTY_ID_CURSORNAME,
80 	PROPERTY_ID_RESULTSETCONCURRENCY,
81 	PROPERTY_ID_RESULTSETTYPE,
82 	PROPERTY_ID_FETCHDIRECTION,
83 	PROPERTY_ID_FETCHSIZE,
84 	PROPERTY_ID_ESCAPEPROCESSING,
85 	PROPERTY_ID_USEBOOKMARKS,
86 // Column
87 	PROPERTY_ID_NAME,
88 	PROPERTY_ID_TYPE,
89 	PROPERTY_ID_TYPENAME,
90 	PROPERTY_ID_PRECISION,
91 	PROPERTY_ID_SCALE,
92 	PROPERTY_ID_ISNULLABLE,
93 	PROPERTY_ID_ISAUTOINCREMENT,
94 	PROPERTY_ID_ISROWVERSION,
95 	PROPERTY_ID_DESCRIPTION,
96 	PROPERTY_ID_DEFAULTVALUE,
97 
98 	PROPERTY_ID_REFERENCEDTABLE,
99 	PROPERTY_ID_UPDATERULE,
100 	PROPERTY_ID_DELETERULE,
101 	PROPERTY_ID_CATALOG,
102 	PROPERTY_ID_ISUNIQUE,
103 	PROPERTY_ID_ISPRIMARYKEYINDEX,
104 	PROPERTY_ID_ISCLUSTERED,
105 	PROPERTY_ID_ISASCENDING,
106 	PROPERTY_ID_SCHEMANAME,
107 	PROPERTY_ID_CATALOGNAME,
108 
109 	PROPERTY_ID_COMMAND,
110 	PROPERTY_ID_CHECKOPTION,
111 	PROPERTY_ID_PASSWORD,
112 	PROPERTY_ID_RELATEDCOLUMN,
113 
114 	PROPERTY_ID_FUNCTION,
115 	PROPERTY_ID_TABLENAME,
116 	PROPERTY_ID_REALNAME,
117 	PROPERTY_ID_DBASEPRECISIONCHANGED,
118 	PROPERTY_ID_ISCURRENCY,
119 	PROPERTY_ID_ISBOOKMARKABLE,
120 
121 	PROPERTY_ID_INVALID_INDEX,
122 	PROPERTY_ID_ERRORMSG_SEQUENCE,
123 	PROPERTY_ID_HY010,
124 	PROPERTY_ID_HY0000,
125 	PROPERTY_ID_DELIMITER,
126 	PROPERTY_ID_FORMATKEY,
127 	PROPERTY_ID_LOCALE,
128 	PROPERTY_ID_IM001,
129 
130 	PROPERTY_ID_AUTOINCREMENTCREATION,
131 
132 	PROPERTY_ID_PRIVILEGES,
133 
134 	PROPERTY_ID_LAST
135 };
136 }/* mysqlc */
137 }/* connectivity */
138 
139 //------------------------------------------------------------------------------
140 #define DECL_PROP1IMPL(varname, type) \
141 pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type*>(NULL)),
142 //------------------------------------------------------------------------------
143 #define DECL_PROP0(varname, type)	\
144 	DECL_PROP1IMPL(varname, type) 0)
145 //------------------------------------------------------------------------------
146 #define DECL_BOOL_PROP1IMPL(varname) \
147         pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getBooleanCppuType(),
148 //------------------------------------------------------------------------------
149 #define DECL_BOOL_PROP0(varname)	\
150 	DECL_BOOL_PROP1IMPL(varname) 0)
151 
152 
153 
154 #endif // _CONNECTIVITY_PROPERTYIDS_HXX_
155 
156 
157