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
72ced5a1
Kaydet (Commit)
72ced5a1
authored
May 19, 2013
tarafından
Lionel Elie Mamane
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
flat file db driver: clean up seekRow
Change-Id: Ib9057944c120522230d5ed00cf5d152e5f0b4726
üst
f2cf75d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
49 deletions
+57
-49
ETable.cxx
connectivity/source/drivers/flat/ETable.cxx
+57
-49
No files found.
connectivity/source/drivers/flat/ETable.cxx
Dosyayı görüntüle @
72ced5a1
...
@@ -746,6 +746,8 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
...
@@ -746,6 +746,8 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
// run through
// run through
case
IResultSetHelper
:
:
NEXT
:
case
IResultSetHelper
:
:
NEXT
:
{
{
if
(
m_nMaxRowCount
!=
0
&&
m_nRowPos
>
m_nMaxRowCount
)
return
sal_False
;
++
m_nRowPos
;
++
m_nRowPos
;
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
const_iterator
aFind
=
m_aRowPosToFilePos
.
find
(
m_nRowPos
);
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
const_iterator
aFind
=
m_aRowPosToFilePos
.
find
(
m_nRowPos
);
m_bNeedToReadLine
=
aFind
!=
m_aRowPosToFilePos
.
end
();
m_bNeedToReadLine
=
aFind
!=
m_aRowPosToFilePos
.
end
();
...
@@ -772,16 +774,19 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
...
@@ -772,16 +774,19 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
break
;
break
;
case
IResultSetHelper
:
:
PRIOR
:
case
IResultSetHelper
:
:
PRIOR
:
assert
(
m_nRowPos
>=
0
);
if
(
m_nRowPos
==
0
)
return
sal_False
;
--
m_nRowPos
;
--
m_nRowPos
;
if
(
m_nRowPos
>
0
)
{
{
assert
(
m_aRowPosToFilePos
.
find
(
m_nRowPos
)
!=
m_aRowPosToFilePos
.
end
());
TRowPositionsInFile
::
iterator
aPositions
=
m_aRowPosToFilePos
[
m_nRowPos
];
TRowPositionsInFile
::
iterator
aPositions
=
m_aRowPosToFilePos
[
m_nRowPos
];
m_nFilePos
=
aPositions
->
first
;
m_nFilePos
=
aPositions
->
first
;
nCurPos
=
aPositions
->
second
;
nCurPos
=
aPositions
->
second
;
m_bNeedToReadLine
=
true
;
m_bNeedToReadLine
=
true
;
}
}
else
m_nRowPos
=
0
;
break
;
break
;
case
IResultSetHelper
:
:
LAST
:
case
IResultSetHelper
:
:
LAST
:
...
@@ -805,35 +810,42 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
...
@@ -805,35 +810,42 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
}
}
break
;
break
;
case
IResultSetHelper
:
:
RELATIVE
:
case
IResultSetHelper
:
:
RELATIVE
:
if
(
nOffset
>
0
)
{
{
for
(
sal_Int32
i
=
0
;
i
<
nOffset
;
++
i
)
const
sal_Int32
nNewRowPos
=
m_nRowPos
+
nOffset
;
seekRow
(
IResultSetHelper
::
NEXT
,
1
,
nCurPos
);
if
(
nNewRowPos
<=
0
)
}
return
sal_False
;
else
if
(
nOffset
<
0
)
return
seekRow
(
IResultSetHelper
::
ABSOLUTE
,
nNewRowPos
,
nCurPos
);
{
for
(
sal_Int32
i
=
nOffset
;
i
;
++
i
)
seekRow
(
IResultSetHelper
::
PRIOR
,
1
,
nCurPos
);
}
}
break
;
case
IResultSetHelper
:
:
ABSOLUTE
:
case
IResultSetHelper
:
:
ABSOLUTE
:
{
{
if
(
nOffset
<
0
)
if
(
nOffset
<
0
)
nOffset
=
m_nRowPos
+
nOffset
;
{
if
(
m_nMaxRowCount
==
0
)
{
if
(
!
seekRow
(
IResultSetHelper
::
LAST
,
0
,
nCurPos
))
return
sal_False
;
}
assert
(
m_nMaxRowCount
!=
0
);
nOffset
=
m_nMaxRowCount
+
nOffset
+
1
;
}
if
(
nOffset
<
0
)
{
m_nRowPos
=
0
;
return
sal_False
;
}
if
(
m_nMaxRowCount
&&
nOffset
>
m_nMaxRowCount
)
{
m_nRowPos
=
m_nMaxRowCount
+
1
;
return
sal_False
;
}
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
const_iterator
aIter
=
m_aRowPosToFilePos
.
find
(
nOffset
);
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
const_iterator
aIter
=
m_aRowPosToFilePos
.
find
(
nOffset
);
if
(
aIter
!=
m_aRowPosToFilePos
.
end
())
if
(
aIter
!=
m_aRowPosToFilePos
.
end
())
{
{
m_nFilePos
=
aIter
->
second
->
first
;
m_nFilePos
=
aIter
->
second
->
first
;
nCurPos
=
aIter
->
second
->
second
;
nCurPos
=
aIter
->
second
->
second
;
//m_pFileStream->Seek(m_nFilePos)
;
m_nRowPos
=
nOffset
;
m_bNeedToReadLine
=
true
;
m_bNeedToReadLine
=
true
;
//if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
// return sal_False;
}
else
if
(
m_nMaxRowCount
&&
nOffset
>
m_nMaxRowCount
)
// offset is outside the table
{
m_nRowPos
=
m_nMaxRowCount
;
return
sal_False
;
}
}
else
else
{
{
...
@@ -842,20 +854,24 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
...
@@ -842,20 +854,24 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
{
{
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
reverse_iterator
aLastPos
=
m_aRowPosToFilePos
.
rbegin
();
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
reverse_iterator
aLastPos
=
m_aRowPosToFilePos
.
rbegin
();
m_nRowPos
=
aLastPos
->
first
;
m_nRowPos
=
aLastPos
->
first
;
nCurPos
=
m_nFilePos
=
aLastPos
->
second
->
first
;
m_nFilePos
=
aIter
->
second
->
first
;
while
(
m_nRowPos
!=
nOffset
)
nCurPos
=
aIter
->
second
->
second
;
seekRow
(
IResultSetHelper
::
NEXT
,
1
,
nCurPos
);
while
(
m_nRowPos
<
nOffset
)
{
if
(
!
seekRow
(
IResultSetHelper
::
NEXT
,
1
,
nCurPos
))
return
sal_False
;
}
assert
(
m_nRowPos
==
nOffset
);
}
}
else
else
{
{
// This is very fishy... The rows numbering has holes???
assert
(
false
);
--
aIter
;
--
aIter
;
m_nRowPos
=
aIter
->
first
;
m_nRowPos
=
aIter
->
first
;
m_nFilePos
=
aIter
->
second
->
first
;
m_nFilePos
=
aIter
->
second
->
first
;
nCurPos
=
aIter
->
second
->
second
;
nCurPos
=
aIter
->
second
->
second
;
//m_pFileStream->Seek(m_nFilePos);
m_bNeedToReadLine
=
true
;
m_bNeedToReadLine
=
true
;
//if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
// return sal_False;
}
}
}
}
}
}
...
@@ -865,32 +881,24 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
...
@@ -865,32 +881,24 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
{
{
m_nRowPos
=
0
;
m_nRowPos
=
0
;
TRowPositionsInFile
::
const_iterator
aFind
=
m_aFilePosToEndLinePos
.
find
(
nOffset
);
TRowPositionsInFile
::
const_iterator
aFind
=
m_aFilePosToEndLinePos
.
find
(
nOffset
);
m_bNeedToReadLine
=
aFind
!=
m_aFilePosToEndLinePos
.
end
();
if
(
aFind
==
m_aFilePosToEndLinePos
.
end
())
if
(
m_bNeedToReadLine
)
//invalid bookmark
return
sal_False
;
m_bNeedToReadLine
=
true
;
m_nFilePos
=
aFind
->
first
;
nCurPos
=
aFind
->
second
;
for
(
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
const_iterator
p
=
m_aRowPosToFilePos
.
begin
();
p
!=
m_aRowPosToFilePos
.
end
();
++
p
)
{
{
m_nFilePos
=
aFind
->
first
;
assert
(
p
->
second
->
first
<=
nOffset
);
nCurPos
=
aFind
->
second
;
if
(
p
->
second
->
first
==
nOffset
)
for
(
::
std
::
map
<
sal_Int32
,
TRowPositionsInFile
::
iterator
>::
const_iterator
p
=
m_aRowPosToFilePos
.
begin
();
p
!=
m_aRowPosToFilePos
.
end
();
++
p
)
{
{
assert
(
p
->
second
->
first
<=
nOffset
);
m_nRowPos
=
p
->
first
;
if
(
p
->
second
->
first
==
nOffset
)
break
;
{
m_nRowPos
=
p
->
first
;
break
;
}
}
}
assert
(
m_nRowPos
>
0
);
}
else
{
assert
(
false
);
m_nFilePos
=
nOffset
;
m_pFileStream
->
Seek
(
nOffset
);
if
(
m_pFileStream
->
IsEof
()
||
!
readLine
(
nCurPos
)
)
return
sal_False
;
}
}
assert
(
m_nRowPos
>
0
);
break
;
break
;
}
}
}
}
...
...
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