Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6ea41dc

Browse files
committed
Patch for jdbc2 ResultSet.java. Looks like performance improvement.
Joseph Shraibman
1 parent1834987 commit6ea41dc

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ public void close() throws SQLException
134134
{
135135
//release resources held (memory for tuples)
136136
if(rows!=null) {
137-
rows.setSize(0);
138137
rows=null;
139138
}
140139
}
@@ -710,7 +709,8 @@ public int findColumn(String columnName) throws SQLException
710709
{
711710
inti;
712711

713-
for (i =0 ;i <fields.length; ++i)
712+
finalintflen =fields.length;
713+
for (i =0 ;i <flen; ++i)
714714
if (fields[i].getName().equalsIgnoreCase(columnName))
715715
return (i+1);
716716
thrownewPSQLException ("postgresql.res.colname",columnName);
@@ -726,11 +726,13 @@ public boolean absolute(int index) throws SQLException
726726
if (index==0)
727727
thrownewSQLException("Cannot move to index of 0");
728728

729+
finalintrows_size =rows.size();
730+
729731
//if index<0, count from the end of the result set, but check
730732
//to be sure that it is not beyond the first index
731733
if (index<0)
732-
if (index>=-rows.size())
733-
internalIndex=rows.size()+index;
734+
if (index > -rows_size)
735+
internalIndex =rows_size+index;
734736
else {
735737
beforeFirst();
736738
returnfalse;
@@ -739,7 +741,7 @@ public boolean absolute(int index) throws SQLException
739741
//must be the case that index>0,
740742
//find the correct place, assuming that
741743
//the index is not too large
742-
if (index<=rows.size())
744+
if (index <=rows_size)
743745
internalIndex =index-1;
744746
else {
745747
afterLast();
@@ -753,8 +755,9 @@ public boolean absolute(int index) throws SQLException
753755

754756
publicvoidafterLast()throwsSQLException
755757
{
756-
if (rows.size() >0)
757-
current_row =rows.size();
758+
finalintrows_size =rows.size();
759+
if (rows_size >0)
760+
current_row =rows_size;
758761
}
759762

760763
publicvoidbeforeFirst()throwsSQLException
@@ -967,7 +970,8 @@ public void insertRow() throws SQLException
967970

968971
publicbooleanisAfterLast()throwsSQLException
969972
{
970-
return (current_row >=rows.size() &&rows.size() >0);
973+
finalintrows_size =rows.size();
974+
return (current_row >=rows_size &&rows_size >0);
971975
}
972976

973977
publicbooleanisBeforeFirst()throwsSQLException
@@ -982,16 +986,18 @@ public boolean isFirst() throws SQLException
982986

983987
publicbooleanisLast()throwsSQLException
984988
{
985-
return (current_row ==rows.size() -1 &&rows.size() >0);
989+
finalintrows_size =rows.size();
990+
return (current_row ==rows_size -1 &&rows_size >0);
986991
}
987992

988993
publicbooleanlast()throwsSQLException
989994
{
990-
if (rows.size() <=0)
991-
returnfalse;
992-
current_row =rows.size() -1;
993-
this_row = (byte [][])rows.elementAt(current_row);
994-
returntrue;
995+
finalintrows_size =rows.size();
996+
if (rows_size <=0)
997+
returnfalse;
998+
current_row =rows_size -1;
999+
this_row = (byte [][])rows.elementAt(current_row);
1000+
returntrue;
9951001
}
9961002

9971003
publicvoidmoveToCurrentRow()throwsSQLException
@@ -1480,4 +1486,3 @@ public static Timestamp toTimestamp(String s, ResultSet resultSet) throws SQLExc
14801486
}
14811487
}
14821488
}
1483-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp