Skip to content

Commit

Permalink
Fixed issue #3553
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Feb 12, 2015
1 parent d660396 commit 7d60c82
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 57 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -23,7 +23,7 @@
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-jdbc</artifactId>
<packaging>jar</packaging>
<version>2.1-SNAPSHOT</version>
<version>2.0.3-SNAPSHOT</version>
<description>JDBC Driver for OrientDB NoSQL document graph dbms</description>
<url>http://www.orientechnologies.com</url>
<inceptionYear>2012</inceptionYear>
Expand Down
Expand Up @@ -17,38 +17,24 @@
*/
package com.orientechnologies.orient.jdbc;

import com.orientechnologies.orient.core.exception.OQueryParsingException;
import com.orientechnologies.orient.core.query.OQuery;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLSyntaxErrorException;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.orientechnologies.orient.core.exception.OQueryParsingException;
import com.orientechnologies.orient.core.query.OQuery;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;

/**
*
* @author Roberto Franchini (CELI Srl - franchini@celi.it)
Expand Down Expand Up @@ -86,12 +72,17 @@ public ResultSet executeQuery() throws SQLException {
}

public int executeUpdate() throws SQLException {
try {
query = new OCommandSQL(sql);
return database.command(query).execute(params.values().toArray());
} catch (OQueryParsingException e) {
throw new SQLSyntaxErrorException("Error on parsing the command", e);
}
query = new OCommandSQL(sql);
rawResult = database.command(query).execute(params.values().toArray());

if (rawResult instanceof ODocument)
return 1;
else if (rawResult instanceof Integer)
return (Integer) rawResult;
else if (rawResult instanceof Collection)
return ((Collection) rawResult).size();

return 0;
}

public void setNull(int parameterIndex, int sqlType) throws SQLException {
Expand Down
Expand Up @@ -31,6 +31,7 @@
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static java.util.Collections.emptyList;
Expand Down Expand Up @@ -142,22 +143,21 @@ public int executeUpdate(final String sql) throws SQLException {
return 1;
else if (rawResult instanceof Integer)
return (Integer) rawResult;
else
return 0;
else if (rawResult instanceof Collection)
return ((Collection) rawResult ).size();

return 0;
}

public int executeUpdate(final String sql, int autoGeneratedKeys) throws SQLException {

return 0;
}

public int executeUpdate(final String sql, int[] columnIndexes) throws SQLException {

return 0;
}

public int executeUpdate(final String sql, String[] columnNames) throws SQLException {

return 0;
}

Expand Down Expand Up @@ -210,11 +210,19 @@ public int getFetchDirection() throws SQLException {
return 0;
}

public void setFetchDirection(final int direction) throws SQLException {

}

public int getFetchSize() throws SQLException {

return 0;
}

public void setFetchSize(final int rows) throws SQLException {

}

public ResultSet getGeneratedKeys() throws SQLException {

return null;
Expand All @@ -225,11 +233,19 @@ public int getMaxFieldSize() throws SQLException {
return 0;
}

public void setMaxFieldSize(final int max) throws SQLException {

}

public int getMaxRows() throws SQLException {

return 0;
}

public void setMaxRows(final int max) throws SQLException {

}

public boolean getMoreResults() throws SQLException {

return false;
Expand All @@ -245,6 +261,10 @@ public int getQueryTimeout() throws SQLException {
return 0;
}

public void setQueryTimeout(final int seconds) throws SQLException {

}

public ResultSet getResultSet() throws SQLException {

return resultSet;
Expand Down Expand Up @@ -288,35 +308,15 @@ public boolean isPoolable() throws SQLException {
return false;
}

public void setCursorName(final String name) throws SQLException {

}

public void setEscapeProcessing(final boolean enable) throws SQLException {

}

public void setFetchDirection(final int direction) throws SQLException {

}

public void setFetchSize(final int rows) throws SQLException {

}

public void setMaxFieldSize(final int max) throws SQLException {

}

public void setMaxRows(final int max) throws SQLException {
public void setPoolable(final boolean poolable) throws SQLException {

}

public void setPoolable(final boolean poolable) throws SQLException {
public void setCursorName(final String name) throws SQLException {

}

public void setQueryTimeout(final int seconds) throws SQLException {
public void setEscapeProcessing(final boolean enable) throws SQLException {

}

Expand Down

0 comments on commit 7d60c82

Please sign in to comment.