Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ad4cb6f7
Kaydet (Commit)
ad4cb6f7
authored
Eki 31, 2002
tarafından
Ocke Janssen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#104613# change OFlatString: now derived from String
üst
0dfc1098
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
60 deletions
+52
-60
ENoException.cxx
connectivity/source/drivers/flat/ENoException.cxx
+11
-11
ETable.cxx
connectivity/source/drivers/flat/ETable.cxx
+26
-34
EConnection.hxx
connectivity/source/inc/flat/EConnection.hxx
+10
-10
ETable.hxx
connectivity/source/inc/flat/ETable.hxx
+5
-5
No files found.
connectivity/source/drivers/flat/ENoException.cxx
Dosyayı görüntüle @
ad4cb6f7
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ENoException.cxx,v $
*
* $Revision: 1.
4
$
* $Revision: 1.
5
$
*
* last change: $Author: oj $ $Date: 2002-10-
08 08:25:2
9 $
* last change: $Author: oj $ $Date: 2002-10-
31 14:14:1
9 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -69,7 +69,7 @@ using namespace connectivity;
using
namespace
connectivity
::
flat
;
//------------------------------------------------------------------
xub_StrLen
OFlatString
::
GetTokenCount
(
sal_
uInt8
cTok
,
sal_uInt8
cStrDel
)
const
xub_StrLen
OFlatString
::
GetTokenCount
(
sal_
Unicode
cTok
,
sal_Unicode
cStrDel
)
const
{
if
(
!
Len
()
)
return
0
;
...
...
@@ -121,7 +121,7 @@ xub_StrLen OFlatString::GetTokenCount( sal_uInt8 cTok, sal_uInt8 cStrDel ) const
}
//------------------------------------------------------------------
void
OFlatString
::
GetTokenSpecial
(
ByteString
&
_rStr
,
xub_StrLen
&
nStartPos
,
sal_uInt8
cTok
,
sal_uInt8
cStrDel
)
const
void
OFlatString
::
GetTokenSpecial
(
String
&
_rStr
,
xub_StrLen
&
nStartPos
,
sal_Unicode
cTok
,
sal_Unicode
cStrDel
)
const
{
_rStr
.
Erase
();
xub_StrLen
nLen
=
Len
();
...
...
@@ -189,7 +189,7 @@ sal_Bool OFlatTable::checkHeaderLine()
BOOL
bRead2
;
do
{
bRead2
=
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
bRead2
=
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
m_pConnection
->
getTextEncoding
()
);
}
while
(
bRead2
&&
!
m_aCurrentLine
.
Len
());
...
...
@@ -229,7 +229,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_aRowToFilePos
.
insert
(
::
std
::
map
<
sal_Int32
,
sal_Int32
>::
value_type
(
m_nRowPos
,
m_nFilePos
));
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
pConnection
->
getTextEncoding
()
);
if
(
m_pFileStream
->
IsEof
())
{
m_nMaxRowCount
=
m_nRowPos
;
...
...
@@ -245,7 +245,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_pFileStream
->
Seek
(
m_nFilePos
);
if
(
m_pFileStream
->
IsEof
()
||
!
checkHeaderLine
())
return
sal_False
;
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
pConnection
->
getTextEncoding
()
);
if
(
m_pFileStream
->
IsEof
())
return
sal_False
;
nCurPos
=
m_pFileStream
->
Tell
();
...
...
@@ -264,7 +264,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_pFileStream
->
Seek
(
m_nFilePos
);
if
(
m_pFileStream
->
IsEof
()
||
!
checkHeaderLine
())
return
sal_False
;
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
pConnection
->
getTextEncoding
()
);
if
(
m_pFileStream
->
IsEof
())
return
sal_False
;
nCurPos
=
m_pFileStream
->
Tell
();
...
...
@@ -299,7 +299,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_pFileStream
->
Seek
(
m_nFilePos
);
if
(
m_pFileStream
->
IsEof
()
||
!
checkHeaderLine
())
return
sal_False
;
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
pConnection
->
getTextEncoding
()
);
if
(
m_pFileStream
->
IsEof
())
return
sal_False
;
nCurPos
=
m_pFileStream
->
Tell
();
...
...
@@ -327,7 +327,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_pFileStream
->
Seek
(
m_nFilePos
);
if
(
m_pFileStream
->
IsEof
()
||
!
checkHeaderLine
())
return
sal_False
;
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
pConnection
->
getTextEncoding
()
);
if
(
m_pFileStream
->
IsEof
())
return
sal_False
;
nCurPos
=
m_pFileStream
->
Tell
();
...
...
@@ -342,7 +342,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
return
sal_False
;
m_nFilePos
=
m_pFileStream
->
Tell
();
// Byte-Position in der Datei merken (am ZeilenANFANG)
m_pFileStream
->
Read
Line
(
m_aCurrentLine
);
m_pFileStream
->
Read
ByteStringLine
(
m_aCurrentLine
,
pConnection
->
getTextEncoding
()
);
if
(
m_pFileStream
->
IsEof
())
return
sal_False
;
nCurPos
=
m_pFileStream
->
Tell
();
...
...
connectivity/source/drivers/flat/ETable.cxx
Dosyayı görüntüle @
ad4cb6f7
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ETable.cxx,v $
*
* $Revision: 1.
39
$
* $Revision: 1.
40
$
*
* last change: $Author: oj $ $Date: 2002-10-
15 09:40:43
$
* last change: $Author: oj $ $Date: 2002-10-
31 14:14:20
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -147,8 +147,6 @@ using namespace ::com::sun::star::sdbc;
using
namespace
::
com
::
sun
::
star
::
container
;
using
namespace
::
com
::
sun
::
star
::
lang
;
double
toDouble
(
const
ByteString
&
rString
,
rtl_TextEncoding
_nrTextEncoding
);
// -------------------------------------------------------------------------
void
OFlatTable
::
fillColumns
()
{
...
...
@@ -160,20 +158,20 @@ void OFlatTable::fillColumns()
{
while
(
bRead
&&
!
aHeaderLine
.
Len
())
{
bRead
=
m_pFileStream
->
Read
Line
(
aHeaderLine
);
bRead
=
m_pFileStream
->
Read
ByteStringLine
(
aHeaderLine
,
pConnection
->
getTextEncoding
()
);
}
}
// read first row
OFlatString
aFirstLine
;
bRead
=
m_pFileStream
->
Read
Line
(
aFirstLine
);
bRead
=
m_pFileStream
->
Read
ByteStringLine
(
aFirstLine
,
pConnection
->
getTextEncoding
()
);
if
(
!
pConnection
->
isHeaderLine
()
||
!
aHeaderLine
.
Len
())
{
while
(
bRead
&&
!
aFirstLine
.
Len
())
{
bRead
=
m_pFileStream
->
Read
Line
(
aFirstLine
);
bRead
=
m_pFileStream
->
Read
ByteStringLine
(
aFirstLine
,
pConnection
->
getTextEncoding
()
);
}
// use first row as headerline because we need the number of columns
aHeaderLine
=
aFirstLine
;
...
...
@@ -197,9 +195,9 @@ void OFlatTable::fillColumns()
sal_Bool
bCase
=
getConnection
()
->
getMetaData
()
->
storesMixedCaseQuotedIdentifiers
();
// read description
char
cDecimalDelimiter
=
pConnection
->
getDecimalDelimiter
();
char
cThousandDelimiter
=
pConnection
->
getThousandDelimiter
();
Byte
String
aColumnName
;
sal_Unicode
cDecimalDelimiter
=
pConnection
->
getDecimalDelimiter
();
sal_Unicode
cThousandDelimiter
=
pConnection
->
getThousandDelimiter
();
String
aColumnName
;
::
rtl
::
OUString
aTypeName
;
::
comphelper
::
UStringMixEqual
aCase
(
bCase
);
xub_StrLen
nStartPosHeaderLine
=
0
;
// use for eficient way to get the tokens
...
...
@@ -210,13 +208,12 @@ void OFlatTable::fillColumns()
if
(
pConnection
->
isHeaderLine
())
{
aHeaderLine
.
GetTokenSpecial
(
aColumnName
,
nStartPosHeaderLine
,
pConnection
->
getFieldDelimiter
(),
pConnection
->
getStringDelimiter
());
aColumnName
.
Convert
(
pConnection
->
getTextEncoding
(),
pConnection
->
getTextEncoding
());
}
else
{
// no column name so ...
aColumnName
=
'C'
;
aColumnName
+=
Byte
String
::
CreateFromInt32
(
i
+
1
);
aColumnName
+=
String
::
CreateFromInt32
(
i
+
1
);
}
sal_Int32
eType
;
UINT16
nPrecision
=
0
;
...
...
@@ -227,7 +224,7 @@ void OFlatTable::fillColumns()
ULONG
nIndex
=
0
;
// first without fielddelimiter
Byte
String
aField
;
String
aField
;
aFirstLine
.
GetTokenSpecial
(
aField
,
nStartPosFirstLine
,
pConnection
->
getFieldDelimiter
(),
'\0'
);
if
(
aField
.
Len
()
==
0
||
(
pConnection
->
getStringDelimiter
()
&&
pConnection
->
getStringDelimiter
()
==
aField
.
GetChar
(
0
)))
...
...
@@ -236,8 +233,8 @@ void OFlatTable::fillColumns()
}
else
{
Byte
String
aField2
;
if
(
pConnection
->
getStringDelimiter
()
!=
'\0'
)
String
aField2
;
if
(
pConnection
->
getStringDelimiter
()
!=
'\0'
)
aFirstLine
.
GetTokenSpecial
(
aField2
,
nStartPosFirstLine2
,
pConnection
->
getFieldDelimiter
(),
pConnection
->
getStringDelimiter
());
else
aField2
=
aField
;
...
...
@@ -252,7 +249,7 @@ void OFlatTable::fillColumns()
xub_StrLen
nDot
=
0
;
for
(
xub_StrLen
j
=
0
;
j
<
aField2
.
Len
();
j
++
)
{
char
c
=
aField2
.
GetChar
(
j
);
sal_Unicode
c
=
aField2
.
GetChar
(
j
);
// nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
if
((
!
cDecimalDelimiter
||
c
!=
cDecimalDelimiter
)
&&
(
!
cThousandDelimiter
||
c
!=
cThousandDelimiter
)
&&
...
...
@@ -274,10 +271,10 @@ void OFlatTable::fillColumns()
if
(
bNumeric
&&
cThousandDelimiter
)
{
// Ist der Trenner richtig angegeben?
Byte
String
aValue
=
aField2
.
GetToken
(
0
,
cDecimalDelimiter
);
String
aValue
=
aField2
.
GetToken
(
0
,
cDecimalDelimiter
);
for
(
sal_Int32
j
=
aValue
.
Len
()
-
4
;
j
>=
0
;
j
-=
4
)
{
char
c
=
aValue
.
GetChar
(
j
);
sal_Unicode
c
=
aValue
.
GetChar
(
j
);
// nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
if
(
c
==
cThousandDelimiter
&&
j
)
continue
;
...
...
@@ -294,7 +291,7 @@ void OFlatTable::fillColumns()
{
try
{
nIndex
=
m_xNumberFormatter
->
detectNumberFormat
(
::
com
::
sun
::
star
::
util
::
NumberFormat
::
ALL
,
String
(
aField2
,
pConnection
->
getTextEncoding
())
);
nIndex
=
m_xNumberFormatter
->
detectNumberFormat
(
::
com
::
sun
::
star
::
util
::
NumberFormat
::
ALL
,
aField2
);
}
catch
(
Exception
&
)
{
...
...
@@ -350,12 +347,12 @@ void OFlatTable::fillColumns()
}
// check if the columname already exists
String
aAlias
(
aColumnName
,
pConnection
->
getTextEncoding
()
);
String
aAlias
(
aColumnName
);
OSQLColumns
::
const_iterator
aFind
=
connectivity
::
find
(
m_aColumns
->
begin
(),
m_aColumns
->
end
(),
aAlias
,
aCase
);
sal_Int32
nExprCnt
=
0
;
while
(
aFind
!=
m_aColumns
->
end
())
{
(
aAlias
=
String
(
aColumnName
,
pConnection
->
getTextEncoding
())
)
+=
String
::
CreateFromInt32
(
++
nExprCnt
);
(
aAlias
=
aColumnName
)
+=
String
::
CreateFromInt32
(
++
nExprCnt
);
aFind
=
connectivity
::
find
(
m_aColumns
->
begin
(),
m_aColumns
->
end
(),
aAlias
,
aCase
);
}
...
...
@@ -575,7 +572,7 @@ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Boo
sal_Int32
nByteOffset
=
1
;
// Felder:
xub_StrLen
nStartPos
=
0
;
Byte
String
aStr
;
String
aStr
;
OSQLColumns
::
const_iterator
aIter
=
_rCols
.
begin
();
for
(
sal_Int32
i
=
0
;
aIter
!=
_rCols
.
end
();
++
aIter
,
++
i
)
{
...
...
@@ -608,7 +605,7 @@ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Boo
double
nRes
=
0.0
;
try
{
nRes
=
m_xNumberFormatter
->
convertStringToNumber
(
::
com
::
sun
::
star
::
util
::
NumberFormat
::
ALL
,
String
(
aStr
,
pConnection
->
getTextEncoding
())
);
nRes
=
m_xNumberFormatter
->
convertStringToNumber
(
::
com
::
sun
::
star
::
util
::
NumberFormat
::
ALL
,
aStr
);
Reference
<
XPropertySet
>
xProp
(
m_xNumberFormatter
->
getNumberFormatsSupplier
()
->
getNumberFormatSettings
(),
UNO_QUERY
);
com
::
sun
::
star
::
util
::
Date
aDate
;
xProp
->
getPropertyValue
(
::
rtl
::
OUString
::
createFromAscii
(
"NullDate"
))
>>=
aDate
;
...
...
@@ -635,9 +632,9 @@ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Boo
case
DataType
:
:
DECIMAL
:
// #99178# OJ
case
DataType
:
:
NUMERIC
:
{
char
cDecimalDelimiter
=
pConnection
->
getDecimalDelimiter
();
char
cThousandDelimiter
=
pConnection
->
getThousandDelimiter
();
Byte
String
aStrConverted
;
sal_Unicode
cDecimalDelimiter
=
pConnection
->
getDecimalDelimiter
();
sal_Unicode
cThousandDelimiter
=
pConnection
->
getThousandDelimiter
();
String
aStrConverted
;
OSL_ENSURE
(
cDecimalDelimiter
&&
nType
!=
DataType
::
INTEGER
||
!
cDecimalDelimiter
&&
nType
==
DataType
::
INTEGER
,
...
...
@@ -657,7 +654,8 @@ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Boo
else
aStrConverted
+=
aStr
.
GetChar
(
j
)
;
}
double
nVal
=
toDouble
(
aStrConverted
,
pConnection
->
getTextEncoding
());
int
nErrno
;
double
nVal
=
SolarMath
::
StringToDouble
(
aStrConverted
.
GetBuffer
(),
','
,
'.'
,
nErrno
);
// #99178# OJ
if
(
DataType
::
DECIMAL
==
nType
||
DataType
::
NUMERIC
==
nType
)
...
...
@@ -669,7 +667,7 @@ sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Boo
default
:
{
// Wert als String in Variable der Row uebernehmen
(
*
_rRow
)[
i
+
1
]
=
String
(
aStr
,
pConnection
->
getTextEncoding
())
;
(
*
_rRow
)[
i
+
1
]
=
aStr
;
}
break
;
}
...
...
@@ -710,12 +708,6 @@ BOOL OFlatTable::DeleteRow(const OSQLColumns& _rCols)
void
OFlatTable
::
AllocBuffer
()
{
}
//------------------------------------------------------------------
double
toDouble
(
const
ByteString
&
rString
,
rtl_TextEncoding
_nTextEncoding
)
{
int
nErrno
;
return
SolarMath
::
StringToDouble
(
UniString
(
rString
,
_nTextEncoding
).
GetBuffer
(),
','
,
'.'
,
nErrno
);
}
//------------------------------------------------------------------
BOOL
OFlatTable
::
UpdateBuffer
(
OValueVector
&
rRow
,
OValueRow
pOrgRow
,
const
Reference
<
XIndexAccess
>&
_xCols
)
...
...
connectivity/source/inc/flat/EConnection.hxx
Dosyayı görüntüle @
ad4cb6f7
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: EConnection.hxx,v $
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
* last change: $Author: oj $ $Date: 200
1-08-24 06:00:3
9 $
* last change: $Author: oj $ $Date: 200
2-10-31 14:15:2
9 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -76,10 +76,10 @@ namespace connectivity
private
:
sal_Bool
m_bFixedLength
;
// row of fixed length
sal_Bool
m_bHeaderLine
;
// column names in first row
sal_
uInt8
m_cFieldDelimiter
;
// look at the name
sal_
uInt8
m_cStringDelimiter
;
// delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
sal_
uInt8
m_cDecimalDelimiter
;
// Dezimal-delimiter (Dezimalpoint)
sal_
uInt8
m_cThousandDelimiter
;
//
sal_
Unicode
m_cFieldDelimiter
;
// look at the name
sal_
Unicode
m_cStringDelimiter
;
// delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
sal_
Unicode
m_cDecimalDelimiter
;
// Dezimal-delimiter (Dezimalpoint)
sal_
Unicode
m_cThousandDelimiter
;
//
public
:
OFlatConnection
(
ODriver
*
_pDriver
);
virtual
~
OFlatConnection
();
...
...
@@ -89,10 +89,10 @@ namespace connectivity
// own methods
inline
sal_Bool
isFixedLength
()
const
{
return
m_bFixedLength
;
}
inline
sal_Bool
isHeaderLine
()
const
{
return
m_bHeaderLine
;
}
inline
sal_
uInt8
getFieldDelimiter
()
const
{
return
m_cFieldDelimiter
;
}
inline
sal_
uInt8
getStringDelimiter
()
const
{
return
m_cStringDelimiter
;
}
inline
sal_
uInt8
getDecimalDelimiter
()
const
{
return
m_cDecimalDelimiter
;
}
inline
sal_
uInt8
getThousandDelimiter
()
const
{
return
m_cThousandDelimiter
;}
inline
sal_
Unicode
getFieldDelimiter
()
const
{
return
m_cFieldDelimiter
;
}
inline
sal_
Unicode
getStringDelimiter
()
const
{
return
m_cStringDelimiter
;
}
inline
sal_
Unicode
getDecimalDelimiter
()
const
{
return
m_cDecimalDelimiter
;
}
inline
sal_
Unicode
getThousandDelimiter
()
const
{
return
m_cThousandDelimiter
;}
// XServiceInfo
DECLARE_SERVICE_INFO
();
...
...
connectivity/source/inc/flat/ETable.hxx
Dosyayı görüntüle @
ad4cb6f7
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ETable.hxx,v $
*
* $Revision: 1.1
0
$
* $Revision: 1.1
1
$
*
* last change: $Author: oj $ $Date: 2002-10-
08 08:26:17
$
* last change: $Author: oj $ $Date: 2002-10-
31 14:15:29
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -84,13 +84,13 @@ namespace connectivity
// Ableitung von String mit ueberladenen GetToken/GetTokenCount-Methoden
// Speziell fuer FLAT FILE-Format: Strings koennen gequotet sein
//==================================================================
class
OFlatString
:
public
Byte
String
class
OFlatString
:
public
String
{
public
:
OFlatString
(){}
xub_StrLen
GetTokenCount
(
sal_
uInt8
cTok
=
';'
,
sal_uInt8
cStrDel
=
'\0'
)
const
;
void
GetTokenSpecial
(
ByteString
&
_rStr
,
xub_StrLen
&
nStartPos
,
sal_uInt8
cTok
=
';'
,
sal_uInt8
cStrDel
=
'\0'
)
const
;
xub_StrLen
GetTokenCount
(
sal_
Unicode
cTok
=
';'
,
sal_Unicode
cStrDel
=
'\0'
)
const
;
void
GetTokenSpecial
(
String
&
_rStr
,
xub_StrLen
&
nStartPos
,
sal_Unicode
cTok
=
';'
,
sal_Unicode
cStrDel
=
'\0'
)
const
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment