summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-10-18 12:16:24 +0000
committerOcke Janssen <oj@openoffice.org>2001-10-18 12:16:24 +0000
commit9aea1b5034c903687a32aa6bdb9d830de69bc4e5 (patch)
treedcd64a877752f418735e2f18bfe787017a183093
parent673b37d8dd95710451e469e3d830729b4e2764cc (diff)
#93307# check sql name
-rw-r--r--connectivity/source/commontools/CommonTools.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx
index caa388e13afb..6af04681f063 100644
--- a/connectivity/source/commontools/CommonTools.cxx
+++ b/connectivity/source/commontools/CommonTools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CommonTools.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: oj $ $Date: 2001-05-23 09:15:42 $
+ * last change: $Author: oj $ $Date: 2001-10-18 13:16:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -308,11 +308,8 @@ sal_Bool isValidSQLName(const ::rtl::OUString& rName,const ::rtl::OUString& _rSp
sal_Bool isCharOk(char c,const ::rtl::OUString& _rSpecials)
{
- if ( ((c >= 97) && (c <= 122)) || ((c >= 65) && (c <= 90)) || ((c >= 48) && (c <= 57)) ||
- c == '_' || _rSpecials.indexOf(c) != -1)
- return sal_True;
- else
- return sal_False;
+ return ( ((c >= 97) && (c <= 122)) || ((c >= 65) && (c <= 90)) || ((c >= 48) && (c <= 57)) ||
+ c == '_' || _rSpecials.indexOf(c) != -1);
}
//------------------------------------------------------------------
// Erzeugt einen neuen Namen falls noetig
@@ -322,10 +319,14 @@ sal_Bool isCharOk(char c,const ::rtl::OUString& _rSpecials)
return rName;
::rtl::OUString aNewName(rName);
const sal_Unicode* pStr = rName.getStr();
+ sal_Int32 nLength = rName.getLength();
sal_Bool bValid(!isdigit(*pStr));
- for (; bValid && *pStr; pStr++ )
+ for (sal_Int32 i=0; bValid && i < nLength; ++pStr,++i )
if(!isCharOk(*pStr,_rSpecials))
- aNewName.replace(*pStr,'_');
+ {
+ aNewName = aNewName.replace(*pStr,'_');
+ pStr = aNewName.getStr() + i;
+ }
return aNewName;
}