[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/utils DB.java,1.11,1.12
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2002-10-13 15:04:13
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils
In directory usw-pr-cvs1:/tmp/cvs-serv1411/net/sourceforge/idrs/utils
Modified Files:
DB.java
Log Message:
added unit testing capabilities
Index: DB.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/DB.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** DB.java 21 Sep 2002 16:13:03 -0000 1.11
--- DB.java 13 Oct 2002 15:04:10 -0000 1.12
***************
*** 50,54 ****
protected String[] varTypes;
protected transient Vector bvarTypes;
! protected transient LinkedList rows;
protected String user, driver, name, pass, ID;
protected boolean closeConn;
--- 50,54 ----
protected String[] varTypes;
protected transient Vector bvarTypes;
! protected transient LinkedList rowCache;
protected String user, driver, name, pass, ID;
protected boolean closeConn;
***************
*** 71,75 ****
protected transient boolean hasResults;
protected transient Statement holdForClean;
!
public boolean hasResults() {
return hasResults;
--- 71,75 ----
protected transient boolean hasResults;
protected transient Statement holdForClean;
! protected transient Object[] rows;
public boolean hasResults() {
return hasResults;
***************
*** 98,102 ****
public int getNumberRows() {
! return rows.size();
}
--- 98,102 ----
public int getNumberRows() {
! return rows.length;
}
***************
*** 155,159 ****
*/
public int getCurrLocation() throws Exception {
! System.out.println("Here : " + cursurLocation);
return this.cursurLocation;
}
--- 155,159 ----
*/
public int getCurrLocation() throws Exception {
! //System.out.println("Here : " + cursurLocation);
return this.cursurLocation;
}
***************
*** 503,507 ****
if (this.cursur == DB.CLIENT) {
//System.out.println("In Client cursor read table");
! rows = new LinkedList();
Iterator it;
while (rs.next()) {
--- 503,507 ----
if (this.cursur == DB.CLIENT) {
//System.out.println("In Client cursor read table");
! rowCache = new LinkedList();
Iterator it;
while (rs.next()) {
***************
*** 513,520 ****
//System.out.println(key + "=" + fields.get(key));
}
! rows.add(this.fields);
}
rs.close();
this.cursurLocation = this.beginWith;
}
else {//cursor is server by default
--- 513,521 ----
//System.out.println(key + "=" + fields.get(key));
}
! rowCache.add(this.fields);
}
rs.close();
this.cursurLocation = this.beginWith;
+ this.rows = rowCache.toArray();
}
else {//cursor is server by default
***************
*** 698,702 ****
public boolean moveTo(int location) throws Exception {
if (this.cursur == DB.CLIENT) {
! if ((location >= 0) && (location < rows.size())) {
this.cursurLocation = location;
return true;
--- 699,703 ----
public boolean moveTo(int location) throws Exception {
if (this.cursur == DB.CLIENT) {
! if ((location >= 0) && (location < rows.length)) {
this.cursurLocation = location;
return true;
***************
*** 729,734 ****
// System.out.println("Cursor client : ");
System.out.println("Location : " + cursurLocation);
! if ((rows.size() > cursurLocation) && (cursurLocation < beginWith + numRecs)) {
! this.fields = (HashMap) rows.get(this.cursurLocation);
cursurLocation++;
hasNext = true;
--- 730,735 ----
// System.out.println("Cursor client : ");
System.out.println("Location : " + cursurLocation);
! if ((rows.length > cursurLocation) && (cursurLocation < beginWith + numRecs)) {
! this.fields = (HashMap) rows[this.cursurLocation];
cursurLocation++;
hasNext = true;
***************
*** 773,777 ****
public boolean getHasNext() throws Exception {
if (this.cursur == DB.CLIENT) {
! return (this.cursurLocation < rows.size());
}
else {
--- 774,778 ----
public boolean getHasNext() throws Exception {
if (this.cursur == DB.CLIENT) {
! return (this.cursurLocation < rows.length);
}
else {
***************
*** 806,812 ****
idrs.getSession().setAttribute("IDRS_DB_CACHE",caches);
}
! this.wasCached = (caches.get(this.name) != null);
! //System.out.println("Cached : " + this.wasCached);
! //System.out.println("Cache : " + caches.get(this.name));
}
--- 807,813 ----
idrs.getSession().setAttribute("IDRS_DB_CACHE",caches);
}
! this.wasCached = (caches.get(this.ID) != null);
! System.out.println("Cached : " + this.wasCached);
! System.out.println("Cache : " + caches.get(this.name));
}
***************
*** 832,840 ****
if (this.cursur == DB.CLIENT) {
! caches.put(this.name,rows);
}
}
else {
! this.rows = ((LinkedList) ((HashMap) idrs.getSession().getAttribute("IDRS_DB_CACHE")).get(this.name));
}
--- 833,841 ----
if (this.cursur == DB.CLIENT) {
! caches.put(this.ID,rows);
}
}
else {
! this.rows = ((Object[]) ((HashMap) idrs.getSession().getAttribute("IDRS_DB_CACHE")).get(this.ID));
}
***************
*** 886,890 ****
}
! public DbCache getCache() {
if (this.cache == null) {
this.cache = new DbCache(rows);
--- 887,891 ----
}
! /*public DbCache getCache() {
if (this.cache == null) {
this.cache = new DbCache(rows);
***************
*** 905,908 ****
--- 906,910 ----
this.wasCached = true;
}
+ */
public void setTransactionType(int type) {
|