Added: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSet.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSet.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSet.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSet.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,922 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.comp.sdbc;
+
+import java.io.InputStreamReader;
+import java.math.BigDecimal;
+import java.nio.charset.Charset;
+
+import org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySet;
+import 
org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySetAdapter.PropertyGetter;
+import 
org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySetAdapter.PropertySetter;
+import 
org.apache.openoffice.comp.sdbc.dbtools.comphelper.ResourceBasedEventLogger;
+import org.apache.openoffice.comp.sdbc.dbtools.util.DBTypeConversion;
+import org.apache.openoffice.comp.sdbc.dbtools.util.DbTools;
+import org.apache.openoffice.comp.sdbc.dbtools.util.PropertyIds;
+import org.apache.openoffice.comp.sdbc.dbtools.util.Resources;
+import org.apache.openoffice.comp.sdbc.dbtools.util.SharedResources;
+import org.apache.openoffice.comp.sdbc.dbtools.util.StandardSQLState;
+
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.comp.sdbc.ConnectionLog.ObjectType;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lib.uno.adapter.InputStreamToXInputStreamAdapter;
+import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter;
+import com.sun.star.logging.LogLevel;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.SQLWarning;
+import com.sun.star.sdbc.XArray;
+import com.sun.star.sdbc.XBlob;
+import com.sun.star.sdbc.XClob;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XColumnLocate;
+import com.sun.star.sdbc.XRef;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetMetaData;
+import com.sun.star.sdbc.XResultSetMetaDataSupplier;
+import com.sun.star.sdbc.XResultSetUpdate;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbc.XRowUpdate;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.util.Date;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.Time;
+
+public class JavaSQLResultSet extends PropertySet
+        implements XResultSet, XRow, XResultSetMetaDataSupplier,
+            XWarningsSupplier, XResultSetUpdate, XRowUpdate, XCloseable,
+            XColumnLocate, XServiceInfo {
+
+    private static final String[] services = {
+            "com.sun.star.sdbc.ResultSet"
+    };
+    
+    private java.sql.ResultSet jdbcResultSet;
+    private JavaSQLConnection connection;
+    private Object statement;
+    private ResourceBasedEventLogger logger;
+    
+    public JavaSQLResultSet(java.sql.ResultSet jdbcResultSet, 
JavaSQLConnection connection) {
+        this (jdbcResultSet, connection, null);
+    }
+    
+    public JavaSQLResultSet(java.sql.ResultSet jdbcResultSet, 
JavaSQLConnection connection, Object statement) {
+        this.jdbcResultSet = jdbcResultSet;
+        this.connection = connection;
+        this.statement = statement;
+        logger = new ConnectionLog(connection.getLogger(), ObjectType.RESULT);
+        registerProperties();
+    }
+    
+    // XComponent
+    
+    @Override
+    protected synchronized void postDisposing() {
+        super.postDisposing();
+        if (jdbcResultSet != null) {
+            try {
+                jdbcResultSet.close();
+            } catch (java.sql.SQLException jdbcSqlException) {
+                logger.log(LogLevel.WARNING, jdbcSqlException);
+            }
+            jdbcResultSet = null;
+        }
+    }
+    
+    // XCloseable
+    
+    @Override
+    public void close() throws SQLException {
+        dispose();
+    }
+    
+    // XServiceInfo
+    
+    @Override
+    public String getImplementationName() {
+        return "com.sun.star.sdbcx.JResultSet";
+    }
+    
+    @Override
+    public String[] getSupportedServiceNames() {
+        return services.clone();
+    }
+    
+    @Override
+    public boolean supportsService(String serviceName) {
+        for (String service : services) {
+            if (service.equals(serviceName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    // XPropertySet
+    
+    private void registerProperties() {
+        registerProperty(PropertyIds.CURSORNAME.name, 
PropertyIds.CURSORNAME.id, Type.STRING, (short)PropertyAttribute.READONLY,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getCursorName();
+                    }
+                }, null);
+        registerProperty(PropertyIds.RESULTSETCONCURRENCY.name, 
PropertyIds.RESULTSETCONCURRENCY.id,
+                Type.LONG, (short)PropertyAttribute.READONLY,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getResultSetConcurrency();
+                    }
+                }, null);
+        registerProperty(PropertyIds.RESULTSETTYPE.name, 
PropertyIds.RESULTSETTYPE.id,
+                Type.LONG, (short)PropertyAttribute.READONLY,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getResultSetType();
+                    }
+                }, null);
+        registerProperty(PropertyIds.FETCHDIRECTION.name, 
PropertyIds.FETCHDIRECTION.id,
+                Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getFetchDirection();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setFetchDirection((int)value);
+                    }
+                });
+        registerProperty(PropertyIds.FETCHSIZE.name, PropertyIds.FETCHSIZE.id,
+                Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getFetchSize();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setFetchSize((int)value);
+                    }
+                });
+    }
+    
+    private String getCursorName() throws WrappedTargetException {
+        try {
+            return jdbcResultSet.getCursorName();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+    
+    private int getFetchDirection() throws WrappedTargetException {
+        try {
+            return jdbcResultSet.getFetchDirection();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private void setFetchDirection(int value) throws WrappedTargetException {
+        try {
+            jdbcResultSet.setFetchDirection(value);
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private int getFetchSize() throws WrappedTargetException {
+        try {
+            return jdbcResultSet.getFetchSize();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private void setFetchSize(int value) throws WrappedTargetException {
+        try {
+            jdbcResultSet.setFetchSize(value);
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+    
+    private int getResultSetConcurrency() throws WrappedTargetException {
+        try {
+            return jdbcResultSet.getConcurrency();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }        
+    }
+    
+    private int getResultSetType() throws WrappedTargetException {
+        try {
+            return jdbcResultSet.getType();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }        
+    }
+    
+    // everything else
+    
+    @Override
+    public int findColumn(String columnName) throws SQLException {
+        try {
+            return jdbcResultSet.findColumn(columnName);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XInputStream getBinaryStream(int columnIndex) throws SQLException {
+        try {
+            return new 
InputStreamToXInputStreamAdapter(jdbcResultSet.getBinaryStream(columnIndex));
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XInputStream getCharacterStream(int columnIndex) throws 
SQLException {
+        try {
+            return new InputStreamToXInputStreamAdapter(new 
ReaderInputStream(jdbcResultSet.getCharacterStream(columnIndex)));
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean getBoolean(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getBoolean(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getByte(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getBytes(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        try {
+            java.sql.Date jdbcDate = jdbcResultSet.getDate(columnIndex);
+            if (jdbcDate != null) {
+                return DBTypeConversion.toDate(jdbcDate.toString());
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public double getDouble(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getDouble(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public float getFloat(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getFloat(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getInt(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public int getRow() throws SQLException {
+        try {
+            return jdbcResultSet.getRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getLong(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XResultSetMetaData getMetaData() throws SQLException {
+        try {
+            java.sql.ResultSetMetaData jdbcMetaData = 
jdbcResultSet.getMetaData();
+            if (jdbcMetaData != null) {
+                return new JavaSQLResultSetMetaData(connection, jdbcMetaData);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XArray getArray(int columnIndex) throws SQLException {
+        try {
+            java.sql.Array array = jdbcResultSet.getArray(columnIndex);
+            if (array != null) {
+                return new JavaSQLArray(logger, array);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XClob getClob(int columnIndex) throws SQLException {
+        try {
+            java.sql.Clob clob = jdbcResultSet.getClob(columnIndex);
+            if (clob != null) {
+                return new JavaSQLClob(logger, clob);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XBlob getBlob(int columnIndex) throws SQLException {
+        try {
+            java.sql.Blob blob = jdbcResultSet.getBlob(columnIndex);
+            if (blob != null) {
+                return new JavaSQLBlob(logger, blob);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public XRef getRef(int columnIndex) throws SQLException {
+        try {
+            java.sql.Ref ref = jdbcResultSet.getRef(columnIndex);
+            if (ref != null) {
+                return new JavaSQLRef(ref);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public Object getObject(int columnIndex, XNameAccess typeMap) throws 
SQLException {
+        if (typeMap.hasElements()) {
+            throw new SQLException(
+                    
SharedResources.getInstance().getResourceStringWithSubstitution(
+                            Resources.STR_UNSUPPORTED_FEATURE, 
"$featurename$", "Type maps"),
+                    this, StandardSQLState.SQL_FEATURE_NOT_IMPLEMENTED.name(), 
0, Any.VOID);
+        }
+        try {
+            Object ret = Any.VOID;
+            Object object = jdbcResultSet.getObject(columnIndex);
+            if (object instanceof String) {
+                ret = (String) object;
+            } else if (object instanceof Boolean) {
+                ret = (Boolean) object;
+            } else if (object instanceof java.sql.Date) {
+                ret = 
DBTypeConversion.toDate(((java.sql.Date)object).toString());
+            } else if (object instanceof java.sql.Time) {
+                ret = 
DBTypeConversion.toTime(((java.sql.Time)object).toString());
+            } else if (object instanceof java.sql.Timestamp) {
+                ret = 
DBTypeConversion.toDateTime(((java.sql.Timestamp)object).toString());
+            }
+            return ret;
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoExceptionLogged(this, logger, exception);
+        }
+    }
+    
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        try {
+            return jdbcResultSet.getShort(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public String getString(int columnIndex) throws SQLException {
+        try {
+            String string = jdbcResultSet.getString(columnIndex);
+            if (string != null) {
+                return string;
+            } else {
+                return "";
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        try {
+            java.sql.Time time = jdbcResultSet.getTime(columnIndex);
+            if (time != null) {
+                return DBTypeConversion.toTime(time.toString());
+            } else {
+                return new Time();
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public DateTime getTimestamp(int columnIndex) throws SQLException {
+        try {
+            java.sql.Timestamp timestamp = 
jdbcResultSet.getTimestamp(columnIndex);
+            if (timestamp != null) {
+                return DBTypeConversion.toDateTime(timestamp.toString());
+            } else {
+                return new DateTime();
+            }
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean isAfterLast() throws SQLException {
+        try {
+            return jdbcResultSet.isAfterLast();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean isFirst() throws SQLException {
+        try {
+            return jdbcResultSet.isFirst();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean isLast() throws SQLException {
+        try {
+            return jdbcResultSet.isLast();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void beforeFirst() throws SQLException {
+        try {
+            jdbcResultSet.beforeFirst();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void afterLast() throws SQLException {
+        try {
+            jdbcResultSet.afterLast();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean first() throws SQLException {
+        try {
+            return jdbcResultSet.first();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean last() throws SQLException {
+        try {
+            return jdbcResultSet.last();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean absolute(int row) throws SQLException {
+        try {
+            return jdbcResultSet.absolute(row);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean relative(int row) throws SQLException {
+        try {
+            return jdbcResultSet.relative(row);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean previous() throws SQLException {
+        try {
+            return jdbcResultSet.previous();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public Object getStatement() throws SQLException {
+        return statement;
+    }
+    
+    @Override
+    public boolean rowDeleted() throws SQLException {
+        try {
+            return jdbcResultSet.rowDeleted();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean rowInserted() throws SQLException {
+        try {
+            return jdbcResultSet.rowInserted();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean rowUpdated() throws SQLException {
+        try {
+            return jdbcResultSet.rowUpdated();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean isBeforeFirst() throws SQLException {
+        try {
+            return jdbcResultSet.isBeforeFirst();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean next() throws SQLException {
+        try {
+            return jdbcResultSet.next();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public boolean wasNull() throws SQLException {
+        try {
+            return jdbcResultSet.wasNull();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void clearWarnings() throws SQLException {
+        try {
+            jdbcResultSet.clearWarnings();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public Object getWarnings() throws SQLException {
+        try {
+            java.sql.SQLWarning javaWarning = jdbcResultSet.getWarnings();
+            if (javaWarning != null) {
+                java.lang.Throwable nextException = javaWarning.getCause();
+                SQLWarning warning = new SQLWarning(javaWarning.getMessage());
+                warning.Context = this;
+                warning.SQLState = javaWarning.getSQLState();
+                warning.ErrorCode = javaWarning.getErrorCode();
+                warning.NextException = nextException != null ? 
Tools.toUnoException(this, nextException) : Any.VOID;
+                return warning;
+            }
+            return Any.VOID;
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    @Override
+    public void insertRow() throws SQLException {
+        try {
+            jdbcResultSet.insertRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }        
+    }
+    
+    @Override
+    public void updateRow() throws SQLException {
+        try {
+            jdbcResultSet.updateRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void deleteRow() throws SQLException {
+        try {
+            jdbcResultSet.deleteRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void cancelRowUpdates() throws SQLException {
+        try {
+            jdbcResultSet.cancelRowUpdates();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void moveToInsertRow() throws SQLException {
+        try {
+            jdbcResultSet.moveToInsertRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void moveToCurrentRow() throws SQLException {
+        try {
+            jdbcResultSet.moveToCurrentRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateNull(int columnIndex) throws SQLException {
+        try {
+            jdbcResultSet.updateNull(columnIndex);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+        try {
+            jdbcResultSet.updateBoolean(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+        try {
+            jdbcResultSet.updateByte(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateShort(int columnIndex, short x) throws SQLException {
+        try {
+            jdbcResultSet.updateShort(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateInt(int columnIndex, int x) throws SQLException {
+        try {
+            jdbcResultSet.updateInt(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateLong(int columnIndex, long x) throws SQLException {
+        try {
+            jdbcResultSet.updateLong(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+        try {
+            jdbcResultSet.updateFloat(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+        try {
+            jdbcResultSet.updateDouble(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateString(int columnIndex, String x) throws SQLException {
+        try {
+            jdbcResultSet.updateString(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+        try {
+            jdbcResultSet.updateBytes(columnIndex, x);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+        try {
+            jdbcResultSet.updateDate(columnIndex, 
java.sql.Date.valueOf(DBTypeConversion.toDateString(x)));
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+        try {
+            jdbcResultSet.updateTime(columnIndex, 
java.sql.Time.valueOf(DBTypeConversion.toTimeString(x)));
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateTimestamp(int columnIndex, DateTime x) throws 
SQLException {
+        try {
+            jdbcResultSet.updateTimestamp(columnIndex,
+                    
java.sql.Timestamp.valueOf(DBTypeConversion.toDateTimeString(x)));
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateBinaryStream(int columnIndex, XInputStream x, int 
length) throws SQLException {
+        try {
+            jdbcResultSet.updateBinaryStream(columnIndex,
+                    new BoundedInputStream(new 
XInputStreamToInputStreamAdapter(x), length & 0xffff_ffffL), length);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    @Override
+    public void updateCharacterStream(int columnIndex, XInputStream x, int 
length) throws SQLException {
+        try {
+            // FIXME: charset?
+            jdbcResultSet.updateCharacterStream(columnIndex, new 
InputStreamReader(
+                    new BoundedInputStream(new 
XInputStreamToInputStreamAdapter(x), length & 0xffff_ffffL),
+                    Charset.forName("UTF16-LE")), length);
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }        
+    }
+    
+    @Override
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+        if (!DbTools.updateObject(this, columnIndex, x)) {
+            String error = 
SharedResources.getInstance().getResourceStringWithSubstitution(
+                    Resources.STR_UNKNOWN_COLUMN_TYPE, "$position$", 
Integer.toString(columnIndex));
+            throw new SQLException(error, this, 
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, Any.VOID);
+        }
+    }
+    
+    @Override
+    public void updateNumericObject(int columnIndex, Object x, int scale) 
throws SQLException {
+        try {
+            BigDecimal bigDecimal;
+            if (AnyConverter.isDouble(x)) {
+                bigDecimal = BigDecimal.valueOf(AnyConverter.toDouble(x));
+            } else {
+                bigDecimal = new BigDecimal(AnyConverter.toString(x));
+            }
+            jdbcResultSet.updateObject(columnIndex, bigDecimal, scale);
+        } catch (IllegalArgumentException | java.sql.SQLException exception) {
+            updateObject(columnIndex, x);
+        }
+    }
+    
+    @Override
+    public void refreshRow() throws SQLException {
+        try {
+            jdbcResultSet.refreshRow();
+        } catch (java.sql.SQLException exception) {
+            throw Tools.toUnoException(this, exception);
+        }
+    }
+    
+    
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSetMetaData.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSetMetaData.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSetMetaData.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSetMetaData.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,232 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.comp.sdbc;
+
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSetMetaData;
+
+public class JavaSQLResultSetMetaData extends WeakBase implements 
XResultSetMetaData {
+    private JavaSQLConnection connection;
+    private java.sql.ResultSetMetaData jdbcResultSetMetaData;
+    private int columnCount;
+    
+    public JavaSQLResultSetMetaData(JavaSQLConnection connection, 
java.sql.ResultSetMetaData jdbcResultSetMetaData) {
+        this.connection = connection;
+        this.jdbcResultSetMetaData = jdbcResultSetMetaData;
+        columnCount = -1;
+    }
+    
+    @Override
+    public int getColumnDisplaySize(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getColumnDisplaySize(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public int getColumnType(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getColumnType(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public int getColumnCount() throws SQLException {
+        try {
+            if (columnCount == -1) {
+                columnCount = jdbcResultSetMetaData.getColumnCount();
+            }
+            return columnCount;
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isCaseSensitive(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isCaseSensitive(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getSchemaName(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getSchemaName(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getColumnName(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getColumnName(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getTableName(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getTableName(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getCatalogName(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getCatalogName(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getColumnTypeName(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getColumnTypeName(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getColumnLabel(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getColumnLabel(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public String getColumnServiceName(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getColumnClassName(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isCurrency(int column) throws SQLException {
+        try {
+            if (connection.isIgnoreCurrencyEnabled()) {
+                return false;
+            }
+            return jdbcResultSetMetaData.isCurrency(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isAutoIncrement(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isAutoIncrement(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isSigned(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isSigned(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public int getPrecision(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getPrecision(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public int getScale(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.getScale(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public int isNullable(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isNullable(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isSearchable(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isSearchable(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isReadOnly(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isReadOnly(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isDefinitelyWritable(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isDefinitelyWritable(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+    
+    @Override
+    public boolean isWritable(int column) throws SQLException {
+        try {
+            return jdbcResultSetMetaData.isWritable(column);
+        } catch (java.sql.SQLException jdbcSQLException) {
+            throw Tools.toUnoException(this, jdbcSQLException);
+        }
+    }
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLResultSetMetaData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatement.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatement.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatement.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatement.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,161 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.comp.sdbc;
+
+import org.apache.openoffice.comp.sdbc.dbtools.util.Resources;
+
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.logging.LogLevel;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XBatchExecution;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XStatement;
+
+public class JavaSQLStatement extends JavaSQLStatementBase
+        implements XStatement, XServiceInfo, XBatchExecution {
+    
+    private static final String[] services = {
+            "com.sun.star.sdbc.Statement"
+    };
+    
+    public JavaSQLStatement(JavaSQLConnection connection) {
+        super(connection);
+    }
+    
+    // XServiceInfo
+    
+    @Override
+    public String getImplementationName() {
+        return "com.sun.star.sdbcx.JStatement";
+    }
+    
+    @Override
+    public String[] getSupportedServiceNames() {
+        return services.clone();
+    }
+    
+    @Override
+    public boolean supportsService(String serviceName) {
+        for (String service : services) {
+            if (service.equals(serviceName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    // XBatchExecution
+    
+    public synchronized void addBatch(String sql) throws SQLException {
+        createStatement();
+        try {
+            jdbcStatement.addBatch(sql);
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    @Override
+    public void clearBatch() throws SQLException {
+        createStatement();
+        try {
+            jdbcStatement.clearBatch();
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    @Override
+    public synchronized int[] executeBatch() throws SQLException {
+        createStatement();
+        try {
+            return jdbcStatement.executeBatch();
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    // XStatement
+    
+    public synchronized boolean execute(String sql) throws SQLException {
+        createStatement();
+        sqlStatement = sql;
+        try (ContextClassLoaderScope ccl = new 
ContextClassLoaderScope(connection.getDriverClassLoader())) {
+            return jdbcStatement.execute(sql);
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoExceptionLogged(this, logger, sqlException);
+        }
+    }
+    
+    @Override
+    public synchronized XResultSet executeQuery(String sql) throws 
SQLException {
+        logger.log(LogLevel.FINE, Resources.STR_LOG_EXECUTE_QUERY, sql);
+        createStatement();
+        sqlStatement = sql;
+        try (ContextClassLoaderScope ccl = new 
ContextClassLoaderScope(connection.getDriverClassLoader())) {
+            java.sql.ResultSet jdbcResultSet = jdbcStatement.executeQuery(sql);
+            if (jdbcResultSet != null) {
+                return new JavaSQLResultSet(jdbcResultSet, connection, this);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoExceptionLogged(this, logger, sqlException);
+        }
+    }
+    
+    @Override
+    public synchronized int executeUpdate(String sql) throws SQLException {
+        createStatement();
+        logger.log(LogLevel.FINE, Resources.STR_LOG_EXECUTE_UPDATE, sql);
+        sqlStatement = sql;
+        // FIXME: why didn't the C++ implementation do this in a 
ContextClassLoaderScope?
+        try {
+            return jdbcStatement.executeUpdate(sql);
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoExceptionLogged(this, logger, sqlException);
+        }
+    }
+    
+    @Override
+    public synchronized XConnection getConnection() throws SQLException {
+        checkDisposed();
+        return connection;
+    }
+    
+    // others
+    
+    protected synchronized void createStatement() throws SQLException {
+        checkDisposed();
+        if (jdbcStatement == null) {
+            try {
+                try {
+                    jdbcStatement = 
connection.getJDBCConnection().createStatement(resultSetType, 
resultSetConcurrency);
+                } catch (NoSuchMethodError noSuchMethodError) {
+                    jdbcStatement = 
connection.getJDBCConnection().createStatement();
+                }
+            } catch (java.sql.SQLException sqlException) {
+                throw Tools.toUnoExceptionLogged(this, logger, sqlException);
+            }
+        }
+    }
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatementBase.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatementBase.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatementBase.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatementBase.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,515 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.comp.sdbc;
+
+import org.apache.openoffice.comp.sdbc.dbtools.comphelper.CompHelper;
+import org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySet;
+import 
org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySetAdapter.PropertyGetter;
+import 
org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySetAdapter.PropertySetter;
+import org.apache.openoffice.comp.sdbc.dbtools.util.PropertyIds;
+import org.apache.openoffice.comp.sdbc.dbtools.util.Resources;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.comp.sdbc.ConnectionLog.ObjectType;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.logging.LogLevel;
+import com.sun.star.sdbc.ResultSetConcurrency;
+import com.sun.star.sdbc.ResultSetType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.SQLWarning;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XGeneratedResultSet;
+import com.sun.star.sdbc.XMultipleResults;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Type;
+import com.sun.star.util.XCancellable;
+
+public abstract class JavaSQLStatementBase extends PropertySet
+        implements XGeneratedResultSet, XMultipleResults, XCloseable, 
XCancellable, XWarningsSupplier {
+
+    protected JavaSQLConnection connection;
+    protected ConnectionLog logger;
+    protected java.sql.Statement jdbcStatement;
+    protected boolean escapeProcessing = true;
+    protected int resultSetType = ResultSetType.FORWARD_ONLY;
+    protected int resultSetConcurrency = ResultSetConcurrency.READ_ONLY;
+    protected String sqlStatement = "";
+    protected XStatement generatedStatement;
+    
+    public JavaSQLStatementBase(JavaSQLConnection connection) {
+        this.connection = connection;
+        this.logger = new ConnectionLog(connection.getLogger(), 
ObjectType.STATEMENT);
+        registerProperties();
+    }
+    
+    public int getStatementObjectId() {
+        return logger.getObjectId();
+    }
+    
+    // XComponent
+    
+    @Override
+    protected synchronized void postDisposing() {
+        super.postDisposing();
+        logger.log(LogLevel.FINE, Resources.STR_LOG_CLOSING_STATEMENT);
+        if (jdbcStatement != null) {
+            try {
+                jdbcStatement.close();
+            } catch (java.sql.SQLException sqlException) {
+                logger.log(LogLevel.WARNING, sqlException);
+            }
+        }
+        CompHelper.disposeComponent(generatedStatement);
+    }
+    
+    protected abstract void createStatement() throws SQLException;
+    
+    // XPropertySet 
+    
+    private void registerProperties() {
+        registerProperty(PropertyIds.CURSORNAME.name, 
PropertyIds.CURSORNAME.id, Type.STRING, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getCursorName();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setCursorName((String)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.ESCAPEPROCESSING.name, 
PropertyIds.ESCAPEPROCESSING.id, Type.BOOLEAN, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getEscapeProcessing();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setEscapeProcessing((boolean)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.FETCHDIRECTION.name, 
PropertyIds.FETCHDIRECTION.id, Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getFetchDirection();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setFetchDirection((int)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.FETCHSIZE.name, PropertyIds.FETCHSIZE.id, 
Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getFetchSize();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setFetchSize((int)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.MAXFIELDSIZE.name, 
PropertyIds.MAXFIELDSIZE.id, Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getMaxFieldSize();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setMaxFieldSize((int)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.MAXROWS.name, PropertyIds.MAXROWS.id, 
Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getMaxRows();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setMaxRows((int)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.QUERYTIMEOUT.name, 
PropertyIds.QUERYTIMEOUT.id, Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getQueryTimeOut();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
WrappedTargetException{
+                        setQueryTimeOut((int)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.RESULTSETCONCURRENCY.name, 
PropertyIds.RESULTSETCONCURRENCY.id, Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getResultSetConcurrency();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setResultSetConcurrency((int)value);
+                    }
+                }
+        );
+        registerProperty(PropertyIds.RESULTSETTYPE.name, 
PropertyIds.RESULTSETTYPE.id, Type.LONG, (short)0,
+                new PropertyGetter() {
+                    @Override
+                    public Object getValue() throws WrappedTargetException {
+                        return getResultSetType();
+                    }
+                },
+                new PropertySetter() {
+                    @Override
+                    public void setValue(Object value) throws 
PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+                        setResultSetType((int)value);
+                    }
+                }
+        );
+    }
+    
+    private String getCursorName() throws WrappedTargetException {
+        try {
+            createStatement();
+            // FIXME: C++'s jdbcStatement.getCursorName() doesn't exist in 
JDBC. We always return a blank string.
+            return "";
+        } catch (SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private synchronized void setCursorName(String value) throws 
WrappedTargetException {
+        try {
+            createStatement();
+            jdbcStatement.setCursorName(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private boolean getEscapeProcessing() throws WrappedTargetException {
+        try {
+            createStatement();
+            return escapeProcessing;
+        } catch (SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private synchronized void setEscapeProcessing(boolean value) throws 
WrappedTargetException {
+        escapeProcessing = value;
+        try {
+            createStatement();
+            logger.log(LogLevel.FINE, Resources.STR_LOG_SET_ESCAPE_PROCESSING, 
value);
+            jdbcStatement.setEscapeProcessing(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private int getFetchDirection() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getFetchDirection();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private synchronized void setFetchDirection(int value) throws 
WrappedTargetException {
+        try {
+            createStatement();
+            logger.log(LogLevel.FINER, Resources.STR_LOG_FETCH_DIRECTION, 
value);
+            jdbcStatement.setFetchDirection(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private int getFetchSize() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getFetchSize();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private synchronized void setFetchSize(int value) throws 
WrappedTargetException {
+        try {
+            createStatement();
+            logger.log(LogLevel.FINER, Resources.STR_LOG_FETCH_SIZE, value);
+            jdbcStatement.setFetchSize(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private int getMaxFieldSize() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getMaxFieldSize();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private synchronized void setMaxFieldSize(int value) throws 
WrappedTargetException {
+        try {
+            createStatement();
+            jdbcStatement.setMaxFieldSize(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+    
+    private int getMaxRows() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getMaxRows();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private synchronized void setMaxRows(int value) throws 
WrappedTargetException {
+        try {
+            createStatement();
+            jdbcStatement.setMaxRows(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private int getQueryTimeOut() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getQueryTimeout();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+    
+    private synchronized void setQueryTimeOut(int value) throws 
WrappedTargetException {
+        try {
+            createStatement();
+            jdbcStatement.setQueryTimeout(value);
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+
+    private int getResultSetConcurrency() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getResultSetConcurrency();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+    
+    private synchronized void setResultSetConcurrency(int value) throws 
WrappedTargetException {
+        checkDisposed();
+        try {
+            logger.log(LogLevel.FINE, 
Resources.STR_LOG_RESULT_SET_CONCURRENCY, value);
+            resultSetConcurrency = value;
+            jdbcStatement.close();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        } finally {
+            jdbcStatement = null;
+        }
+    }
+
+    private int getResultSetType() throws WrappedTargetException {
+        try {
+            createStatement();
+            return jdbcStatement.getResultSetType();
+        } catch (java.sql.SQLException | SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        }
+    }
+    
+    private synchronized void setResultSetType(int value) throws 
WrappedTargetException {
+        checkDisposed();
+        try {
+            logger.log(LogLevel.FINE, Resources.STR_LOG_RESULT_SET_TYPE, 
value);
+            resultSetType = value;
+            jdbcStatement.close();
+        } catch (java.sql.SQLException exception) {
+            throw new WrappedTargetException("SQL error", this, 
Tools.toUnoException(this, exception));
+        } finally {
+            jdbcStatement = null;
+        }
+    }
+
+    // XCancellable
+    
+    @Override
+    public void cancel() {
+        try {
+            createStatement();
+            jdbcStatement.cancel();
+        } catch (SQLException sqlException) {
+            logger.log(LogLevel.SEVERE, sqlException);
+        } catch (java.sql.SQLException jdbcException) {
+            logger.log(LogLevel.SEVERE, jdbcException);
+        }
+    }
+    
+    // XCloseable
+    
+    @Override
+    public synchronized void close() throws SQLException {
+        checkDisposed();
+        dispose();
+    }
+    
+    // XWarningsSupplier
+    
+    @Override
+    public synchronized void clearWarnings() throws SQLException {
+        try {
+            createStatement();
+            jdbcStatement.clearWarnings();
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    @Override
+    public synchronized Object getWarnings() throws SQLException {
+        try {
+            createStatement();
+            java.sql.SQLWarning javaWarning = jdbcStatement.getWarnings();
+            if (javaWarning != null) {
+                java.lang.Throwable nextException = javaWarning.getCause();
+                SQLWarning warning = new SQLWarning(javaWarning.getMessage());
+                warning.Context = this;
+                warning.SQLState = javaWarning.getSQLState();
+                warning.ErrorCode = javaWarning.getErrorCode();
+                warning.NextException = nextException != null ? 
Tools.toUnoException(this, nextException) : Any.VOID;
+                return warning;
+            }
+            return Any.VOID;
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    // XGeneratedResultSet
+    
+    public synchronized com.sun.star.sdbc.XResultSet getGeneratedValues() 
throws SQLException {
+        logger.log(LogLevel.FINE, Resources.STR_LOG_GENERATED_VALUES);
+        createStatement();
+        java.sql.ResultSet jdbcResultSet = null;
+        try {
+            jdbcResultSet = jdbcStatement.getGeneratedKeys();
+        } catch (java.sql.SQLException jdbcException) {
+        }
+        
+        XResultSet resultSet = null;
+        if (jdbcResultSet != null) {
+            resultSet = new JavaSQLResultSet(jdbcResultSet, connection, this);
+        } else {
+            if (connection != null && connection.isAutoRetrievingEnabled()) {
+                String statement = 
connection.getTransformedGeneratedStatement(sqlStatement);
+                if (!statement.isEmpty()) {
+                    logger.log(LogLevel.FINER, 
Resources.STR_LOG_GENERATED_VALUES_FALLBACK, statement);
+                    CompHelper.disposeComponent(generatedStatement);
+                    generatedStatement = connection.createStatement();
+                    resultSet = generatedStatement.executeQuery(statement);
+                }
+            }
+        }
+        return resultSet;
+    }
+    
+    // XMultipleResults
+    
+    @Override
+    public boolean getMoreResults() throws SQLException {
+        try {
+            createStatement();
+            return jdbcStatement.getMoreResults();
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    @Override
+    public XResultSet getResultSet() throws SQLException {
+        try {
+            createStatement();
+            java.sql.ResultSet jdbcResultSet = jdbcStatement.getResultSet();
+            if (jdbcResultSet != null) {
+                return new JavaSQLResultSet(jdbcResultSet, connection, this);
+            } else {
+                return null;
+            }
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+    
+    @Override
+    public int getUpdateCount() throws SQLException {
+        try {
+            createStatement();
+            int count = jdbcStatement.getUpdateCount();
+            logger.log(LogLevel.FINER, Resources.STR_LOG_UPDATE_COUNT, count);
+            return count;
+        } catch (java.sql.SQLException sqlException) {
+            throw Tools.toUnoException(this, sqlException);
+        }
+    }
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/JavaSQLStatementBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/ReaderInputStream.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/ReaderInputStream.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/ReaderInputStream.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/ReaderInputStream.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,84 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.comp.sdbc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+public class ReaderInputStream extends InputStream {
+    private Reader reader;
+    private int nextByte = -1;
+    
+    public ReaderInputStream(Reader reader) {
+        this.reader = reader;
+    }
+
+    @Override
+    public void close() throws IOException {
+        reader.close();
+    }
+    
+    @Override
+    public int read() throws IOException {
+        if (nextByte >= 0) {
+            int currentByte = nextByte;
+            nextByte = -1;
+            return currentByte;
+        } else {
+            int c = reader.read();
+            if (c < 0) {
+                return c;
+            }
+            nextByte = (byte) ((c >>> 8) & 0xff);
+            return c & 0xff;
+        }
+    }
+    
+    
+    @Override
+    public int read(byte[] b, int off, int len) throws IOException {
+        if ((off < 0) || (len < 0) || (off + len > b.length)) {
+            throw new IndexOutOfBoundsException();
+        } else if (len == 0) {
+            return 0;
+        } else if (len == 1) {
+            int next = read();
+            if (next < 0) {
+                return next;
+            }
+            b[off] = (byte) next;
+            return 1;
+        } else {
+            int charCount = len / 2;
+            char[] chars = new char[charCount];
+            int charsRead = reader.read(chars);
+            if (charsRead < 0) {
+                return charsRead;
+            }
+            int byteLength = len & ~1;
+            for (int i = 0; i < byteLength; i++) {
+                b[off + i] = (byte)(chars[i/2] >>> (8*(i&1)));
+            }
+            return byteLength;
+        }
+    }
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/ReaderInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/Tools.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/Tools.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/Tools.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/Tools.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.comp.sdbc;
+
+import 
org.apache.openoffice.comp.sdbc.dbtools.comphelper.ResourceBasedEventLogger;
+import org.apache.openoffice.comp.sdbc.dbtools.util.StandardSQLState;
+
+import com.sun.star.logging.LogLevel;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.Any;
+
+public class Tools {
+    public static SQLException toUnoException(Object source, Throwable 
throwable) {
+        // FIXME: use SQLException.getNextException() instead of getCause()?
+        // There are up to 3 dimensions of exception chaining of warnings in 
Java,
+        // getCause(), getNextException(), and getNextWarning().
+        // The C++ implementation used getNextException() only,
+        // but I am using the widely used and more helpful getCause().
+        Throwable cause = throwable.getCause();
+        Object unoCause = Any.VOID;
+        if (cause != null) {
+            unoCause = toUnoException(source, throwable);
+        }
+        if (throwable instanceof SQLException) {
+            return (SQLException)throwable;
+        } else if (throwable instanceof java.sql.SQLException) {
+            java.sql.SQLException sqlException = (java.sql.SQLException) 
throwable;
+            return new SQLException(sqlException.getMessage(), source,
+                    sqlException.getSQLState(), sqlException.getErrorCode(), 
unoCause);
+        } else if (throwable instanceof com.sun.star.uno.Exception) {
+            // General UNO exception. Wrap in an SQLException and rethrow:
+            com.sun.star.uno.Exception exception = 
(com.sun.star.uno.Exception) throwable;
+            return new SQLException(exception.getMessage(), source, 
StandardSQLState.SQL_GENERAL_ERROR.text(),
+                    0, exception);
+        } else {
+            // General Java exception. We can't pass this to UNO, so convert 
it to an UNO SQLException:
+            String message = throwable.getMessage();
+            if (message.isEmpty()) {
+                message = throwable.getLocalizedMessage();
+            }
+            if (message.isEmpty()) {
+                message = throwable.toString();
+            }
+            return new SQLException(message, source, "", -1, unoCause);
+        }
+    }
+    
+    public static SQLException toUnoExceptionLogged(Object source, 
ResourceBasedEventLogger logger, Throwable throwable) {
+        
+        SQLException exception = toUnoException(source, throwable);
+        logger.log(LogLevel.SEVERE, exception);
+        return exception;
+    }
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_jdbc/src/com/sun/star/comp/sdbc/Tools.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetaDataResultSet.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetaDataResultSet.java?rev=1814552&view=auto
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetaDataResultSet.java
 (added)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetaDataResultSet.java
 Wed Nov  8 04:17:25 2017
@@ -0,0 +1,46 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.ArrayList;
+
+import org.apache.openoffice.comp.sdbc.dbtools.util.DatabaseMetaDataResultSet;
+import org.apache.openoffice.comp.sdbc.dbtools.util.ORowSetValue;
+
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetMetaData;
+import com.sun.star.sdbc.XResultSetMetaDataSupplier;
+import com.sun.star.uno.UnoRuntime;
+
+public class PostgresqlDatabaseMetaDataResultSet extends 
DatabaseMetaDataResultSet {
+    private XResultSetMetaDataSupplier resultSetMetaDataSupplier;
+    
+    public PostgresqlDatabaseMetaDataResultSet(XResultSet resultSet, 
ArrayList<ORowSetValue[]> rows) {
+        super(resultSet, rows);
+        this.resultSetMetaDataSupplier = 
UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, resultSet);
+    }
+
+    @Override
+    public synchronized XResultSetMetaData getMetaData() throws SQLException {
+        return new 
PostgresqlResultSetMetaData(resultSetMetaDataSupplier.getMetaData());
+    }
+}

Propchange: 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetaDataResultSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java?rev=1814552&r1=1814551&r2=1814552&view=diff
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
 (original)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
 Wed Nov  8 04:17:25 2017
@@ -140,7 +140,7 @@ public class PostgresqlDatabaseMetadata
             rowOut[17] = new ORowSetValue(isNullable);
             table.add(rowOut);
         }
-        return new DatabaseMetaDataResultSet(results, table);
+        return new PostgresqlDatabaseMetaDataResultSet(results, table);
     }
 
     public XConnection getConnection() throws SQLException {
@@ -399,7 +399,7 @@ public class PostgresqlDatabaseMetadata
             table.add(rowOut);
             //System.out.println(String.format("type %s, data type %d, SQL 
type %d, precision %d, createParams %s", typeName, dataType, sqlDataType, 
precision, createParams));
         }
-        return new DatabaseMetaDataResultSet(results, table);
+        return new PostgresqlDatabaseMetaDataResultSet(results, table);
     }
 
     public XResultSet getUDTs(Object arg0, String arg1, String arg2, int[] 
arg3) throws SQLException {

Modified: 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlViews.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlViews.java?rev=1814552&r1=1814551&r2=1814552&view=diff
==============================================================================
--- 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlViews.java
 (original)
+++ 
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlViews.java
 Wed Nov  8 04:17:25 2017
@@ -61,7 +61,7 @@ public class PostgresqlViews extends OCo
     protected XPropertySet createObject(String name) throws SQLException {
         NameComponents nameComponents = 
DbTools.qualifiedNameComponents(metadata, name, ComposeRule.InDataManipulation);
         
-        String sql = "SELECT view_definition,check_option FROM 
INFORMATION_SCHEMA.views WHERE ";
+        String sql = "SELECT view_definition,check_option FROM 
information_schema.views WHERE ";
         if (!nameComponents.getCatalog().isEmpty()) {
             sql += "table_catalog=? AND ";
         }

Modified: openoffice/trunk/main/connectivity/prj/build.lst
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/prj/build.lst?rev=1814552&r1=1814551&r2=1814552&view=diff
==============================================================================
--- openoffice/trunk/main/connectivity/prj/build.lst (original)
+++ openoffice/trunk/main/connectivity/prj/build.lst Wed Nov  8 04:17:25 2017
@@ -2,6 +2,7 @@ cn  connectivity    :    shell  L10N:l10
 cn  connectivity                                    usr1    -   all cn_mkout 
NULL
 cn  connectivity\inc                                nmake   -   all cn_inc NULL
 cn  connectivity\java\dbtools                       nmake   -   all 
cn_jdbtools cn_inc NULL
+cn  connectivity\java\sdbc_jdbc                     nmake   -   all cn_jdbc 
cn_jdbtools cn_inc NULL
 cn  connectivity\java\sdbc_hsqldb                   nmake   -   all 
cn_jhsqldbdb cn_hsqldb cn_jdbtools cn_inc NULL
 cn  connectivity\java\sdbc_postgresql               nmake   -   all 
cn_postgresqldb cn_dbtools cn_jdbtools cn_inc NULL
 cn  connectivity\source\commontools                 nmake   -   all cn_cmtools 
cn_parse cn_inc NULL
@@ -16,7 +17,6 @@ cn  connectivity\source\drivers\calc
 cn  connectivity\source\drivers\odbcbase            nmake   -   all 
cn_odbcbase cn_dbtools cn_inc NULL
 cn  connectivity\source\drivers\odbc                nmake   -   all cn_odbc 
cn_odbcbase cn_inc NULL
 cn  connectivity\source\drivers\mysql               nmake   -   all cn_mysql 
cn_dbtools cn_inc NULL
-cn  connectivity\source\drivers\jdbc                nmake   -   all cn_jdbc 
cn_dbtools cn_inc NULL
 cn  connectivity\source\drivers\adabas              nmake   -   all cn_adabas 
cn_dbtools cn_odbcbase cn_inc NULL
 cn  connectivity\source\drivers\file                nmake   -   all cn_file 
cn_dbtools cn_inc NULL
 cn  connectivity\source\drivers\flat                nmake   -   all cn_flat 
cn_dbtools cn_file cn_inc NULL

Modified: openoffice/trunk/main/connectivity/prj/d.lst
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/prj/d.lst?rev=1814552&r1=1814551&r2=1814552&view=diff
==============================================================================
--- openoffice/trunk/main/connectivity/prj/d.lst (original)
+++ openoffice/trunk/main/connectivity/prj/d.lst Wed Nov  8 04:17:25 2017
@@ -14,7 +14,6 @@
 ..\source\drivers\file\*.xml %_DEST%\xml%_EXT%\*.xml
 ..\source\drivers\flat\*.xml %_DEST%\xml%_EXT%\*.xml
 ..\source\drivers\dbase\*.xml %_DEST%\xml%_EXT%\*.xml
-..\source\drivers\jdbc\*.xml %_DEST%\xml%_EXT%\*.xml
 ..\source\drivers\odbc\*.xml %_DEST%\xml%_EXT%\*.xml
 ..\source\drivers\evoab2\*.xml %_DEST%\xml%_EXT%\*.xml
 ..\source\drivers\calc\*.xml %_DEST%\xml%_EXT%\*.xml
@@ -22,6 +21,7 @@
 ..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
 ..\%__SRC%\class\dbtools\*.jar %_DEST%\bin%_EXT%\*.jar
 ..\%__SRC%\class\sdbc_hsqldb\*.jar %_DEST%\bin%_EXT%\*.jar
+..\%__SRC%\class\sdbc_jdbc\*.jar %_DEST%\bin%_EXT%\*.jar
 ..\%__SRC%\class\sdbc_postgresql\*.jar %_DEST%\bin%_EXT%\*.jar
 
 mkdir: %_DEST%\inc%_EXT%\connectivity

Modified: openoffice/trunk/main/offapi/UnoApi_offapi.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/offapi/UnoApi_offapi.mk?rev=1814552&r1=1814551&r2=1814552&view=diff
==============================================================================
--- openoffice/trunk/main/offapi/UnoApi_offapi.mk (original)
+++ openoffice/trunk/main/offapi/UnoApi_offapi.mk Wed Nov  8 04:17:25 2017
@@ -713,6 +713,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfil
     offapi/com/sun/star/sdb/Forms \
     offapi/com/sun/star/sdb/OfficeDatabaseDocument \
     offapi/com/sun/star/sdb/OrderColumn \
+    offapi/com/sun/star/sdb/ParameterSubstitution \
     offapi/com/sun/star/sdb/PreparedStatement \
     offapi/com/sun/star/sdb/Query \
     offapi/com/sun/star/sdb/QueryDefinition \

Modified: openoffice/trunk/main/postprocess/packregistry/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/postprocess/packregistry/makefile.mk?rev=1814552&r1=1814551&r2=1814552&view=diff
==============================================================================
--- openoffice/trunk/main/postprocess/packregistry/makefile.mk (original)
+++ openoffice/trunk/main/postprocess/packregistry/makefile.mk Wed Nov  8 
04:17:25 2017
@@ -352,7 +352,7 @@ MY_FILES_main += $(MY_MOD)/DataAccess/ev
 .IF "$(SOLAR_JAVA)" == "TRUE"
 MY_FILES_main += \
     $(MY_MOD)/DataAccess/hsqldb.xcu \
-    $(MY_MOD)/DataAccess/jdbc.xcu \
+    $(MY_MOD)/DataAccess/sdbc_jdbc.xcu \
     $(MY_MOD)/DataAccess/sdbc_postgresql.xcu
 .END
 


Reply via email to