1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright 2008 by Sun Microsystems, Inc. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * $RCSfile: mysqlc_propertyids.cxx,v $ 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * $Revision: 1.1.2.2 $ 11*cdf0e10cSrcweir * 12*cdf0e10cSrcweir * This file is part of OpenOffice.org. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 15*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 16*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 17*cdf0e10cSrcweir * 18*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 19*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 20*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 22*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 23*cdf0e10cSrcweir * 24*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 25*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 26*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 27*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 28*cdf0e10cSrcweir ************************************************************************/ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #ifndef _OSL_DIAGNOSE_H_ 31*cdf0e10cSrcweir #include <osl/diagnose.h> 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #include "mysqlc_propertyids.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir using ::rtl::OUString; 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir namespace connectivity 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir namespace mysqlc 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir const sal_Char* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; } 42*cdf0e10cSrcweir const sal_Char* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; } 43*cdf0e10cSrcweir const sal_Char* getPROPERTY_MAXROWS() { return "MaxRows"; } 44*cdf0e10cSrcweir const sal_Char* getPROPERTY_CURSORNAME() { return "CursorName"; } 45*cdf0e10cSrcweir const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; } 46*cdf0e10cSrcweir const sal_Char* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; } 47*cdf0e10cSrcweir const sal_Char* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; } 48*cdf0e10cSrcweir const sal_Char* getPROPERTY_FETCHSIZE() { return "FetchSize"; } 49*cdf0e10cSrcweir const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; } 50*cdf0e10cSrcweir const sal_Char* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; } 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir const sal_Char* getPROPERTY_NAME() { return "Name"; } 53*cdf0e10cSrcweir const sal_Char* getPROPERTY_TYPE() { return "Type"; } 54*cdf0e10cSrcweir const sal_Char* getPROPERTY_TYPENAME() { return "TypeName"; } 55*cdf0e10cSrcweir const sal_Char* getPROPERTY_PRECISION() { return "Precision"; } 56*cdf0e10cSrcweir const sal_Char* getPROPERTY_SCALE() { return "Scale"; } 57*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISNULLABLE() { return "IsNullable"; } 58*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; } 59*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; } 60*cdf0e10cSrcweir const sal_Char* getPROPERTY_DESCRIPTION() { return "Description"; } 61*cdf0e10cSrcweir const sal_Char* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir const sal_Char* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; } 64*cdf0e10cSrcweir const sal_Char* getPROPERTY_UPDATERULE() { return "UpdateRule"; } 65*cdf0e10cSrcweir const sal_Char* getPROPERTY_DELETERULE() { return "DeleteRule"; } 66*cdf0e10cSrcweir const sal_Char* getPROPERTY_CATALOG() { return "Catalog"; } 67*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISUNIQUE() { return "IsUnique"; } 68*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; } 69*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISCLUSTERED() { return "IsClustered"; } 70*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISASCENDING() { return "IsAscending"; } 71*cdf0e10cSrcweir const sal_Char* getPROPERTY_SCHEMANAME() { return "SchemaName"; } 72*cdf0e10cSrcweir const sal_Char* getPROPERTY_CATALOGNAME() { return "CatalogName"; } 73*cdf0e10cSrcweir const sal_Char* getPROPERTY_COMMAND() { return "Command"; } 74*cdf0e10cSrcweir const sal_Char* getPROPERTY_CHECKOPTION() { return "CheckOption"; } 75*cdf0e10cSrcweir const sal_Char* getPROPERTY_PASSWORD() { return "Password"; } 76*cdf0e10cSrcweir const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; } 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir const sal_Char* getPROPERTY_FUNCTION() { return "Function"; } 81*cdf0e10cSrcweir const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; } 82*cdf0e10cSrcweir const sal_Char* getPROPERTY_REALNAME() { return "RealName"; } 83*cdf0e10cSrcweir const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; } 84*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISCURRENCY() { return "IsCurrency"; } 85*cdf0e10cSrcweir const sal_Char* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; } 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir const sal_Char* getPROPERTY_FORMATKEY() { return "FormatKey"; } 88*cdf0e10cSrcweir const sal_Char* getPROPERTY_LOCALE() { return "Locale"; } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir const sal_Char* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; } 91*cdf0e10cSrcweir const sal_Char* getPROPERTY_PRIVILEGES() { return "Privileges"; } 92*cdf0e10cSrcweir //============================================================ 93*cdf0e10cSrcweir //= error messages 94*cdf0e10cSrcweir //============================================================ 95*cdf0e10cSrcweir const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; } 96*cdf0e10cSrcweir const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; } 97*cdf0e10cSrcweir const sal_Char* getSQLSTATE_GENERAL() { return "HY0000"; } 98*cdf0e10cSrcweir const sal_Char* getSTR_DELIMITER() { return "/"; } 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /* {{{ OPropertyMap::~OPropertyMap() -I- */ 103*cdf0e10cSrcweir OPropertyMap::~OPropertyMap() 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir ::std::map<sal_Int32 , rtl_uString*>::iterator aIter = m_aPropertyMap.begin(); 106*cdf0e10cSrcweir for(; aIter != m_aPropertyMap.end(); ++aIter) { 107*cdf0e10cSrcweir if (aIter->second) { 108*cdf0e10cSrcweir rtl_uString_release(aIter->second); 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir /* }}} */ 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir /* {{{ OPropertyMap::getNameByIndex() -I- */ 116*cdf0e10cSrcweir OUString OPropertyMap::getNameByIndex(sal_Int32 idx) const 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir OUString sRet; 119*cdf0e10cSrcweir ::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(idx); 120*cdf0e10cSrcweir if (aIter == m_aPropertyMap.end()) { 121*cdf0e10cSrcweir sRet = const_cast<OPropertyMap*>(this)->fillValue(idx); 122*cdf0e10cSrcweir } else { 123*cdf0e10cSrcweir sRet = aIter->second; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir return sRet; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir /* }}} */ 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir typedef const sal_Char * (*property_callback)(); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir static const property_callback property_callbacks[PROPERTY_ID_LAST] = 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir NULL, /* PROPERTY_ID_FIRST */ 134*cdf0e10cSrcweir getPROPERTY_QUERYTIMEOUT, 135*cdf0e10cSrcweir getPROPERTY_MAXFIELDSIZE, 136*cdf0e10cSrcweir getPROPERTY_MAXROWS, 137*cdf0e10cSrcweir getPROPERTY_CURSORNAME, 138*cdf0e10cSrcweir getPROPERTY_RESULTSETCONCURRENCY, 139*cdf0e10cSrcweir getPROPERTY_RESULTSETTYPE, 140*cdf0e10cSrcweir getPROPERTY_FETCHDIRECTION, 141*cdf0e10cSrcweir getPROPERTY_FETCHSIZE, 142*cdf0e10cSrcweir getPROPERTY_ESCAPEPROCESSING, 143*cdf0e10cSrcweir getPROPERTY_USEBOOKMARKS, 144*cdf0e10cSrcweir // Column 145*cdf0e10cSrcweir getPROPERTY_NAME, 146*cdf0e10cSrcweir getPROPERTY_TYPE, 147*cdf0e10cSrcweir getPROPERTY_TYPENAME, 148*cdf0e10cSrcweir getPROPERTY_PRECISION, 149*cdf0e10cSrcweir getPROPERTY_SCALE, 150*cdf0e10cSrcweir getPROPERTY_ISNULLABLE, 151*cdf0e10cSrcweir getPROPERTY_ISAUTOINCREMENT, 152*cdf0e10cSrcweir getPROPERTY_ISROWVERSION, 153*cdf0e10cSrcweir getPROPERTY_DESCRIPTION, 154*cdf0e10cSrcweir getPROPERTY_DEFAULTVALUE, 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir getPROPERTY_REFERENCEDTABLE, 157*cdf0e10cSrcweir getPROPERTY_UPDATERULE, 158*cdf0e10cSrcweir getPROPERTY_DELETERULE, 159*cdf0e10cSrcweir getPROPERTY_CATALOG, 160*cdf0e10cSrcweir getPROPERTY_ISUNIQUE, 161*cdf0e10cSrcweir getPROPERTY_ISPRIMARYKEYINDEX, 162*cdf0e10cSrcweir getPROPERTY_ISCLUSTERED, 163*cdf0e10cSrcweir getPROPERTY_ISASCENDING, 164*cdf0e10cSrcweir getPROPERTY_SCHEMANAME, 165*cdf0e10cSrcweir getPROPERTY_CATALOGNAME, 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir getPROPERTY_COMMAND, 168*cdf0e10cSrcweir getPROPERTY_CHECKOPTION, 169*cdf0e10cSrcweir getPROPERTY_PASSWORD, 170*cdf0e10cSrcweir getPROPERTY_RELATEDCOLUMN, 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir getPROPERTY_FUNCTION, 173*cdf0e10cSrcweir getPROPERTY_TABLENAME, 174*cdf0e10cSrcweir getPROPERTY_REALNAME, 175*cdf0e10cSrcweir getPROPERTY_DBASEPRECISIONCHANGED, 176*cdf0e10cSrcweir getPROPERTY_ISCURRENCY, 177*cdf0e10cSrcweir getPROPERTY_ISBOOKMARKABLE, 178*cdf0e10cSrcweir getSTAT_INVALID_INDEX, 179*cdf0e10cSrcweir getERRORMSG_SEQUENCE, 180*cdf0e10cSrcweir getSQLSTATE_SEQUENCE, 181*cdf0e10cSrcweir getSQLSTATE_GENERAL, 182*cdf0e10cSrcweir getSTR_DELIMITER, 183*cdf0e10cSrcweir getPROPERTY_FORMATKEY, 184*cdf0e10cSrcweir getPROPERTY_LOCALE, 185*cdf0e10cSrcweir getPROPERTY_AUTOINCREMENTCREATION, 186*cdf0e10cSrcweir getPROPERTY_PRIVILEGES, 187*cdf0e10cSrcweir }; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir /* {{{ OPropertyMap::fillValue() -I- */ 191*cdf0e10cSrcweir OUString OPropertyMap::fillValue(sal_Int32 idx) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir rtl_uString* pStr = NULL; 194*cdf0e10cSrcweir rtl_uString_newFromAscii(&pStr, property_callbacks[idx]()); 195*cdf0e10cSrcweir m_aPropertyMap[idx] = pStr; 196*cdf0e10cSrcweir return pStr; 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir /* }}} */ 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir } /* mysqlc */ 201*cdf0e10cSrcweir } /* connectivity */ 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir /* 204*cdf0e10cSrcweir * Local variables: 205*cdf0e10cSrcweir * tab-width: 4 206*cdf0e10cSrcweir * c-basic-offset: 4 207*cdf0e10cSrcweir * End: 208*cdf0e10cSrcweir * vim600: noet sw=4 ts=4 fdm=marker 209*cdf0e10cSrcweir * vim<600: noet sw=4 ts=4 210*cdf0e10cSrcweir */ 211