From: Viktor M. <mih...@us...> - 2005-06-03 10:32:11
|
Update of /cvsroot/sblim/sfcb/jdbc/com/ibm/wbem/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13949/jdbc/com/ibm/wbem/jdbc Added Files: CIMCallableStatement.java CIMConnection.java CIMDatabaseMetaData.java CIMDriver.java CIMPreparedStatement.java CIMResultSet.java CIMResultSetMetaData.java CIMStatement.java Log Message: Bug fixed 1214077: Added SQL Support (for JDBC). --- NEW FILE: CIMConnection.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Savepoint; import java.sql.Statement; import java.util.Map; import java.util.Properties; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMConnection implements Connection{ private BufferedReader in; private PrintWriter out; private Socket s; private String catalog; private boolean readOnly; private DatabaseMetaData dbMeta; private SQLWarning sqlWarnings; public CIMConnection(Socket s) throws IOException{ this.s = s; in = new BufferedReader(new InputStreamReader(s.getInputStream())); out = new PrintWriter(s.getOutputStream()); out.println("1 1 ");out.flush(); if(!in.readLine().equals("1 1 1")) s=null; } /* (non-Javadoc) * @see java.sql.Connection#getHoldability() */ public int getHoldability() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getHoldability()"); //return 0; } /* (non-Javadoc) * @see java.sql.Connection#getTransactionIsolation() */ public int getTransactionIsolation() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getTransactionIsolation()"); //return 0; } /* (non-Javadoc) * @see java.sql.Connection#clearWarnings() */ public void clearWarnings() throws SQLException { // TODO Auto-generated method stub sqlWarnings = null; } /* (non-Javadoc) * @see java.sql.Connection#close() */ public void close() throws SQLException { System.out.println("close()"); if(s==null) return; out.println("1 2\n");out.flush(); System.out.println("1 2 gesendet"); try { in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } out.close(); try { s.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } /* (non-Javadoc) * @see java.sql.Connection#commit() */ public void commit() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: commit()"); } /* (non-Javadoc) * @see java.sql.Connection#rollback() */ public void rollback() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: rollback()"); } /* (non-Javadoc) * @see java.sql.Connection#getAutoCommit() */ public boolean getAutoCommit() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getAutoCommit()"); //return false; } /* (non-Javadoc) * @see java.sql.Connection#isClosed() */ public boolean isClosed() throws SQLException { return s==null||s.isClosed(); } /* (non-Javadoc) * @see java.sql.Connection#isReadOnly() */ public boolean isReadOnly() throws SQLException { // TODO Auto-generated method stub return readOnly; } /* (non-Javadoc) * @see java.sql.Connection#setHoldability(int) */ public void setHoldability(int arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setHoldability()"); } /* (non-Javadoc) * @see java.sql.Connection#setTransactionIsolation(int) */ public void setTransactionIsolation(int arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setTransactionIsolation()"); } /* (non-Javadoc) * @see java.sql.Connection#setAutoCommit(boolean) */ public void setAutoCommit(boolean arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setAutoCommit()"); } /* (non-Javadoc) * @see java.sql.Connection#setReadOnly(boolean) */ public void setReadOnly(boolean arg0) throws SQLException { //sollte an die DB weitergegeben werden. Dmit auch in Selects keine Funktionen mit Seiteneffekten aufgerufen werden können readOnly = arg0; } /* (non-Javadoc) * @see java.sql.Connection#getCatalog() */ public String getCatalog() throws SQLException { return catalog; } /* (non-Javadoc) * @see java.sql.Connection#setCatalog(java.lang.String) */ public void setCatalog(String arg0) throws SQLException { catalog = arg0; } /* (non-Javadoc) * @see java.sql.Connection#getMetaData() */ public DatabaseMetaData getMetaData() throws SQLException { //diese Daten müssen einmalig erhoben werden. Allerdings //nicht im Konstruktor, da die Daten nicht bei jeder Connection //vom Client angefordert werden if(dbMeta==null){ out.println("3 1 ");out.flush(); String inString=null; try { if(in.readLine().equals("3 1 1")){ do{ inString += in.readLine(); }while(!inString.endsWith("$$")); Properties prop = new Properties(); inString = inString.substring(0,inString.length()-2); String[] s = inString.split(";"); for(int i=0; i<s.length;i++){ String[] t = s[i].split("="); prop.setProperty(t[0],t[1]); } dbMeta = new CIMDatabaseMetaData(prop,this.s,this,in,out); } else System.out.println("Fehler "); //Parameterliste empfangen //DatabaseMetaData erzeugen mit Liste als Argument. } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); throw new SQLException("IOException reading Socket"); } } return dbMeta; } /* (non-Javadoc) * @see java.sql.Connection#getWarnings() */ public SQLWarning getWarnings() throws SQLException { return sqlWarnings; } /* (non-Javadoc) * @see java.sql.Connection#setSavepoint() */ public Savepoint setSavepoint() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setSavepoint()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) */ public void releaseSavepoint(Savepoint arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: releaseSavepoint()"); } /* (non-Javadoc) * @see java.sql.Connection#rollback(java.sql.Savepoint) */ public void rollback(Savepoint arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: rollback()"); } /* (non-Javadoc) * @see java.sql.Connection#createStatement() */ public Statement createStatement() throws SQLException { return new CIMStatement(s,this); } /* (non-Javadoc) * @see java.sql.Connection#createStatement(int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { throw new SQLException("Not Implemented: createStatement(int resultSetType, int resultSetConcurrency)"); } /* (non-Javadoc) * @see java.sql.Connection#createStatement(int, int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { throw new SQLException("Not Implemented: createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)"); } /* (non-Javadoc) * @see java.sql.Connection#getTypeMap() */ public Map getTypeMap() throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: getTypeMap()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#setTypeMap(java.util.Map) */ public void setTypeMap(Map arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setTypeMap()"); } /* (non-Javadoc) * @see java.sql.Connection#nativeSQL(java.lang.String) */ public String nativeSQL(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: nativeSQL()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareCall(java.lang.String) */ public CallableStatement prepareCall(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareCall()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareCall(java.lang.String, int, int) */ public CallableStatement prepareCall(String arg0, int arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareCall()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) */ public CallableStatement prepareCall(String arg0, int arg1, int arg2, int arg3) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareCall()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String) */ public PreparedStatement prepareStatement(String sql) throws SQLException { // TODO Auto-generated method stub return new CIMPreparedStatement(s,this,sql); } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int) */ public PreparedStatement prepareStatement(String arg0, int arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) */ public PreparedStatement prepareStatement(String arg0, int arg1, int arg2) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) */ public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, int arg3) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) */ public PreparedStatement prepareStatement(String arg0, int[] arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#setSavepoint(java.lang.String) */ public Savepoint setSavepoint(String arg0) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: setSavepoint()"); //return null; } /* (non-Javadoc) * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) */ public PreparedStatement prepareStatement(String arg0, String[] arg1) throws SQLException { // TODO Auto-generated method stub throw new SQLException("Not Implemented: prepareStatement()"); //return null; } } --- NEW FILE: CIMResultSetMetaData.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Types; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMResultSetMetaData implements ResultSetMetaData { private String[][] col; private ResultSetMetaData rsmd; /** * @param prop */ public CIMResultSetMetaData(String prop) { String[] st = prop.split("::"); col = new String[st.length][]; for (int i = 0; i < col.length; i++) { col[i] = st[i].split(";"); } //für getColumnDisplaySize() } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnCount() */ public int getColumnCount() throws SQLException { return col.length; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int) */ public int getColumnDisplaySize(int column) throws SQLException { //Es wird nach der Anzahl der ZEICHEN gefragt! int indx = col[column][2].indexOf("(")>0? col[column][2].indexOf("("):col[column][2].length(); String s = col[column][2].toUpperCase().substring(0,indx); if(s.equals("BIGINT")) return -1;//Nachschlage --> CIMOM else if(s.equals("TIMESTAMP")) return -1;//Nachschlage --> CIMOM else if(s.equals("DATE")) return -1;//Nachschlage --> CIMOM else if(s.equals("VARCHAR")){ return Integer.parseInt(col[column][2].substring(col[column][2].indexOf("(")+1,col[column][2].length()-1)); } else if(s.equals("CHAR")) return -1;//Nachschlage --> CIMOM else if(s.equals("DECIMAL") || s.equals("NUMERIC") || s.equals("NUM") || s.equals("DEC")){ //das +1 muss sein, wegen des "," in der Darstellung return Integer.parseInt(col[column][2].substring(col[column][2].indexOf("(")+1,col[column][2].indexOf(",")))+1; } else if(s.equals("DOUBLE")) return -1;//Nachschlage --> CIMOM else if(s.equals("REAL")) return -1;//Nachschlage --> CIMOM else if(s.equals("INTEGER")) return -1;//Nachschlage --> CIMOM else if(s.equals("INT")) return -1;//Nachschlage --> CIMOM else if(s.equals("SMALLINT")) return -1;//Nachschlage --> CIMOM else return 0; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnType(int) */ public int getColumnType(int column) throws SQLException { int indx = col[column][2].indexOf("(")>0? col[column][2].indexOf("("):col[column][2].length(); String s = col[column][2].toUpperCase().substring(0,indx); if(s.equals("BIGINT")) return Types.BIGINT; if(s.equals("TIMESTAMP")) return Types.TIMESTAMP; if(s.equals("DATE")) return Types.DATE; if(s.equals("VARCHAR")) return Types.VARCHAR; if(s.equals("CHAR")) return Types.CHAR; if(s.equals("DECIMAL")) return Types.DECIMAL; if(s.equals("NUMERIC")) return Types.DECIMAL; if(s.equals("NUM")) return Types.DECIMAL; if(s.equals("DEC")) return Types.DECIMAL; if(s.equals("DOUBLE")) return Types.DOUBLE; if(s.equals("REAL")) return Types.REAL; if(s.equals("INTEGER")) return Types.INTEGER; if(s.equals("INT")) return Types.INTEGER; if(s.equals("SMALLINT")) return Types.SMALLINT; if(s.equals("BOOLEAN")) return Types.BOOLEAN; if(s.equals("REF")) return Types.REF; if(s.equals("OTHER")) return Types.OTHER; //System.out.println(s); throw new SQLException(); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getPrecision(int) */ public int getPrecision(int column) throws SQLException { if(getColumnType(column)==Types.DECIMAL) return Integer.parseInt(col[column][2].substring(col[column][2].indexOf("(")+1,col[column][2].indexOf(","))); return 0; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getScale(int) */ public int getScale(int column) throws SQLException { if(getColumnType(column)==Types.DECIMAL) return Integer.parseInt(col[column][2].substring(col[column][2].indexOf(",")+1,col[column][2].indexOf(")"))); return 0; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isNullable(int) */ public int isNullable(int column) throws SQLException { // TODO Auto-generated method stub return Integer.parseInt(col[column][4]); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isAutoIncrement(int) */ public boolean isAutoIncrement(int arg0) throws SQLException { return false; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isCaseSensitive(int) */ public boolean isCaseSensitive(int column) throws SQLException { return col[column][5].equalsIgnoreCase("true"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isCurrency(int) */ public boolean isCurrency(int arg0) throws SQLException { // TODO Auto-generated method stub return false; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int) */ public boolean isDefinitelyWritable(int column) throws SQLException { return col[column][3].equalsIgnoreCase("true"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isReadOnly(int) */ public boolean isReadOnly(int column) throws SQLException { return !isDefinitelyWritable(column); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isSearchable(int) */ public boolean isSearchable(int arg0) throws SQLException { return true; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isSigned(int) */ public boolean isSigned(int arg0) throws SQLException { return true; //MIT CIMOM-DT ABGLEICHEN } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#isWritable(int) */ public boolean isWritable(int column) throws SQLException { return isDefinitelyWritable(column); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getCatalogName(int) */ public String getCatalogName(int arg0) throws SQLException { throw new SQLException("Catalog not supported"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnClassName(int) */ public String getColumnClassName(int column) throws SQLException { // Synchron zu CIMResultSetMetaData.getColumnClassName() halten //System.out.println(column); switch(getColumnType(column)){ case Types.BIGINT: return "java.math.BigInteger"; case Types.TIMESTAMP: return "java.sql.Timestamp"; case Types.DATE: return "java.lang.Long"; case Types.VARCHAR: return "java.lang.String"; case Types.CHAR: return "java.lang.String"; case Types.DECIMAL: return "java.math.BigDecimal"; case Types.DOUBLE: return "java.lang.Double"; case Types.REAL: return "java.lang.Float"; case Types.INTEGER: return "java.lang.Integer"; case Types.SMALLINT: return "java.lang.Integer"; case Types.NULL: return "null"; case Types.BOOLEAN: return "java.lang.Boolean"; case Types.REF: return "java.lang.String"; case Types.OTHER: return "java.lang.String"; default: throw new SQLException(); } } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnLabel(int) */ public String getColumnLabel(int column) throws SQLException { return col[column][1]; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnName(int) */ public String getColumnName(int column) throws SQLException { return col[column][1]; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getColumnTypeName(int) */ public String getColumnTypeName(int column) throws SQLException { return col[column][2]; } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getSchemaName(int) */ public String getSchemaName(int column) throws SQLException { throw new SQLException("Schema not supported"); } /* (non-Javadoc) * @see java.sql.ResultSetMetaData#getTableName(int) */ public String getTableName(int column) throws SQLException { return col[column][0]; } } --- NEW FILE: CIMDriver.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverPropertyInfo; import java.sql.SQLException; import java.util.Properties; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMDriver implements Driver { public static final int VERSION = 0; public static final String NAME = "CIM-JDBC for sfcb"; public static final String VERSIONSTRING = "V 0.1"; /** * Driver will be registered on class loading */ static { try { java.sql.DriverManager.registerDriver(new CIMDriver()); } catch (SQLException e) { throw new RuntimeException("CIM-Driver: Can't register driver!"); } } public CIMDriver() throws SQLException{ System.out.println("Driver-Konstruktor"); } /* (non-Javadoc) * @see java.sql.Driver#getMajorVersion() */ public int getMajorVersion() { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.Driver#getMinorVersion() */ public int getMinorVersion() { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.Driver#jdbcCompliant() */ public boolean jdbcCompliant() { // TODO Auto-generated method stub return false; } /* * @see java.sql.Driver#acceptsURL(java.lang.String) * arg0: <ip-adresse>[:port] */ public boolean acceptsURL(String arg0) throws SQLException { boolean acc = false; try { Socket s = getConSocket(arg0); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter out = new PrintWriter(s.getOutputStream()); out.println("1 1 ");out.flush(); acc = in.readLine().equals("1 1 1"); out.println("1 2\n");out.flush(); in.close();out.close();s.close(); } catch (UnknownHostException e) { throw new SQLException("UnkownHost: "+arg0); } catch (IOException e) { throw new SQLException(); } catch (NumberFormatException e){ throw new SQLException("Cannot parse String to int\n"+e.toString()); } return acc; } private Socket getConSocket(String url) throws UnknownHostException, IOException, NumberFormatException{ int c, port; String addr; if((c=url.indexOf(":"))>0){ addr = url.substring(0,c); port = Integer.parseInt(url.substring(c+1,url.length())); } else{ port = 5980; addr = url; } InetAddress serveraddr = InetAddress.getByName(addr); return new Socket(serveraddr, port); } /* (non-Javadoc) * @see java.sql.Driver#connect(java.lang.String, java.util.Properties) */ public Connection connect(String arg0, Properties arg1) throws SQLException { Socket s = null; try { s = getConSocket(arg0); return new CIMConnection(s); } catch (UnknownHostException e) { throw new SQLException(); } catch (IOException e) { throw new SQLException(); } catch (NumberFormatException e){ throw new SQLException(); } } /* (non-Javadoc) * @see java.sql.Driver#getPropertyInfo(java.lang.String, java.util.Properties) */ public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1) throws SQLException { // TODO Auto-generated method stub return null; } public static void main(String[] args){ try { System.out.println((new CIMDriver().acceptsURL("127.0.0.1:5980"))); Connection con = new CIMDriver().connect("127.0.0.1:5980",null); con.getMetaData(); con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } String a = "varchar(4987)"; System.out.println(a.substring(a.indexOf("(")+1,a.length()-1)); System.out.println(a.toUpperCase().substring(0,a.indexOf("("))); a = "dec(13,2)"; System.out.println(""+(Integer.parseInt(a.substring(a.indexOf("(")+1,a.indexOf(",")))+1)); System.out.println(""+(Integer.parseInt(a.substring(a.indexOf(",")+1,a.indexOf(")"))))); } } --- NEW FILE: CIMDatabaseMetaData.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.util.Properties; [...1343 lines suppressed...] } /* (non-Javadoc) * @see java.sql.DatabaseMetaData#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) */ public ResultSet getTables(String catalog, String schemapattern, String tableNamePattern, String[] types) throws SQLException { return execute(tableNamePattern,"3 2"); } /* (non-Javadoc) * @see java.sql.DatabaseMetaData#getCrossReference(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public ResultSet getCrossReference(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5) throws SQLException { // TODO Auto-generated method stub return null; } } --- NEW FILE: CIMResultSet.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.math.BigDecimal; import java.math.BigInteger; import java.net.Socket; import java.net.URL; import java.sql.Array; [...1234 lines suppressed...] */ public Date getDate(String arg0, Calendar arg1) throws SQLException { throw new SQLException("Not Implemented: ResultSet()"); } /* (non-Javadoc) * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar) */ public Time getTime(String arg0, Calendar arg1) throws SQLException { throw new SQLException("Not Implemented: ResultSet()"); } /* (non-Javadoc) * @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar) */ public Timestamp getTimestamp(String arg0, Calendar arg1) throws SQLException { throw new SQLException("Not Implemented: ResultSet()"); } } --- NEW FILE: CIMStatement.java --- /* * Created on 16.02.2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.ibm.wbem.jdbc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; /** * @author seyrich * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class CIMStatement implements Statement { private Socket s; private BufferedReader in; private PrintWriter out; private CIMConnection con; private ResultSet rs; private SQLWarning sw; private int fetchDir; private int maxFieldSize = 0; private int maxRows = 0; private int fetchSize = 0; /** * @param s * @param connectio * @throws SQLException */ public CIMStatement(Socket s, CIMConnection con) throws SQLException { this.s = s; this.con = con; try { in = new BufferedReader(new InputStreamReader(s.getInputStream())); out = new PrintWriter(s.getOutputStream()); } catch (IOException e) { throw new SQLException(); } fetchDir = ResultSet.FETCH_FORWARD; } /** * @param s2 * @param connection */ /* (non-Javadoc) * @see java.sql.Statement#getFetchDirection() */ public int getFetchDirection() throws SQLException { return fetchDir; } /* (non-Javadoc) * @see java.sql.Statement#getFetchSize() */ public int getFetchSize() throws SQLException { return fetchSize;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getMaxFieldSize() */ public int getMaxFieldSize() throws SQLException { return maxFieldSize;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getMaxRows() */ public int getMaxRows() throws SQLException { return maxRows;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getQueryTimeout() */ public int getQueryTimeout() throws SQLException { // TODO Auto-generated method stub return 0;//no limit } /* (non-Javadoc) * @see java.sql.Statement#getResultSetConcurrency() */ public int getResultSetConcurrency() throws SQLException { return ResultSet.CONCUR_READ_ONLY; } /* (non-Javadoc) * @see java.sql.Statement#getResultSetHoldability() */ public int getResultSetHoldability() throws SQLException { throw new SQLException("Not Implemented: Statement()");//commit not spported } /* (non-Javadoc) * @see java.sql.Statement#getResultSetType() */ public int getResultSetType() throws SQLException { return ResultSet.TYPE_SCROLL_INSENSITIVE; } /* (non-Javadoc) * @see java.sql.Statement#getUpdateCount() */ public int getUpdateCount() throws SQLException { // TODO Auto-generated method stub return 0; } /* (non-Javadoc) * @see java.sql.Statement#cancel() */ public void cancel() throws SQLException { //beide muessten das unterstuetzen. jdbc und cimom!! throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.Statement#clearBatch() */ public void clearBatch() throws SQLException { throw new SQLException("Not Implemented: PreparedStatement()"); } /* (non-Javadoc) * @see java.sql.Statement#clearWarnings() */ public void clearWarnings() throws SQLException { // nothing to do... } /* (non-Javadoc) * @see java.sql.Statement#close() */ public void close() throws SQLException { //Pipe darf nicht closed werden, sonst ist der ganze Socket tot! rs = null; sw = null; } /* (non-Javadoc) * @see java.sql.Statement#getMoreResults() */ public boolean getMoreResults() throws SQLException... [truncated message content] |