1 /*************************************************************************
2  *
3  *  The Contents of this file are made available subject to the terms of
4  *  the BSD license.
5  *
6  *  Copyright 2000, 2010 Oracle and/or its affiliates.
7  *  All rights reserved.
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *  1. Redistributions of source code must retain the above copyright
13  *     notice, this list of conditions and the following disclaimer.
14  *  2. Redistributions in binary form must reproduce the above copyright
15  *     notice, this list of conditions and the following disclaimer in the
16  *     documentation and/or other materials provided with the distribution.
17  *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
18  *     contributors may be used to endorse or promote products derived
19  *     from this software without specific prior written permission.
20  *
21  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  *************************************************************************/
34 
35 #include <osl/diagnose.h>
36 #include "propertyids.hxx"
37 namespace connectivity
38 {
39 namespace skeleton
40 {
41 		const sal_Char* getPROPERTY_QUERYTIMEOUT()			{ return	"QueryTimeOut"; }
42 		const sal_Char* getPROPERTY_MAXFIELDSIZE()			{ return	"MaxFieldSize"; }
43 		const sal_Char* getPROPERTY_MAXROWS()				{ return	"MaxRows"; }
44 		const sal_Char* getPROPERTY_CURSORNAME()			{ return	"CursorName"; }
45 		const sal_Char* getPROPERTY_RESULTSETCONCURRENCY()	{ return	"ResultSetConcurrency"; }
46 		const sal_Char* getPROPERTY_RESULTSETTYPE()			{ return	"ResultSetType"; }
47 		const sal_Char* getPROPERTY_FETCHDIRECTION()		{ return	"FetchDirection"; }
48 		const sal_Char* getPROPERTY_FETCHSIZE()				{ return	"FetchSize"; }
49 		const sal_Char* getPROPERTY_ESCAPEPROCESSING()		{ return	"EscapeProcessing"; }
50 		const sal_Char* getPROPERTY_USEBOOKMARKS()			{ return	"UseBookmarks"; }
51 
52 		const sal_Char* getPROPERTY_NAME()					{ return	"Name"; }
53 		const sal_Char* getPROPERTY_TYPE()					{ return	"Type"; }
54 		const sal_Char* getPROPERTY_TYPENAME()				{ return 	"TypeName"; }
55 		const sal_Char* getPROPERTY_PRECISION()				{ return 	"Precision"; }
56 		const sal_Char* getPROPERTY_SCALE()					{ return 	"Scale"; }
57 		const sal_Char* getPROPERTY_ISNULLABLE()			{ return 	"IsNullable"; }
58 		const sal_Char* getPROPERTY_ISAUTOINCREMENT()		{ return 	"IsAutoIncrement"; }
59 		const sal_Char* getPROPERTY_ISROWVERSION()			{ return 	"IsRowVersion"; }
60 		const sal_Char* getPROPERTY_DESCRIPTION()			{ return 	"Description"; }
61 		const sal_Char* getPROPERTY_DEFAULTVALUE()			{ return 	"DefaultValue"; }
62 
63 		const sal_Char* getPROPERTY_REFERENCEDTABLE()		{ return 	"ReferencedTable"; }
64 		const sal_Char* getPROPERTY_UPDATERULE()			{ return 	"UpdateRule"; }
65 		const sal_Char* getPROPERTY_DELETERULE()			{ return 	"DeleteRule"; }
66 		const sal_Char* getPROPERTY_CATALOG()				{ return 	"Catalog"; }
67 		const sal_Char* getPROPERTY_ISUNIQUE()				{ return 	"IsUnique"; }
68 		const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX()		{ return 	"IsPrimaryKeyIndex"; }
69 		const sal_Char* getPROPERTY_ISCLUSTERED()			{ return 	"IsClustered"; }
70 		const sal_Char* getPROPERTY_ISASCENDING()			{ return 	"IsAscending"; }
71 		const sal_Char* getPROPERTY_SCHEMANAME()			{ return 	"SchemaName"; }
72 		const sal_Char* getPROPERTY_CATALOGNAME()			{ return 	"CatalogName"; }
73 		const sal_Char* getPROPERTY_COMMAND()				{ return 	"Command"; }
74 		const sal_Char* getPROPERTY_CHECKOPTION()			{ return 	"CheckOption"; }
75 		const sal_Char* getPROPERTY_PASSWORD()				{ return 	"Password"; }
76 		const sal_Char* getPROPERTY_RELATEDCOLUMN()			{ return 	"RelatedColumn"; }
77 
78 		const sal_Char* getSTAT_INVALID_INDEX()				{ return 	"Invalid descriptor index"; }
79 
80 		const sal_Char* getPROPERTY_FUNCTION()				{ return 	"Function"; }
81 		const sal_Char* getPROPERTY_TABLENAME()				{ return 	"TableName"; }
82 		const sal_Char* getPROPERTY_REALNAME()				{ return 	"RealName"; }
83 		const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return	"DbasePrecisionChanged"; }
84 		const sal_Char* getPROPERTY_ISCURRENCY()			{ return 	"IsCurrency"; }
85 		const sal_Char* getPROPERTY_ISBOOKMARKABLE()		{ return 	"IsBookmarkable"; }
86 
87 		const sal_Char* getPROPERTY_FORMATKEY()				{ return 	"FormatKey"; }
88 		const sal_Char* getPROPERTY_LOCALE()				{ return 	"Locale"; }
89 
90 		const sal_Char* getPROPERTY_AUTOINCREMENTCREATION()	{ return 	"AutoIncrementCreation"; }
91 		const sal_Char* getPROPERTY_PRIVILEGES()			{ return 	"Privileges"; }
92 	//============================================================
93 	//= error messages
94 	//============================================================
95 		const sal_Char* getERRORMSG_SEQUENCE()				{ return 	"Function sequence error"; }
96 		const sal_Char* getSQLSTATE_SEQUENCE()				{ return 	"HY010"; }
97 		const sal_Char* getSQLSTATE_GENERAL()				{ return 	"HY0000"; }
98 		const sal_Char* getSTR_DELIMITER()					{ return 	"/"; }
99 
100 		OPropertyMap::~OPropertyMap()
101 		{
102 			::std::map<sal_Int32 , rtl_uString*>::iterator aIter = m_aPropertyMap.begin();
103 			for(;aIter != m_aPropertyMap.end();++aIter)
104 				if(aIter->second)
105 					rtl_uString_release(aIter->second);
106 		}
107 		// ------------------------------------------------------------------------------
108 		::rtl::OUString OPropertyMap::getNameByIndex(sal_Int32 _nIndex) const
109 		{
110 			::rtl::OUString sRet;
111 			::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(_nIndex);
112 			if(aIter == m_aPropertyMap.end())
113 				sRet = const_cast<OPropertyMap*>(this)->fillValue(_nIndex);
114 			else
115 				sRet = aIter->second;
116 			return sRet;
117 		}
118 		// ------------------------------------------------------------------------------
119 		::rtl::OUString OPropertyMap::fillValue(sal_Int32 _nIndex)
120 		{
121 			rtl_uString* pStr = NULL;
122 			switch(_nIndex)
123 			{
124 				case PROPERTY_ID_QUERYTIMEOUT:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_QUERYTIMEOUT()			); break; }
125 				case PROPERTY_ID_MAXFIELDSIZE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXFIELDSIZE()			); break; }
126 				case PROPERTY_ID_MAXROWS:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXROWS()				); break;		}
127 				case PROPERTY_ID_CURSORNAME:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CURSORNAME()			); break;	}
128 				case PROPERTY_ID_RESULTSETCONCURRENCY:		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETCONCURRENCY()	); break; }
129 				case PROPERTY_ID_RESULTSETTYPE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETTYPE()			); break; }
130 				case PROPERTY_ID_FETCHDIRECTION:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHDIRECTION()		); break; }
131 				case PROPERTY_ID_FETCHSIZE:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHSIZE()				); break;	}
132 				case PROPERTY_ID_ESCAPEPROCESSING:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ESCAPEPROCESSING()		); break; }
133 				case PROPERTY_ID_USEBOOKMARKS:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_USEBOOKMARKS()			); break; }
134 				// Column
135 				case PROPERTY_ID_NAME:						{ rtl_uString_newFromAscii(&pStr,getPROPERTY_NAME()				); break; }
136 				case PROPERTY_ID_TYPE:						{ rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPE()				); break; }
137 				case PROPERTY_ID_TYPENAME:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPENAME()			); break; }
138 				case PROPERTY_ID_PRECISION:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_PRECISION()			); break; }
139 				case PROPERTY_ID_SCALE:						{ rtl_uString_newFromAscii(&pStr,getPROPERTY_SCALE()				); break; }
140 				case PROPERTY_ID_ISNULLABLE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISNULLABLE()		); break; }
141 				case PROPERTY_ID_ISAUTOINCREMENT:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISAUTOINCREMENT()	); break; }
142 				case PROPERTY_ID_ISROWVERSION:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISROWVERSION()		); break; }
143 				case PROPERTY_ID_DESCRIPTION:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DESCRIPTION()		); break; }
144 				case PROPERTY_ID_DEFAULTVALUE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DEFAULTVALUE()		); break; }
145 
146 				case PROPERTY_ID_REFERENCEDTABLE:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_REFERENCEDTABLE()	); break; }
147 				case PROPERTY_ID_UPDATERULE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_UPDATERULE()		); break; }
148 				case PROPERTY_ID_DELETERULE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DELETERULE()		); break; }
149 				case PROPERTY_ID_CATALOG:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOG()			); break; }
150 				case PROPERTY_ID_ISUNIQUE:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISUNIQUE()			); break; }
151 				case PROPERTY_ID_ISPRIMARYKEYINDEX:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISPRIMARYKEYINDEX()	); break; }
152 				case PROPERTY_ID_ISCLUSTERED:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCLUSTERED()			); break; }
153 				case PROPERTY_ID_ISASCENDING:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISASCENDING()			); break; }
154 				case PROPERTY_ID_SCHEMANAME:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_SCHEMANAME()			); break; }
155 				case PROPERTY_ID_CATALOGNAME:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOGNAME()			); break; }
156 
157 				case PROPERTY_ID_COMMAND:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_COMMAND()				); break; }
158 				case PROPERTY_ID_CHECKOPTION:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_CHECKOPTION()			); break; }
159 				case PROPERTY_ID_PASSWORD:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_PASSWORD()				); break; }
160 				case PROPERTY_ID_RELATEDCOLUMN:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_RELATEDCOLUMN()		); break;  }
161 
162 				case PROPERTY_ID_FUNCTION:           		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FUNCTION()				); break; }
163 				case PROPERTY_ID_TABLENAME:          		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_TABLENAME()				); break; }
164 				case PROPERTY_ID_REALNAME:           		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_REALNAME()				); break; }
165 				case PROPERTY_ID_DBASEPRECISIONCHANGED:		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED() ); break; }
166 				case PROPERTY_ID_ISCURRENCY:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY()			); break; }
167 				case PROPERTY_ID_ISBOOKMARKABLE:			{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE()		); break; }
168 				case PROPERTY_ID_INVALID_INDEX:				{ rtl_uString_newFromAscii(&pStr,getSTAT_INVALID_INDEX()			); break; }
169 				case PROPERTY_ID_ERRORMSG_SEQUENCE:			{ rtl_uString_newFromAscii(&pStr,getERRORMSG_SEQUENCE()				); break; }
170 				case PROPERTY_ID_HY010:						{ rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE()				); break; }
171 				case PROPERTY_ID_HY0000:					{ rtl_uString_newFromAscii(&pStr,getSQLSTATE_GENERAL()				); break; }
172 				case PROPERTY_ID_DELIMITER:					{ rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER()					); break; }
173 				case PROPERTY_ID_FORMATKEY:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY()			); break; }
174 				case PROPERTY_ID_LOCALE:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_LOCALE()				); break; }
175 				case PROPERTY_ID_AUTOINCREMENTCREATION:		{ rtl_uString_newFromAscii(&pStr,getPROPERTY_AUTOINCREMENTCREATION()		); break; }
176 				case PROPERTY_ID_PRIVILEGES:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_PRIVILEGES()			); break; }
177 			}
178 			m_aPropertyMap[_nIndex] = pStr;
179 			return pStr;
180 		}
181 	}
182 }
183