Author: shawkins
Date: 2010-06-10 00:22:03 -0400 (Thu, 10 Jun 2010)
New Revision: 2213
Removed:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestStuff.java
Modified:
trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java
trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java
trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java
Log:
fixing setting the length prior to serialization for blob/clob types
Modified: trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java 2010-06-10 04:01:14
UTC (rev 2212)
+++ trunk/common-core/src/main/java/org/teiid/core/types/BlobType.java 2010-06-10 04:22:03
UTC (rev 2213)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectOutput;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.SQLException;
@@ -142,12 +143,13 @@
}
}
- private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
try {
length();
} catch (SQLException e) {
}
- out.defaultWriteObject();
+ super.writeExternal(out);
}
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java 2010-06-10 04:01:14
UTC (rev 2212)
+++ trunk/common-core/src/main/java/org/teiid/core/types/ClobType.java 2010-06-10 04:22:03
UTC (rev 2213)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectOutput;
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringWriter;
@@ -217,12 +218,13 @@
}
}
- private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
try {
length();
} catch (SQLException e) {
}
- out.defaultWriteObject();
+ super.writeExternal(out);
}
}
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java 2010-06-10
04:01:14 UTC (rev 2212)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java 2010-06-10
04:22:03 UTC (rev 2213)
@@ -65,6 +65,8 @@
// now read back the object from serilized state
ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
ClobType read = (ClobType)in.readObject();
+
+ assertTrue(read.length() > 0);
// make sure we have kept the reference stream id
assertEquals(key, read.getReferenceStreamId());
Deleted: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestStuff.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestStuff.java 2010-06-10
04:01:14 UTC (rev 2212)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestStuff.java 2010-06-10
04:22:03 UTC (rev 2213)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import static org.junit.Assert.*;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.teiid.jdbc.util.ResultSetUtil;
-@SuppressWarnings("nls")
-public class TestStuff {
-
- @Ignore
- @Test public void testNoExec() throws Exception {
- Connection c =
DriverManager.getConnection("jdbc:teiid:tpcrperf@mm://localhost:31000",
"admin", "teiid");
- Statement s = c.createStatement();
- long start = System.currentTimeMillis();
- //s.execute("set noexec on");
- s.execute("set showplan debug");
- DatabaseMetaData dmd = c.getMetaData();
-
- //ResultSetUtil.printResultSet(s.executeQuery("select * from
TPCR01_OraclePhys.NATION"), 20, false, System.out);
- ResultSetUtil.printResultSet(s.executeQuery("select * from tables"), 20,
false, System.out);
-
- //ResultSet rs = s.executeQuery("SELECT ORDERS.O_ORDERKEY, ORDERS.O_ORDERDATE,
ORDERS.O_CLERK, CUSTOMER.C_CUSTKEY, CUSTOMER.C_NAME FROM
TPCR01_SqlServerVirt.TPCR01.ORDERS,TPCR01_SqlServerVirt.TPCR01.CUSTOMER WHERE
(CUSTOMER.C_CUSTKEY = ORDERS.O_CUSTKEY) AND (O_ORDERKEY < 2)");
- System.out.println(System.currentTimeMillis() - start);
-
- System.out.println(s.unwrap(TeiidStatement.class).getDebugLog());
- System.out.println(s.unwrap(TeiidStatement.class).getPlanDescription());
- s.close();
- c.close();
- }
-
-
-}