Merge [TRAFODION-1704] PR-224 T2 and T4 driver cleanup
diff --git a/README.txt b/README.txt
index 8df03c0..cd2a21f 100644
--- a/README.txt
+++ b/README.txt
@@ -12,24 +12,25 @@
To get started using Apache Trafodion:
- documentation for this release can be viewed on the Apache Trafodion
- wiki page:
- https://cwiki.apache.org/confluence/display/TRAFODION/Documentation
+ web page:
+ http://trafodion.apache.org/documentation.html
- release notes describing changes for release 1.3.0 can be viewed:
- https://cwiki.apache.org/confluence/display/TRAFODION/Software
+ http://trafodion.apache.org/release-notes-1-3-0.html
- the latest Apache Trafodion can be downloaded from Apache incubator
distribution site or accessed from git
- - download site:
+ = download site:
https://dist.apache.org/repos/dist/release/incubator/trafodion
- - git site:
+ = git site:
git@github.com:apache/incubator-trafodion
- To build and try out Apache Trafodion, please following our build
instructions as described:
- https://cwiki.apache.org/confluence/display/TRAFODION/Using+the+Software
+ http://trafodion.apache.org/download.html
+
=============================
Cryptographic software notice
diff --git a/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/BaseRow.java b/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/BaseRow.java
deleted file mode 100644
index 2eed427..0000000
--- a/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/BaseRow.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-// Source File Name: BaseRow.java
-
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.trafodion.jdbc.t2;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-abstract class BaseRow
- implements Serializable, Cloneable {
-
- protected Object origVals[];
-
- BaseRow() {
- }
-
- protected abstract Object getColumnObject(int i) throws SQLException;
-
- protected Object[] getOrigRow() {
- return origVals;
- }
-
- protected abstract void setColumnObject(int i, Object obj) throws SQLException;
-}
diff --git a/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/InsertRow.java b/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/InsertRow.java
deleted file mode 100644
index 54bb150..0000000
--- a/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/InsertRow.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t2;
-
-import java.io.Serializable;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.PreparedStatement;
-import java.util.BitSet;
-
-
-class InsertRow extends BaseRow
- implements Serializable, Cloneable {
-
- private BitSet colsInserted;
- private int cols;
-
- InsertRow(int i) {
- origVals = new Object[i];
- colsInserted = new BitSet(i);
- cols = i;
- }
-
- protected Object getColumnObject(int i) throws SQLException {
- if(!colsInserted.get(i - 1))
- throw new SQLException("No value has been inserted");
- else
- return origVals[i - 1];
- }
-
- protected void initInsertRow() {
- for(int i = 0; i < cols; i++)
- colsInserted.clear(i);
-
- }
-
- /*
- protected boolean isCompleteRow(RowSetMetaData rowsetmetadata) throws SQLException {
- for(int i = 0; i < cols; i++)
- if(!colsInserted.get(i) && rowsetmetadata.isNullable(i + 1) == 0)
- return false;
-
- return true;
- }
- */
-
- protected void markColInserted(int i) {
- colsInserted.set(i);
- }
-
- protected void setColumnObject(int i, Object obj) {
- origVals[i - 1] = obj;
- markColInserted(i - 1);
- }
-
- protected void insertRow(PreparedStatement insertStmt, BitSet paramCols) throws SQLException
- {
- int i;
- int j;
-
- for (i = 0, j= 1; i < cols ; i++)
- {
- if (paramCols.get(i))
- insertStmt.setObject(j++, origVals[i]);
- }
- insertStmt.execute();
- initInsertRow();
- }
-}
-
diff --git a/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/Row.java b/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/Row.java
deleted file mode 100644
index b8104aa..0000000
--- a/core/conn/jdbc_type2/src/main/java/org/trafodion/jdbc/t2/Row.java
+++ /dev/null
@@ -1,275 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-/*
-* Filename : Row.java
-* Description :
-*
-*/
-
-package org.trafodion.jdbc.t2;
-
-import java.io.Serializable;
-import java.sql.*;
-import java.util.BitSet;
-import java.util.Locale;
-
-// Referenced classes of package sun.jdbc.rowset:
-// BaseRow
-
-class Row extends BaseRow
- implements Serializable, Cloneable {
-
- private Object currentVals[];
- private BitSet colsChanged;
- private boolean deleted;
- private boolean updated;
- private boolean inserted;
- private int numCols;
-
- Row(int i) {
- origVals = new Object[i];
- currentVals = new Object[i];
- colsChanged = new BitSet(i);
- numCols = i;
- }
-
- Row(int i, Object aobj[]) {
- origVals = new Object[i];
- for(int j = 0; j < i; j++)
- origVals[j] = aobj[j];
-
- currentVals = new Object[i];
- colsChanged = new BitSet(i);
- numCols = i;
- }
-
- protected void clearDeleted() {
- deleted = false;
- }
-
- protected void clearInserted() {
- inserted = false;
- }
-
- protected void clearUpdated() {
- updated = false;
- for(int i = 0; i < numCols; i++) {
- currentVals[i] = null;
- colsChanged.clear(i);
- }
-
- }
-
- protected boolean getColUpdated(int i) {
- return colsChanged.get(i);
- }
-
- protected Object getColumnObject(int i) throws SQLException {
- if(getColUpdated(i - 1))
- return currentVals[i - 1];
- else
- return origVals[i - 1];
- }
-
- protected boolean getDeleted() {
- return deleted;
- }
-
- protected boolean getInserted() {
- return inserted;
- }
-
- protected boolean getUpdated() {
- return updated;
- }
-
- protected void initColumnObject(int i, Object obj) {
- origVals[i - 1] = obj;
- }
-
- protected void moveCurrentToOrig() {
- for(int i = 0; i < numCols; i++)
- if(getColUpdated(i)) {
- origVals[i] = currentVals[i];
- currentVals[i] = null;
- colsChanged.clear(i);
- }
- }
-
- private void setColUpdated(int i) {
- colsChanged.set(i);
- }
-
- protected void setColumnObject(int i, Object obj) {
- currentVals[i - 1] = obj;
- setColUpdated(i - 1);
- }
-
- protected void setLobObject(int i, Object obj) {
- currentVals[i - 1] = obj;
- origVals[i-1] = obj;
- }
-
-
- protected void setDeleted() {
- deleted = true;
- }
-
- protected void setInserted() {
- inserted = true;
- }
-
- protected void setUpdated() {
- updated = true;
- }
-
- protected void deleteRow(Locale locale, PreparedStatement deleteStmt, BitSet paramCols) throws SQLException
- {
- int i;
- int j;
- int count;
-
- for (i = 0, j = 1; i < numCols ; i++)
- {
- if (paramCols.get(i))
- deleteStmt.setObject(j++, origVals[i]);
- }
- count = deleteStmt.executeUpdate();
- if (count == 0)
- throw SQLMXMessages.createSQLException(locale, "row_modified", null);
- }
-
- protected void updateRow(Locale locale, PreparedStatement updateStmt, BitSet paramCols, BitSet keyCols) throws SQLException
- {
- int i;
- int j;
- int count;
- Object obj;
- int numPKey=0;
- int loc=0;
- int pKeyCounter=1;
-
- for (i = 0; i < numCols; i++ )
- {
- if(keyCols.get(i))
- numPKey++;
- }
-
- loc = numCols - numPKey;
-
- for (i = 0, j = 1; i < numCols ; i++)
- {
- if (keyCols.get(i))
- {
- if (getColUpdated(i))
- throw SQLMXMessages.createSQLException(locale, "primary_key_not_updateable", null);
- updateStmt.setObject((loc+pKeyCounter),getColumnObject(i+1));
- pKeyCounter++;
- }
- else
- {
- {
- obj = getColumnObject((i+1));
- if (obj instanceof SQLMXLob)
- {
- if (obj == origVals[i]) // New and old Lob objects are same
- {
- updateStmt.setObject(j++, new DataWrapper((int) ((SQLMXLob)obj).dataLocator_));
- continue;
- }
- }
- updateStmt.setObject(j++, obj);
- }
- }
- }
-
-
- /*
- for (i = 0 ; i < numCols ; i++)
- {
- if (paramCols.get(i))
- {
- obj = origVals[i];
- if (obj instanceof SQLMXLob)
- {
- updateStmt.setObject(j++, new DataWrapper(((SQLMXLob)obj).dataLocator_));
- continue;
- }
- updateStmt.setObject(j++, origVals[i]);
- }
- } */
- count = updateStmt.executeUpdate();
- if (count == 0)
- throw SQLMXMessages.createSQLException(locale, "row_modified", null);
- moveCurrentToOrig();
- setUpdated();
- }
-
- protected void refreshRow(Locale locale, PreparedStatement selectStmt, BitSet selectCols, BitSet keyCols) throws SQLException
- {
- int i;
- int j;
- ResultSet rs;
- ResultSetMetaData rsmd;
- int columnCount;
-
- clearUpdated();
-
- for (i = 0, j = 1; i < numCols ; i++)
- {
- if (keyCols.get(i))
- selectStmt.setObject(j++, origVals[i]);
- }
- rs = selectStmt.executeQuery();
- if (rs != null)
- {
- try {
- rsmd = rs.getMetaData();
-
- columnCount = rsmd.getColumnCount();
- for (i = 0, j = 1 ; i < numCols ; i++)
- {
- if (selectCols.get(i))
- origVals[i] = rs.getObject(j++);
- }
- } finally {
- rs.close();
- }
- }
- }
-
- protected void closeLobObjects()
- {
- int i;
- SQLMXLob lob;
-
- for (i = 0; i < numCols ; i++)
- {
- if (currentVals[i] instanceof SQLMXLob)
- {
- lob = (SQLMXLob)currentVals[i];
- lob.close();
- }
-
- }
- }
-}
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/BaseRow.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/BaseRow.java
deleted file mode 100644
index 3d28248..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/BaseRow.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.trafodion.jdbc.t4;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-abstract class BaseRow implements Serializable, Cloneable {
-
- protected Object origVals[];
-
- BaseRow() {
- }
-
- protected abstract Object getColumnObject(int i) throws SQLException;
-
- protected Object[] getOrigRow() {
- return origVals;
- }
-
- protected abstract void setColumnObject(int i, Object obj) throws SQLException;
-}
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InsertRow.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InsertRow.java
deleted file mode 100644
index e569d20..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InsertRow.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.io.Serializable;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.BitSet;
-
-class InsertRow extends BaseRow implements Serializable, Cloneable {
-
- private BitSet colsInserted;
- private int cols;
-
- InsertRow(int i) {
- origVals = new Object[i];
- colsInserted = new BitSet(i);
- cols = i;
- }
-
- protected Object getColumnObject(int i) throws SQLException {
- if (!colsInserted.get(i - 1)) {
- throw HPT4Messages.createSQLException(null, null, "no_column_value_specified", null);
- } else {
- return origVals[i - 1];
- }
- }
-
- protected void initInsertRow() {
- for (int i = 0; i < cols; i++) {
- colsInserted.clear(i);
-
- }
- }
-
- /*
- * protected boolean isCompleteRow(RowSetMetaData rowsetmetadata) throws
- * SQLException { for(int i = 0; i < cols; i++) if(!colsInserted.get(i) &&
- * rowsetmetadata.isNullable(i + 1) == 0) return false; return true; }
- */
-
- protected void markColInserted(int i) {
- colsInserted.set(i);
- }
-
- protected void setColumnObject(int i, Object obj) {
- origVals[i - 1] = obj;
- markColInserted(i - 1);
- }
-
- protected void insertRow(PreparedStatement insertStmt, BitSet paramCols) throws SQLException {
- int i;
- int j;
-
- for (i = 0, j = 1; i < cols; i++) {
- if (paramCols.get(i)) {
- insertStmt.setObject(j++, origVals[i]);
- }
- }
- insertStmt.execute();
- initInsertRow();
- }
-}
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceResultSet.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceResultSet.java
index 9126352..a69c38b 100644
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceResultSet.java
+++ b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/InterfaceResultSet.java
@@ -575,8 +575,8 @@
throws SQLException
{
- Row[] rowArray;
- Object[] objectArray;
+ ObjectArray[] rowArray;
+ Object[] columnArray;
Object columnValue;
int columnCount;
@@ -587,7 +587,7 @@
int byteLen = 0;
int maxRowLen = rs.connection_.ic_.getTransportBufferSize(); // maxRowLen
- rowArray = new Row[rowsAffected];
+ rowArray = new ObjectArray[rowsAffected];
// get the number of colums
columnCount = rs.getNoOfColumns();
@@ -599,7 +599,7 @@
String temp = "Reading row = " + rowIndex;
rs.connection_.props_.t4Logger_.logp(Level.FINEST, "InterfaceResultSet", "setFetchOutputs", temp, p);
}
- objectArray = new Object[columnCount];
+ columnArray = new Object[columnCount];
for (columnIndex = 0; columnIndex < columnCount; columnIndex++) {
if (rs.connection_.props_.t4Logger_.isLoggable(Level.FINEST) == true) {
@@ -658,9 +658,9 @@
columnValue = null;
}
- objectArray[columnIndex] = columnValue;
+ columnArray[columnIndex] = columnValue;
}
- rowArray[rowIndex] = new Row(columnCount, objectArray);
+ rowArray[rowIndex] = new ObjectArray(columnCount, columnArray);
}
rs.setFetchOutputs(rowArray, rowsAffected, endOfData);
}
@@ -672,9 +672,9 @@
setFetchOutputs(rs, rowsAffected, endOfData, values);
return;
}
- Object[] objectArray;
+ Object[] columnArray;
Object columnValue;
- Row[] rowArray = new Row[rowsAffected];
+ ObjectArray[] rowArray = new ObjectArray[rowsAffected];
int columnCount = rs.getNoOfColumns();
int rowIndex;
@@ -684,7 +684,7 @@
int byteLen = 0;
int maxRowLen = rs.connection_.ic_.getTransportBufferSize(); // maxRowLen
- objectArray = new Object[columnCount];
+ columnArray = new Object[columnCount];
int dataLength = 0;
@@ -724,10 +724,10 @@
}
} // end if else
- objectArray[columnIndex] = columnValue;
+ columnArray[columnIndex] = columnValue;
} // end for
- rowArray[rowIndex] = new Row(columnCount, objectArray);
+ rowArray[rowIndex] = new ObjectArray(columnCount, columnArray);
}
rs.setFetchOutputs(rowArray, rowsAffected, endOfData);
@@ -878,12 +878,12 @@
static Object[] getExecute2Outputs(TrafT4Connection conn, HPT4Desc[] desc, byte[] values, boolean swap) throws SQLException
{
- Object[] objectArray;
+ Object[] columnArray;
Object columnValue;
int columnIndex;
int columnCount = (desc == null) ? 0 : desc.length;
- objectArray = new Object[columnCount];
+ columnArray = new Object[columnCount];
for (columnIndex = 0; columnIndex < columnCount; columnIndex++) {
int noNullValueOffset = desc[columnIndex].noNullValue_;
@@ -907,10 +907,10 @@
}
} // end if else
- objectArray[columnIndex] = columnValue;
+ columnArray[columnIndex] = columnValue;
} // end for
- return objectArray;
+ return columnArray;
} // end getExectue2Outputs
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ObjectArray.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ObjectArray.java
new file mode 100644
index 0000000..673fcef
--- /dev/null
+++ b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ObjectArray.java
@@ -0,0 +1,88 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+
+package org.trafodion.jdbc.t4;
+
+import java.io.Serializable;
+import java.util.BitSet;
+
+
+// *****************************************************************
+// Class: ObjectArray
+//
+// This class describes an array of Objects
+// It is used by TrafT4ResultSets to handle result set rows.
+// *****************************************************************
+
+class ObjectArray implements Serializable, Cloneable {
+
+ // Class members
+ private BitSet arrayElements_;
+ private int arraySize_;
+ private Object objectArray_[];
+ private Object updatedArray_[];
+
+ // Constructors
+ ObjectArray(int arraySize) {
+ arraySize_ = arraySize;
+ objectArray_ = new Object[arraySize];
+ updatedArray_ = new Object[arraySize];
+
+ // Initializes bit map of elements to false
+ arrayElements_ = new BitSet(arraySize_);
+ }
+
+ ObjectArray(int arraySize, Object objectArray[]) {
+ arraySize_ = arraySize;
+ objectArray_ = new Object[arraySize];
+ updatedArray_ = new Object[arraySize];
+
+ // Initializes bit map of elements to false
+ arrayElements_ = new BitSet(arraySize_);
+
+ // populate object array with passed in object array
+ for (int idx = 0; idx < arraySize_; idx++) {
+ objectArray_[idx] = objectArray[idx];
+ }
+ }
+
+ // Helpers
+ protected int getSize() { return arraySize_; }
+ protected boolean isElementUpdated(int idx) { return arrayElements_ .get(idx); }
+ protected void setElementUpdated(int idx) { arrayElements_ .set(idx); }
+
+ // For experts - why subtract one from index?
+ protected Object getUpdatedArrayElement(int idx) {
+ if (arrayElements_ .get(idx - 1)) {
+ return updatedArray_[idx - 1];
+ }
+ else {
+ return objectArray_[idx - 1];
+ }
+ }
+
+ // For experts - why subtract one from index?
+ protected void updateArrayElement(int idx, Object obj) {
+ updatedArray_[idx - 1] = obj;
+ arrayElements_.set(idx - 1);
+ }
+
+}
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Row.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Row.java
deleted file mode 100644
index 21ee6f3..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Row.java
+++ /dev/null
@@ -1,233 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.io.Serializable;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.BitSet;
-import java.util.Locale;
-
-// Referenced classes of package sun.jdbc.rowset:
-// BaseRow
-
-class Row extends BaseRow implements Serializable, Cloneable {
-
- private Object currentVals[];
- private BitSet colsChanged;
- private boolean deleted;
- private boolean updated;
- private boolean inserted;
- private int numCols;
-
- Row(int i) {
- origVals = new Object[i];
- currentVals = new Object[i];
- colsChanged = new BitSet(i);
- numCols = i;
- }
-
- Row(int i, Object aobj[]) {
- origVals = new Object[i];
- for (int j = 0; j < i; j++) {
- origVals[j] = aobj[j];
-
- }
- currentVals = new Object[i];
- colsChanged = new BitSet(i);
- numCols = i;
- }
-
- protected void clearDeleted() {
- deleted = false;
- }
-
- protected void clearInserted() {
- inserted = false;
- }
-
- protected void clearUpdated() {
- updated = false;
- for (int i = 0; i < numCols; i++) {
- currentVals[i] = null;
- colsChanged.clear(i);
- }
-
- }
-
- protected boolean getColUpdated(int i) {
- return colsChanged.get(i);
- }
-
- protected Object getColumnObject(int i) throws SQLException {
- if (getColUpdated(i - 1)) {
- return currentVals[i - 1];
- } else {
- return origVals[i - 1];
- }
- }
-
- protected boolean getDeleted() {
- return deleted;
- }
-
- protected boolean getInserted() {
- return inserted;
- }
-
- protected boolean getUpdated() {
- return updated;
- }
-
- protected void initColumnObject(int i, Object obj) {
- origVals[i - 1] = obj;
- }
-
- protected void moveCurrentToOrig() {
- for (int i = 0; i < numCols; i++) {
- if (getColUpdated(i)) {
- origVals[i] = currentVals[i];
- currentVals[i] = null;
- colsChanged.clear(i);
- }
- }
- }
-
- private void setColUpdated(int i) {
- colsChanged.set(i);
- }
-
- protected void setColumnObject(int i, Object obj) {
- currentVals[i - 1] = obj;
- setColUpdated(i - 1);
- }
-
- protected void setLobObject(int i, Object obj) {
- currentVals[i - 1] = obj;
- origVals[i - 1] = obj;
- }
-
- protected void setDeleted() {
- deleted = true;
- }
-
- protected void setInserted() {
- inserted = true;
- }
-
- protected void setUpdated() {
- updated = true;
- }
-
- protected void deleteRow(Locale locale, PreparedStatement deleteStmt, BitSet paramCols) throws SQLException {
- int i;
- int j;
- int count;
-
- for (i = 0, j = 1; i < numCols; i++) {
- if (paramCols.get(i)) {
- deleteStmt.setObject(j++, origVals[i]);
- }
- }
- count = deleteStmt.executeUpdate();
- if (count == 0) {
- throw HPT4Messages.createSQLException(null, locale, "row_modified", null);
- }
- }
-
- protected void updateRow(Locale locale, PreparedStatement updateStmt, BitSet paramCols, BitSet keyCols)
- throws SQLException {
- int i;
- int j;
- int count;
-
- for (i = 0, j = 1; i < numCols; i++) {
- if (keyCols.get(i)) {
- if (getColUpdated(i)) {
- throw HPT4Messages.createSQLException(null, locale, "primary_key_not_updateable", null);
- }
- } else {
- if (paramCols.get(i)) { // LOB Support SB 10/8/2004
- Object obj = getColumnObject((i + 1));
-
-
- updateStmt.setObject(j++, getColumnObject(i + 1));
- }
- }
- }
-
- for (i = 0; i < numCols; i++) {
- // if (paramCols.get(i))
- if (keyCols.get(i)) {
- Object obj = origVals[i];
-
-
- updateStmt.setObject(j++, origVals[i]);
- }
- }
-
- count = updateStmt.executeUpdate();
- if (count == 0) {
- throw HPT4Messages.createSQLException(null, locale, "row_modified", null);
- }
- moveCurrentToOrig();
- setUpdated();
- }
-
- protected void refreshRow(Locale locale, PreparedStatement selectStmt, BitSet selectCols, BitSet keyCols)
- throws SQLException {
- int i;
- int j;
- ResultSet rs;
- ResultSetMetaData rsmd;
- int columnCount;
-
- clearUpdated();
-
- for (i = 0, j = 1; i < numCols; i++) {
- if (keyCols.get(i)) {
- selectStmt.setObject(j++, origVals[i]);
- }
- }
- rs = selectStmt.executeQuery();
- if (rs != null) {
- try {
- rsmd = rs.getMetaData();
- columnCount = rsmd.getColumnCount();
- rs.next();
- for (i = 0, j = 1; i < numCols; i++) {
- if (selectCols.get(i)) {
- origVals[i] = rs.getObject(j++);
- }
- }
- } catch (SQLException ex) {
- throw ex;
- } finally {
- rs.close();
- }
- }
- }
-
-
-}
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/T4DatabaseMetaData.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/T4DatabaseMetaData.java
index 108adb3..aa4d576 100644
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/T4DatabaseMetaData.java
+++ b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/T4DatabaseMetaData.java
@@ -3552,7 +3552,7 @@
}
TrafT4ResultSet resultSet;
HPT4Desc[] outputDesc;
- Row[] rows;
+ ObjectArray[] rows;
String[] rowValue;
clearWarnings();
@@ -3564,19 +3564,19 @@
"TABLE_TYPE", false, Types.VARCHAR, (short) 0, (short) 0, 0, null, null, null, 100, 0, 0);
resultSet = new TrafT4ResultSet(this, outputDesc, "", true);
- rows = new Row[3];
+ rows = new ObjectArray[3];
// Populate the rows
rowValue = new String[1];
rowValue[0] = new String("SYSTEM TABLE");
- rows[0] = new Row(1, rowValue);
+ rows[0] = new ObjectArray(1, rowValue);
rowValue[0] = new String("TABLE");
- rows[1] = new Row(1, rowValue);
+ rows[1] = new ObjectArray(1, rowValue);
rowValue[0] = new String("VIEW");
- rows[2] = new Row(1, rowValue);
+ rows[2] = new ObjectArray(1, rowValue);
resultSet.setFetchOutputs(rows, 3, true);
return resultSet;
@@ -4920,7 +4920,7 @@
}
TrafT4ResultSet resultSet;
HPT4Desc[] outputDesc;
- Row[] rows;
+ ObjectArray[] rows;
clearWarnings();
// connection_.getServerHandle().isConnectionOpen();
@@ -4943,7 +4943,7 @@
"BASE_TYPE", false, Types.SMALLINT, (short) 0, (short) 0, 0, null, null, null, 130, 0, 0);
resultSet = new TrafT4ResultSet(this, outputDesc, "", true);
- rows = new Row[0];
+ rows = new ObjectArray[0];
// Populate the rows
resultSet.setFetchOutputs(rows, 0, true);
@@ -5274,7 +5274,7 @@
}
TrafT4ResultSet resultSet;
HPT4Desc[] outputDesc;
- Row[] rows;
+ ObjectArray[] rows;
clearWarnings();
// connection_.getServerHandle().isConnectionOpen();
@@ -5295,7 +5295,7 @@
"SUPERTYPE_NAME", false, Types.VARCHAR, (short) 0, (short) 0, 0, null, null, null, 100, 0, 0);
resultSet = new TrafT4ResultSet(this, outputDesc, "", true);
- rows = new Row[0];
+ rows = new ObjectArray[0];
// Populate the rows
resultSet.setFetchOutputs(rows, 0, true);
@@ -5319,7 +5319,7 @@
}
TrafT4ResultSet resultSet;
HPT4Desc[] outputDesc;
- Row[] rows;
+ ObjectArray[] rows;
clearWarnings();
// connection_.getServerHandle().isConnectionOpen();
@@ -5336,7 +5336,7 @@
"SUPERTABLE_NAME", false, Types.VARCHAR, (short) 0, (short) 0, 0, null, null, null, 100, 0, 0);
resultSet = new TrafT4ResultSet(this, outputDesc, "", true);
- rows = new Row[0];
+ rows = new ObjectArray[0];
// Populate the rows
resultSet.setFetchOutputs(rows, 0, true);
@@ -5364,7 +5364,7 @@
}
TrafT4ResultSet resultSet;
HPT4Desc[] outputDesc;
- Row[] rows;
+ ObjectArray[] rows;
clearWarnings();
// connection_.getServerHandle().isConnectionOpen();
@@ -5415,7 +5415,7 @@
"SOURCE_DATA_TYPE", false, Types.SMALLINT, (short) 0, (short) 0, 0, null, null, null, 130, 0, 0);
resultSet = new TrafT4ResultSet(this, outputDesc, "", true);
- rows = new Row[0];
+ rows = new ObjectArray[0];
// Populate the rows
resultSet.setFetchOutputs(rows, 0, true);
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java
index b7a45ec..68b768b 100644
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java
+++ b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java
@@ -1952,7 +1952,7 @@
* rowsAffected) throws SQLException { batchRowCount_ = new int[1];
* batchRowCount_[0] = rowsAffected; if (outputDesc_ != null) { resultSet_ =
* new TrafT4ResultSet(this, outputDesc_); } else { resultSet_ = null; } if
- * (rowsAffected == 0) { resultSet_.setFetchOutputs(new Row[0], 0, true, 0); }
+ * (rowsAffected == 0) { resultSet_.setFetchOutputs(new ObjectValue[0], 0, true, 0); }
* else { resultSet_.irs_.setSingletonFetchOutputs(resultSet_, rowsAffected,
* true, 0, sqlValue_def_array); } }
*/
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4ResultSet.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4ResultSet.java
index 668aea8..9a4501b 100644
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4ResultSet.java
+++ b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4ResultSet.java
@@ -56,6 +56,10 @@
import java.util.logging.Level;
import java.util.logging.LogRecord;
+// ----------------------------------------------------------------------------
+// This class partially implements the result set class as defind in
+// java.sql.ResultSet.
+// ----------------------------------------------------------------------------
public class TrafT4ResultSet extends HPT4Handle implements java.sql.ResultSet {
// java.sql.ResultSet interface methods
@@ -185,38 +189,10 @@
onInsertRow_ = false;
}
+ // Method not implemented
public void cancelRowUpdates() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "cancelRowUpdates", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("cancelRowUpdates");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- clearWarnings();
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
- throw HPT4Messages
- .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
- "invalid_cursor_position", null);
- }
- Row row = (Row) getCurrentRow();
- if (!row.getUpdated()) {
- row.clearUpdated();
- }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "cancelRowUpdates - not supported", null);
}
/**
@@ -257,67 +233,10 @@
}
}
+ // Method not implemented
public void deleteRow() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "deleteRow", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("deleteRow");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- clearWarnings();
-
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
- throw HPT4Messages
- .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
- "invalid_cursor_position", null);
- }
-
-
- try {
- prepareDeleteStmt();
- Row row = (Row) getCurrentRow();
- // Remove the row from database
- row.deleteRow(connection_.getLocale(), deleteStmt_, paramCols_);
- // Remove the row from the resultSet
- cachedRows_.remove(--currentRow_);
- --numRows_;
-
- if ((getType() == ResultSet.TYPE_FORWARD_ONLY) && (getConcurrency() == ResultSet.CONCUR_UPDATABLE)) {
- int temp;
- temp = currentRowCount_;
-
- if (!next()) {
- if (temp == 1) {
- isBeforeFirst_ = true;
- }
- currentRowCount_ = 0;
- } else {
- --currentRowCount_;
- }
- } else {
- if (currentRow_ == 0) {
- isBeforeFirst_ = true;
- }
- }
- } catch (SQLException e) {
- performConnectionErrorChecks(e);
- throw e;
- }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "deleteRow - not supported", null);
}
public int findColumn(String columnName) throws SQLException {
@@ -839,7 +758,7 @@
case Types.VARCHAR: // Extension allows varchar and
case Types.LONGVARCHAR: // longvarchar data types
- Object x = getCurrentRow().getColumnObject(columnIndex);
+ Object x = getCurrentRow().getUpdatedArrayElement(columnIndex);
if (x == null) {
wasNull_ = true;
return null;
@@ -1870,11 +1789,11 @@
int targetSqlType;
int precision;
Object x;
- BaseRow currentRow;
+ ObjectArray currentRow;
validateGetInvocation(columnIndex);
currentRow = getCurrentRow();
- x = currentRow.getColumnObject(columnIndex);
+ x = currentRow.getUpdatedArrayElement(columnIndex);
if (x == null) {
wasNull_ = true;
@@ -2531,55 +2450,12 @@
return retValue;
}
-
// ------------------------------------------------------------------
+
+ // Method not implemented
public void insertRow() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "insertRow", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("insertRow");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- int i;
-
- clearWarnings();
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
- throw HPT4Messages
- .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
- }
- if (!onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
- "invalid_cursor_position", null);
- }
-
- prepareInsertStmt();
- InsertRow insertRow = (InsertRow) getCurrentRow();
- // Insert the row into database
- insertRow.insertRow(insertStmt_, paramCols_);
- // Add the row to the resultSet
- Row row = new Row(outputDesc_.length, insertRow.getOrigRow());
- row.setInserted();
- if (isBeforeFirst_ || isAfterLast_) {
- i = currentRow_;
- } else {
- i = currentRow_ - 1;
- }
- cachedRows_.add(i, row);
- numRows_++;
-
-
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "insertRow - not supported", null);
}
public boolean isAfterLast() throws SQLException {
@@ -2776,43 +2652,10 @@
}
}
+ // method not implemented
public void moveToInsertRow() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "moveToInsertRow", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("moveToInsertRow");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- clearWarnings();
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
- throw HPT4Messages
- .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
- }
-
-
- if (insertRow_ == null) {
- if (outputDesc_.length > 0) {
- insertRow_ = new InsertRow(outputDesc_.length);
- }
- }
- if (insertRow_ != null) {
- onInsertRow_ = true;
- savedCurrentRow_ = currentRow_;
- insertRow_.initInsertRow();
- }
-
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "moveToInsertRow - not supported", null);
}
public boolean next() throws SQLException {
@@ -2943,39 +2786,10 @@
return validRow;
}
+ // Method not implemented
public void refreshRow() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "refreshRow", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("refreshRow");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
-
- clearWarnings();
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_operation",
- null);
- }
- prepareSelectStmt();
- Row row = (Row) getCurrentRow();
- try {
- row.refreshRow(connection_.getLocale(), selectStmt_, paramCols_, keyCols_);
- } catch (SQLException e) {
- performConnectionErrorChecks(e);
- throw e;
- }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "refreshRow - not supported", null);
}
public boolean relative(int row) throws SQLException {
@@ -3032,103 +2846,22 @@
return flag;
}
+ // Method not implemented
public boolean rowDeleted() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "rowDeleted", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("rowDeleted");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- BaseRow row;
-
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_operation",
- null);
- }
- row = getCurrentRow();
- if (row instanceof Row) {
- return ((Row) row).getDeleted();
- } else {
- return false;
- }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "rowDeleted - not supported", null);
}
+ // Method not implemented
public boolean rowInserted() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "rowInserted", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("rowInserted");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- BaseRow row;
-
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_operation",
- null);
- }
- row = getCurrentRow();
- if (row instanceof Row) {
- return ((Row) row).getInserted();
- } else {
- return false;
- }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "rowInserted - not supported", null);
}
+ // Method not implemented
public boolean rowUpdated() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "rowUpdated", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("rowUpdated");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- BaseRow row;
-
- if (isClosed_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
- null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_operation",
- null);
- }
- row = getCurrentRow();
- if (row instanceof Row) {
- return ((Row) row).getUpdated();
- } else {
- return false;
- }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "rowUpdated - not supported", null);
}
public void setFetchDirection(int direction) throws SQLException {
@@ -3264,7 +2997,7 @@
messageArguments);
}
try {
- getCurrentRow().setColumnObject(columnIndex, new String(value, "ASCII"));
+ getCurrentRow().updateArrayElement(columnIndex, new String(value, "ASCII"));
} catch (java.io.UnsupportedEncodingException e) {
Object[] messageArguments = new Object[1];
messageArguments[0] = e.getMessage();
@@ -3308,7 +3041,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
@@ -3362,7 +3095,7 @@
throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "io_exception",
messageArguments);
}
- getCurrentRow().setColumnObject(columnIndex, value);
+ getCurrentRow().updateArrayElement(columnIndex, value);
}
public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException {
@@ -3401,7 +3134,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Boolean(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Boolean(x));
}
public void updateBoolean(String columnName, boolean x) throws SQLException {
@@ -3439,7 +3172,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Byte(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Byte(x));
}
public void updateByte(String columnName, byte x) throws SQLException {
@@ -3477,7 +3210,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateBytes(String columnName, byte[] x) throws SQLException {
@@ -3539,7 +3272,7 @@
throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "io_exception",
messageArguments);
}
- getCurrentRow().setColumnObject(columnIndex, new String(value));
+ getCurrentRow().updateArrayElement(columnIndex, new String(value));
}
public void updateCharacterStream(String columnName, Reader x, int length) throws SQLException {
@@ -3577,7 +3310,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateDate(String columnName, Date x) throws SQLException {
@@ -3615,7 +3348,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Double(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Double(x));
}
public void updateDouble(String columnName, double x) throws SQLException {
@@ -3653,7 +3386,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Float(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Float(x));
}
public void updateFloat(String columnName, float x) throws SQLException {
@@ -3691,7 +3424,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Integer(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Integer(x));
}
public void updateInt(String columnName, int x) throws SQLException {
@@ -3729,7 +3462,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Long(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Long(x));
}
public void updateLong(String columnName, long x) throws SQLException {
@@ -3767,7 +3500,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, null);
+ getCurrentRow().updateArrayElement(columnIndex, null);
}
public void updateNull(String columnName) throws SQLException {
@@ -3823,7 +3556,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateObject(String columnName, Object x) throws SQLException {
@@ -3902,41 +3635,10 @@
updateRef(columnIndex, x);
}
+ // Method not implemented
public void updateRow() throws SQLException {
- if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "updateRow", "", p);
- }
- if (connection_.props_.getLogWriter() != null) {
- LogRecord lr = new LogRecord(Level.FINE, "");
- Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
- lr.setParameters(p);
- lr.setSourceClassName("TrafT4ResultSet");
- lr.setSourceMethodName("updateRow");
- T4LogFormatter lf = new T4LogFormatter();
- String temp = lf.format(lr);
- connection_.props_.getLogWriter().println(temp);
- }
- clearWarnings();
- if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
- throw HPT4Messages
- .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
- }
- if (onInsertRow_) {
- throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
- "invalid_cursor_position", null);
- }
-
- if (connection_.getAutoCommit()) {
- // should set a warning for the user
- setSQLWarning(connection_.props_, "resultSet_updateRow_with_autocommit", null);
- }
- prepareUpdateStmt();
- Row row = (Row) getCurrentRow();
- // Update the row in database
- row.updateRow(connection_.getLocale(), updateStmt_, paramCols_, keyCols_);
-
-
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "updateRow - not supported", null);
}
public void updateShort(int columnIndex, short x) throws SQLException {
@@ -3955,7 +3657,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, new Short(x));
+ getCurrentRow().updateArrayElement(columnIndex, new Short(x));
}
public void updateShort(String columnName, short x) throws SQLException {
@@ -3993,7 +3695,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateString(String columnName, String x) throws SQLException {
@@ -4031,7 +3733,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateTime(String columnName, Time x) throws SQLException {
@@ -4069,7 +3771,7 @@
connection_.props_.getLogWriter().println(temp);
}
validateUpdInvocation(columnIndex);
- getCurrentRow().setColumnObject(columnIndex, x);
+ getCurrentRow().updateArrayElement(columnIndex, x);
}
public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
@@ -4280,7 +3982,7 @@
}
}
- private BaseRow getCurrentRow() throws SQLException {
+ private ObjectArray getCurrentRow() throws SQLException {
if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getCurrentRow", "", p);
@@ -4304,7 +4006,7 @@
if (isAfterLast_) {
throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "cursor_after_last_row", null);
}
- return (BaseRow) cachedRows_.get(currentRow_ - 1);
+ return (ObjectArray) cachedRows_.get(currentRow_ - 1);
}
}
@@ -4582,7 +4284,7 @@
// DatabaseMetaData catalog APIs also call this method to update the rows
// fetched
//
- void setFetchOutputs(Row[] row, int rowsFetched, boolean endOfData) throws SQLException {
+ void setFetchOutputs(ObjectArray[] row, int rowsFetched, boolean endOfData) throws SQLException {
if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
Object p[] = T4LoggingUtilities.makeParams(connection_.props_, row, rowsFetched, endOfData, 0);
connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "setFetchOutputs", "", p);
@@ -4813,9 +4515,9 @@
int sqlCharset = outputDesc_[columnIndex - 1].sqlCharset_;
wasNull_ = true;
- BaseRow row = getCurrentRow();
+ ObjectArray row = getCurrentRow();
if (row != null) {
- obj = row.getColumnObject(columnIndex);
+ obj = row.getUpdatedArrayElement(columnIndex);
if (obj != null) {
if (obj instanceof byte[]) {
try {
@@ -5009,7 +4711,7 @@
ArrayList cachedRows_;
boolean onInsertRow_;
- InsertRow insertRow_;
+ ObjectArray insertRow_;
int savedCurrentRow_;
boolean showInserted_;
int numRows_;
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4Statement.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4Statement.java
index d0daff1..d28746f 100644
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4Statement.java
+++ b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/TrafT4Statement.java
@@ -1272,7 +1272,7 @@
if (rowsAffected == 0) {
if (endOfData == true) {
- resultSet_[result_set_offset].setFetchOutputs(new Row[0], 0, true);
+ resultSet_[result_set_offset].setFetchOutputs(new ObjectArray[0], 0, true);
}
} else {
if(resultSet_[result_set_offset].keepRawBuffer_ == true)
diff --git a/core/sql/common/multi-byte.h b/core/sql/common/multi-byte.h
index fb7d6cf..0775e57 100644
--- a/core/sql/common/multi-byte.h
+++ b/core/sql/common/multi-byte.h
@@ -18,12 +18,6 @@
// under the License.
//
// @@@ END COPYRIGHT @@@
-/*
- * COPYRIGHT NOTICE
- *
- * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
- * ALL RIGHTS RESERVED (OSF/1). See /usr/include/COPYRIGHT.OSF1 .
- */
#include <sys/types.h>
diff --git a/win-odbc64/sql/common/from_GB2312.c b/win-odbc64/sql/common/from_GB2312.c
index 1eeb949..feb0438 100644
--- a/win-odbc64/sql/common/from_GB2312.c
+++ b/win-odbc64/sql/common/from_GB2312.c
@@ -42,13 +42,6 @@
* $EndLog$
*/
-/*
- * COPYRIGHT NOTICE
- *
- * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
- * ALL RIGHTS RESERVED (OSF/1). See /usr/include/COPYRIGHT.OSF1 .
- */
-
#include "fcconv.h"
#include "multi-byte.h"
diff --git a/win-odbc64/sql/common/multi-byte.h b/win-odbc64/sql/common/multi-byte.h
index 46c4337..bacf408 100644
--- a/win-odbc64/sql/common/multi-byte.h
+++ b/win-odbc64/sql/common/multi-byte.h
@@ -18,12 +18,6 @@
// under the License.
//
// @@@ END COPYRIGHT @@@
-/*
- * COPYRIGHT NOTICE
- *
- * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
- * ALL RIGHTS RESERVED (OSF/1). See /usr/include/COPYRIGHT.OSF1 .
- */
#include <sys/types.h>