1*34dd1e25SAndrew Rist /**************************************************************
2*34dd1e25SAndrew Rist  *
3*34dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist  * distributed with this work for additional information
6*34dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*34dd1e25SAndrew Rist  *
11*34dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*34dd1e25SAndrew Rist  *
13*34dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist  * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist  * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist  * under the License.
19*34dd1e25SAndrew Rist  *
20*34dd1e25SAndrew Rist  *************************************************************/
21*34dd1e25SAndrew Rist 
22*34dd1e25SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <osl/diagnose.h>
25cdf0e10cSrcweir #include "propertyids.hxx"
26cdf0e10cSrcweir namespace connectivity
27cdf0e10cSrcweir {
28cdf0e10cSrcweir namespace skeleton
29cdf0e10cSrcweir {
getPROPERTY_QUERYTIMEOUT()30cdf0e10cSrcweir 		const sal_Char* getPROPERTY_QUERYTIMEOUT()			{ return	"QueryTimeOut"; }
getPROPERTY_MAXFIELDSIZE()31cdf0e10cSrcweir 		const sal_Char* getPROPERTY_MAXFIELDSIZE()			{ return	"MaxFieldSize"; }
getPROPERTY_MAXROWS()32cdf0e10cSrcweir 		const sal_Char* getPROPERTY_MAXROWS()				{ return	"MaxRows"; }
getPROPERTY_CURSORNAME()33cdf0e10cSrcweir 		const sal_Char* getPROPERTY_CURSORNAME()			{ return	"CursorName"; }
getPROPERTY_RESULTSETCONCURRENCY()34cdf0e10cSrcweir 		const sal_Char* getPROPERTY_RESULTSETCONCURRENCY()	{ return	"ResultSetConcurrency"; }
getPROPERTY_RESULTSETTYPE()35cdf0e10cSrcweir 		const sal_Char* getPROPERTY_RESULTSETTYPE()			{ return	"ResultSetType"; }
getPROPERTY_FETCHDIRECTION()36cdf0e10cSrcweir 		const sal_Char* getPROPERTY_FETCHDIRECTION()		{ return	"FetchDirection"; }
getPROPERTY_FETCHSIZE()37cdf0e10cSrcweir 		const sal_Char* getPROPERTY_FETCHSIZE()				{ return	"FetchSize"; }
getPROPERTY_ESCAPEPROCESSING()38cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ESCAPEPROCESSING()		{ return	"EscapeProcessing"; }
getPROPERTY_USEBOOKMARKS()39cdf0e10cSrcweir 		const sal_Char* getPROPERTY_USEBOOKMARKS()			{ return	"UseBookmarks"; }
40cdf0e10cSrcweir 
getPROPERTY_NAME()41cdf0e10cSrcweir 		const sal_Char* getPROPERTY_NAME()					{ return	"Name"; }
getPROPERTY_TYPE()42cdf0e10cSrcweir 		const sal_Char* getPROPERTY_TYPE()					{ return	"Type"; }
getPROPERTY_TYPENAME()43cdf0e10cSrcweir 		const sal_Char* getPROPERTY_TYPENAME()				{ return 	"TypeName"; }
getPROPERTY_PRECISION()44cdf0e10cSrcweir 		const sal_Char* getPROPERTY_PRECISION()				{ return 	"Precision"; }
getPROPERTY_SCALE()45cdf0e10cSrcweir 		const sal_Char* getPROPERTY_SCALE()					{ return 	"Scale"; }
getPROPERTY_ISNULLABLE()46cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISNULLABLE()			{ return 	"IsNullable"; }
getPROPERTY_ISAUTOINCREMENT()47cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISAUTOINCREMENT()		{ return 	"IsAutoIncrement"; }
getPROPERTY_ISROWVERSION()48cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISROWVERSION()			{ return 	"IsRowVersion"; }
getPROPERTY_DESCRIPTION()49cdf0e10cSrcweir 		const sal_Char* getPROPERTY_DESCRIPTION()			{ return 	"Description"; }
getPROPERTY_DEFAULTVALUE()50cdf0e10cSrcweir 		const sal_Char* getPROPERTY_DEFAULTVALUE()			{ return 	"DefaultValue"; }
51cdf0e10cSrcweir 
getPROPERTY_REFERENCEDTABLE()52cdf0e10cSrcweir 		const sal_Char* getPROPERTY_REFERENCEDTABLE()		{ return 	"ReferencedTable"; }
getPROPERTY_UPDATERULE()53cdf0e10cSrcweir 		const sal_Char* getPROPERTY_UPDATERULE()			{ return 	"UpdateRule"; }
getPROPERTY_DELETERULE()54cdf0e10cSrcweir 		const sal_Char* getPROPERTY_DELETERULE()			{ return 	"DeleteRule"; }
getPROPERTY_CATALOG()55cdf0e10cSrcweir 		const sal_Char* getPROPERTY_CATALOG()				{ return 	"Catalog"; }
getPROPERTY_ISUNIQUE()56cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISUNIQUE()				{ return 	"IsUnique"; }
getPROPERTY_ISPRIMARYKEYINDEX()57cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX()		{ return 	"IsPrimaryKeyIndex"; }
getPROPERTY_ISCLUSTERED()58cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISCLUSTERED()			{ return 	"IsClustered"; }
getPROPERTY_ISASCENDING()59cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISASCENDING()			{ return 	"IsAscending"; }
getPROPERTY_SCHEMANAME()60cdf0e10cSrcweir 		const sal_Char* getPROPERTY_SCHEMANAME()			{ return 	"SchemaName"; }
getPROPERTY_CATALOGNAME()61cdf0e10cSrcweir 		const sal_Char* getPROPERTY_CATALOGNAME()			{ return 	"CatalogName"; }
getPROPERTY_COMMAND()62cdf0e10cSrcweir 		const sal_Char* getPROPERTY_COMMAND()				{ return 	"Command"; }
getPROPERTY_CHECKOPTION()63cdf0e10cSrcweir 		const sal_Char* getPROPERTY_CHECKOPTION()			{ return 	"CheckOption"; }
getPROPERTY_PASSWORD()64cdf0e10cSrcweir 		const sal_Char* getPROPERTY_PASSWORD()				{ return 	"Password"; }
getPROPERTY_RELATEDCOLUMN()65cdf0e10cSrcweir 		const sal_Char* getPROPERTY_RELATEDCOLUMN()			{ return 	"RelatedColumn"; }
66cdf0e10cSrcweir 
getSTAT_INVALID_INDEX()67cdf0e10cSrcweir 		const sal_Char* getSTAT_INVALID_INDEX()				{ return 	"Invalid descriptor index"; }
68cdf0e10cSrcweir 
getPROPERTY_FUNCTION()69cdf0e10cSrcweir 		const sal_Char* getPROPERTY_FUNCTION()				{ return 	"Function"; }
getPROPERTY_TABLENAME()70cdf0e10cSrcweir 		const sal_Char* getPROPERTY_TABLENAME()				{ return 	"TableName"; }
getPROPERTY_REALNAME()71cdf0e10cSrcweir 		const sal_Char* getPROPERTY_REALNAME()				{ return 	"RealName"; }
getPROPERTY_DBASEPRECISIONCHANGED()72cdf0e10cSrcweir 		const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return	"DbasePrecisionChanged"; }
getPROPERTY_ISCURRENCY()73cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISCURRENCY()			{ return 	"IsCurrency"; }
getPROPERTY_ISBOOKMARKABLE()74cdf0e10cSrcweir 		const sal_Char* getPROPERTY_ISBOOKMARKABLE()		{ return 	"IsBookmarkable"; }
75cdf0e10cSrcweir 
getPROPERTY_FORMATKEY()76cdf0e10cSrcweir 		const sal_Char* getPROPERTY_FORMATKEY()				{ return 	"FormatKey"; }
getPROPERTY_LOCALE()77cdf0e10cSrcweir 		const sal_Char* getPROPERTY_LOCALE()				{ return 	"Locale"; }
78cdf0e10cSrcweir 
getPROPERTY_AUTOINCREMENTCREATION()79cdf0e10cSrcweir 		const sal_Char* getPROPERTY_AUTOINCREMENTCREATION()	{ return 	"AutoIncrementCreation"; }
getPROPERTY_PRIVILEGES()80cdf0e10cSrcweir 		const sal_Char* getPROPERTY_PRIVILEGES()			{ return 	"Privileges"; }
81cdf0e10cSrcweir 	//============================================================
82cdf0e10cSrcweir 	//= error messages
83cdf0e10cSrcweir 	//============================================================
getERRORMSG_SEQUENCE()84cdf0e10cSrcweir 		const sal_Char* getERRORMSG_SEQUENCE()				{ return 	"Function sequence error"; }
getSQLSTATE_SEQUENCE()85cdf0e10cSrcweir 		const sal_Char* getSQLSTATE_SEQUENCE()				{ return 	"HY010"; }
getSQLSTATE_GENERAL()86cdf0e10cSrcweir 		const sal_Char* getSQLSTATE_GENERAL()				{ return 	"HY0000"; }
getSTR_DELIMITER()87cdf0e10cSrcweir 		const sal_Char* getSTR_DELIMITER()					{ return 	"/"; }
88cdf0e10cSrcweir 
~OPropertyMap()89cdf0e10cSrcweir 		OPropertyMap::~OPropertyMap()
90cdf0e10cSrcweir 		{
91cdf0e10cSrcweir 			::std::map<sal_Int32 , rtl_uString*>::iterator aIter = m_aPropertyMap.begin();
92cdf0e10cSrcweir 			for(;aIter != m_aPropertyMap.end();++aIter)
93cdf0e10cSrcweir 				if(aIter->second)
94cdf0e10cSrcweir 					rtl_uString_release(aIter->second);
95cdf0e10cSrcweir 		}
96cdf0e10cSrcweir 		// ------------------------------------------------------------------------------
getNameByIndex(sal_Int32 _nIndex) const97cdf0e10cSrcweir 		::rtl::OUString OPropertyMap::getNameByIndex(sal_Int32 _nIndex) const
98cdf0e10cSrcweir 		{
99cdf0e10cSrcweir 			::rtl::OUString sRet;
100cdf0e10cSrcweir 			::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(_nIndex);
101cdf0e10cSrcweir 			if(aIter == m_aPropertyMap.end())
102cdf0e10cSrcweir 				sRet = const_cast<OPropertyMap*>(this)->fillValue(_nIndex);
103cdf0e10cSrcweir 			else
104cdf0e10cSrcweir 				sRet = aIter->second;
105cdf0e10cSrcweir 			return sRet;
106cdf0e10cSrcweir 		}
107cdf0e10cSrcweir 		// ------------------------------------------------------------------------------
fillValue(sal_Int32 _nIndex)108cdf0e10cSrcweir 		::rtl::OUString OPropertyMap::fillValue(sal_Int32 _nIndex)
109cdf0e10cSrcweir 		{
110cdf0e10cSrcweir 			rtl_uString* pStr = NULL;
111cdf0e10cSrcweir 			switch(_nIndex)
112cdf0e10cSrcweir 			{
113cdf0e10cSrcweir 				case PROPERTY_ID_QUERYTIMEOUT:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_QUERYTIMEOUT()			); break; }
114cdf0e10cSrcweir 				case PROPERTY_ID_MAXFIELDSIZE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXFIELDSIZE()			); break; }
115cdf0e10cSrcweir 				case PROPERTY_ID_MAXROWS:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXROWS()				); break;		}
116cdf0e10cSrcweir 				case PROPERTY_ID_CURSORNAME:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CURSORNAME()			); break;	}
117cdf0e10cSrcweir 				case PROPERTY_ID_RESULTSETCONCURRENCY:		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETCONCURRENCY()	); break; }
118cdf0e10cSrcweir 				case PROPERTY_ID_RESULTSETTYPE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETTYPE()			); break; }
119cdf0e10cSrcweir 				case PROPERTY_ID_FETCHDIRECTION:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHDIRECTION()		); break; }
120cdf0e10cSrcweir 				case PROPERTY_ID_FETCHSIZE:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHSIZE()				); break;	}
121cdf0e10cSrcweir 				case PROPERTY_ID_ESCAPEPROCESSING:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ESCAPEPROCESSING()		); break; }
122cdf0e10cSrcweir 				case PROPERTY_ID_USEBOOKMARKS:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_USEBOOKMARKS()			); break; }
123cdf0e10cSrcweir 				// Column
124cdf0e10cSrcweir 				case PROPERTY_ID_NAME:						{ rtl_uString_newFromAscii(&pStr,getPROPERTY_NAME()				); break; }
125cdf0e10cSrcweir 				case PROPERTY_ID_TYPE:						{ rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPE()				); break; }
126cdf0e10cSrcweir 				case PROPERTY_ID_TYPENAME:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPENAME()			); break; }
127cdf0e10cSrcweir 				case PROPERTY_ID_PRECISION:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_PRECISION()			); break; }
128cdf0e10cSrcweir 				case PROPERTY_ID_SCALE:						{ rtl_uString_newFromAscii(&pStr,getPROPERTY_SCALE()				); break; }
129cdf0e10cSrcweir 				case PROPERTY_ID_ISNULLABLE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISNULLABLE()		); break; }
130cdf0e10cSrcweir 				case PROPERTY_ID_ISAUTOINCREMENT:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISAUTOINCREMENT()	); break; }
131cdf0e10cSrcweir 				case PROPERTY_ID_ISROWVERSION:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISROWVERSION()		); break; }
132cdf0e10cSrcweir 				case PROPERTY_ID_DESCRIPTION:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DESCRIPTION()		); break; }
133cdf0e10cSrcweir 				case PROPERTY_ID_DEFAULTVALUE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DEFAULTVALUE()		); break; }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 				case PROPERTY_ID_REFERENCEDTABLE:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_REFERENCEDTABLE()	); break; }
136cdf0e10cSrcweir 				case PROPERTY_ID_UPDATERULE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_UPDATERULE()		); break; }
137cdf0e10cSrcweir 				case PROPERTY_ID_DELETERULE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DELETERULE()		); break; }
138cdf0e10cSrcweir 				case PROPERTY_ID_CATALOG:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOG()			); break; }
139cdf0e10cSrcweir 				case PROPERTY_ID_ISUNIQUE:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISUNIQUE()			); break; }
140cdf0e10cSrcweir 				case PROPERTY_ID_ISPRIMARYKEYINDEX:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISPRIMARYKEYINDEX()	); break; }
141cdf0e10cSrcweir 				case PROPERTY_ID_ISCLUSTERED:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCLUSTERED()			); break; }
142cdf0e10cSrcweir 				case PROPERTY_ID_ISASCENDING:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISASCENDING()			); break; }
143cdf0e10cSrcweir 				case PROPERTY_ID_SCHEMANAME:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_SCHEMANAME()			); break; }
144cdf0e10cSrcweir 				case PROPERTY_ID_CATALOGNAME:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOGNAME()			); break; }
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 				case PROPERTY_ID_COMMAND:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_COMMAND()				); break; }
147cdf0e10cSrcweir 				case PROPERTY_ID_CHECKOPTION:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CHECKOPTION()			); break; }
148cdf0e10cSrcweir 				case PROPERTY_ID_PASSWORD:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_PASSWORD()				); break; }
149cdf0e10cSrcweir 				case PROPERTY_ID_RELATEDCOLUMN:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_RELATEDCOLUMN()		); break;  }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 				case PROPERTY_ID_FUNCTION:           		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FUNCTION()				); break; }
152cdf0e10cSrcweir 				case PROPERTY_ID_TABLENAME:          		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_TABLENAME()				); break; }
153cdf0e10cSrcweir 				case PROPERTY_ID_REALNAME:           		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_REALNAME()				); break; }
154cdf0e10cSrcweir 				case PROPERTY_ID_DBASEPRECISIONCHANGED:		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED() ); break; }
155cdf0e10cSrcweir 				case PROPERTY_ID_ISCURRENCY:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY()			); break; }
156cdf0e10cSrcweir 				case PROPERTY_ID_ISBOOKMARKABLE:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE()		); break; }
157cdf0e10cSrcweir 				case PROPERTY_ID_INVALID_INDEX:				{ rtl_uString_newFromAscii(&pStr,getSTAT_INVALID_INDEX()			); break; }
158cdf0e10cSrcweir 				case PROPERTY_ID_ERRORMSG_SEQUENCE:			{ rtl_uString_newFromAscii(&pStr,getERRORMSG_SEQUENCE()				); break; }
159cdf0e10cSrcweir 				case PROPERTY_ID_HY010:						{ rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE()				); break; }
160cdf0e10cSrcweir 				case PROPERTY_ID_HY0000:					{ rtl_uString_newFromAscii(&pStr,getSQLSTATE_GENERAL()				); break; }
161cdf0e10cSrcweir 				case PROPERTY_ID_DELIMITER:					{ rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER()					); break; }
162cdf0e10cSrcweir 				case PROPERTY_ID_FORMATKEY:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY()			); break; }
163cdf0e10cSrcweir 				case PROPERTY_ID_LOCALE:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_LOCALE()				); break; }
164cdf0e10cSrcweir 				case PROPERTY_ID_AUTOINCREMENTCREATION:		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_AUTOINCREMENTCREATION()		); break; }
165cdf0e10cSrcweir 				case PROPERTY_ID_PRIVILEGES:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_PRIVILEGES()			); break; }
166cdf0e10cSrcweir 			}
167cdf0e10cSrcweir 			m_aPropertyMap[_nIndex] = pStr;
168cdf0e10cSrcweir 			return pStr;
169cdf0e10cSrcweir 		}
170cdf0e10cSrcweir 	}
171cdf0e10cSrcweir }
172