Java Code Examples for java.sql.DatabaseMetaData#procedureColumnReturn()
The following examples show how to use
java.sql.DatabaseMetaData#procedureColumnReturn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LangProcedureTest.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
static String PARAMTYPE(short type) { switch (type) { case DatabaseMetaData.procedureColumnUnknown: return "procedureColumnUnknown"; case DatabaseMetaData.procedureColumnIn: return "procedureColumnIn"; case DatabaseMetaData.procedureColumnInOut: return "procedureColumnInOut"; case DatabaseMetaData.procedureColumnOut: return "procedureColumnOut"; case DatabaseMetaData.procedureColumnReturn: return "procedureColumnReturn"; case DatabaseMetaData.procedureColumnResult: return "procedureColumnResult"; default: return "???"; } }
Example 2
Source File: GetProcedureColumns.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
private int translate(int val) { if (!isFunction) { return val; } switch (val) { case DatabaseMetaData.procedureColumnUnknown: return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN; case DatabaseMetaData.procedureColumnIn: return JDBC40Translation.FUNCTION_PARAMETER_IN; case DatabaseMetaData.procedureColumnInOut: return JDBC40Translation.FUNCTION_PARAMETER_INOUT; case DatabaseMetaData.procedureColumnOut: return JDBC40Translation.FUNCTION_PARAMETER_OUT; case DatabaseMetaData.procedureColumnReturn: return JDBC40Translation.FUNCTION_RETURN; default: return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN; } }
Example 3
Source File: GetProcedureColumns.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
private int translate(int val) { if (!isFunction) { return val; } switch (val) { case DatabaseMetaData.procedureColumnUnknown: return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN; case DatabaseMetaData.procedureColumnIn: return JDBC40Translation.FUNCTION_PARAMETER_IN; case DatabaseMetaData.procedureColumnInOut: return JDBC40Translation.FUNCTION_PARAMETER_INOUT; case DatabaseMetaData.procedureColumnOut: return JDBC40Translation.FUNCTION_PARAMETER_OUT; case DatabaseMetaData.procedureColumnReturn: return JDBC40Translation.FUNCTION_RETURN; default: return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN; } }
Example 4
Source File: LangProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
static String PARAMTYPE(short type) { switch (type) { case DatabaseMetaData.procedureColumnUnknown: return "procedureColumnUnknown"; case DatabaseMetaData.procedureColumnIn: return "procedureColumnIn"; case DatabaseMetaData.procedureColumnInOut: return "procedureColumnInOut"; case DatabaseMetaData.procedureColumnOut: return "procedureColumnOut"; case DatabaseMetaData.procedureColumnReturn: return "procedureColumnReturn"; case DatabaseMetaData.procedureColumnResult: return "procedureColumnResult"; default: return "???"; } }
Example 5
Source File: GetProcedureColumns.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
private int translate(int val) { if (!isFunction) { return val; } switch (val) { case DatabaseMetaData.procedureColumnUnknown: return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN; case DatabaseMetaData.procedureColumnIn: return JDBC40Translation.FUNCTION_PARAMETER_IN; case DatabaseMetaData.procedureColumnInOut: return JDBC40Translation.FUNCTION_PARAMETER_INOUT; case DatabaseMetaData.procedureColumnOut: return JDBC40Translation.FUNCTION_PARAMETER_OUT; case DatabaseMetaData.procedureColumnReturn: return JDBC40Translation.FUNCTION_RETURN; default: return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN; } }
Example 6
Source File: LangProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
static String PARAMTYPE(short type) { switch (type) { case DatabaseMetaData.procedureColumnUnknown: return "procedureColumnUnknown"; case DatabaseMetaData.procedureColumnIn: return "procedureColumnIn"; case DatabaseMetaData.procedureColumnInOut: return "procedureColumnInOut"; case DatabaseMetaData.procedureColumnOut: return "procedureColumnOut"; case DatabaseMetaData.procedureColumnReturn: return "procedureColumnReturn"; case DatabaseMetaData.procedureColumnResult: return "procedureColumnResult"; default: return "???"; } }
Example 7
Source File: MySQLManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 5 votes |
@Override public String[] getColumnNamesForProcedure(String procedureName) { List<String> ret = new ArrayList<String>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { LOG.debug("Get Procedure Columns returns null"); return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { String name = results.getString("COLUMN_NAME"); ret.add(name); } } String[] result = ret.toArray(new String[ret.size()]); LOG.debug("getColumnsNamesForProcedure returns " + StringUtils.join(ret, ",")); return result; } finally { results.close(); getConnection().commit(); } } catch (SQLException e) { LoggingUtils.logAll(LOG, "Error reading procedure metadata: ", e); throw new RuntimeException("Can't fetch column names for procedure.", e); } }
Example 8
Source File: SqlManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 5 votes |
@Override public Map<String, String> getColumnTypeNamesForProcedure(String procedureName) { Map<String, String> ret = new TreeMap<String, String>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn && results.getInt("ORDINAL_POSITION") > 0) { // we don't care if we get several rows for the // same ORDINAL_POSITION (e.g. like H2 gives us) // as we'll just overwrite the entry in the map: ret.put( results.getString("COLUMN_NAME"), results.getString("TYPE_NAME")); } } LOG.debug("Columns returned = " + StringUtils.join(ret.keySet(), ",")); LOG.debug( "Type names returned = " + StringUtils.join(ret.values(), ",")); return ret.isEmpty() ? null : ret; } finally { results.close(); getConnection().commit(); } } catch (SQLException sqlException) { LoggingUtils.logAll(LOG, "Error reading primary key metadata: " + sqlException.toString(), sqlException); return null; } }
Example 9
Source File: SqlManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 5 votes |
@Override public Map<String, List<Integer>> getColumnInfoForProcedure(String procedureName) { Map<String, List<Integer>> ret = new TreeMap<String, List<Integer>>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn && results.getInt("ORDINAL_POSITION") > 0) { // we don't care if we get several rows for the // same ORDINAL_POSITION (e.g. like H2 gives us) // as we'll just overwrite the entry in the map: List<Integer> info = new ArrayList<Integer>(3); info.add(results.getInt("DATA_TYPE")); info.add(results.getInt("PRECISION")); info.add(results.getInt("SCALE")); ret.put(results.getString("COLUMN_NAME"), info); } } LOG.debug("Columns returned = " + StringUtils.join(ret.keySet(), ",")); LOG.debug("Types returned = " + StringUtils.join(ret.values(), ",")); return ret.isEmpty() ? null : ret; } finally { results.close(); getConnection().commit(); } } catch (SQLException sqlException) { LoggingUtils.logAll(LOG, "Error reading primary key metadata: " + sqlException.toString(), sqlException); return null; } }
Example 10
Source File: OracleManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override public Map<String, String> getColumnTypeNamesForProcedure(String procedureName) { Map<String, String> ret = new TreeMap<String, String>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { int index = results.getInt("ORDINAL_POSITION"); if (index < 0) { continue; // actually the return type } // we don't care if we get several rows for the // same ORDINAL_POSITION (e.g. like H2 gives us) // as we'll just overwrite the entry in the map: ret.put( results.getString("COLUMN_NAME"), results.getString("TYPE_NAME")); } } LOG.debug("Columns returned = " + StringUtils.join(ret.keySet(), ",")); LOG.debug( "Type names returned = " + StringUtils.join(ret.values(), ",")); return ret.isEmpty() ? null : ret; } finally { results.close(); getConnection().commit(); } } catch (SQLException sqlException) { LoggingUtils.logAll(LOG, "Error reading primary key metadata: " + sqlException.toString(), sqlException); return null; } }
Example 11
Source File: MySQLManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override public Map<String, Integer> getColumnTypesForProcedure(String procedureName) { Map<String, Integer> ret = new TreeMap<String, Integer>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { LOG.debug("getColumnTypesForProcedure returns null"); return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { // we don't care if we get several rows for the // same ORDINAL_POSITION (e.g. like H2 gives us) // as we'll just overwrite the entry in the map: ret.put( results.getString("COLUMN_NAME"), results.getInt("DATA_TYPE")); } } LOG.debug("Columns returned = " + StringUtils.join(ret.keySet(), ",")); LOG.debug("Types returned = " + StringUtils.join(ret.values(), ",")); return ret.isEmpty() ? null : ret; } finally { if (results != null) { results.close(); } getConnection().commit(); } } catch (SQLException sqlException) { LoggingUtils.logAll(LOG, "Error reading primary key metadata: " + sqlException.toString(), sqlException); return null; } }
Example 12
Source File: MySQLManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override public Map<String, String> getColumnTypeNamesForProcedure(String procedureName) { Map<String, String> ret = new TreeMap<String, String>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { LOG.debug("getColumnTypesForProcedure returns null"); return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { // we don't care if we get several rows for the // same ORDINAL_POSITION (e.g. like H2 gives us) // as we'll just overwrite the entry in the map: ret.put( results.getString("COLUMN_NAME"), results.getString("TYPE_NAME")); } } LOG.debug("Columns returned = " + StringUtils.join(ret.keySet(), ",")); LOG.debug( "Type names returned = " + StringUtils.join(ret.values(), ",")); return ret.isEmpty() ? null : ret; } finally { if (results != null) { results.close(); } getConnection().commit(); } } catch (SQLException sqlException) { LoggingUtils.logAll(LOG, "Error reading primary key metadata: " + sqlException.toString(), sqlException); return null; } }
Example 13
Source File: OracleManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override public Map<String, Integer> getColumnTypesForProcedure(String procedureName) { Map<String, Integer> ret = new TreeMap<String, Integer>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { int index = results.getInt("ORDINAL_POSITION"); if (index < 0) { continue; // actually the return type } // we don't care if we get several rows for the // same ORDINAL_POSITION (e.g. like H2 gives us) // as we'll just overwrite the entry in the map: ret.put( results.getString("COLUMN_NAME"), results.getInt("DATA_TYPE")); } } LOG.debug("Columns returned = " + StringUtils.join(ret.keySet(), ",")); LOG.debug("Types returned = " + StringUtils.join(ret.values(), ",")); return ret.isEmpty() ? null : ret; } finally { results.close(); getConnection().commit(); } } catch (SQLException sqlException) { LoggingUtils.logAll(LOG, "Error reading primary key metadata: " + sqlException.toString(), sqlException); return null; } }
Example 14
Source File: OracleManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override public String[] getColumnNamesForProcedure(String procedureName) { List<String> ret = new ArrayList<String>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { int index = results.getInt("ORDINAL_POSITION"); if (index < 0) { continue; // actually the return type } for (int i = ret.size(); i < index; ++i) { ret.add(null); } String name = results.getString("COLUMN_NAME"); if (index == ret.size()) { ret.add(name); } else { ret.set(index, name); } } } String[] result = ret.toArray(new String[ret.size()]); LOG.debug("getColumnsNamesForProcedure returns " + StringUtils.join(ret, ",")); return result; } finally { results.close(); getConnection().commit(); } } catch (SQLException e) { LoggingUtils.logAll(LOG, "Error reading procedure metadata: ", e); throw new RuntimeException("Can't fetch column names for procedure.", e); } }
Example 15
Source File: SqlManager.java From aliyun-maxcompute-data-collectors with Apache License 2.0 | 4 votes |
@Override public String[] getColumnNamesForProcedure(String procedureName) { List<String> ret = new ArrayList<String>(); try { DatabaseMetaData metaData = this.getConnection().getMetaData(); ResultSet results = metaData.getProcedureColumns(null, null, procedureName, null); if (null == results) { return null; } try { while (results.next()) { if (results.getInt("COLUMN_TYPE") != DatabaseMetaData.procedureColumnReturn) { int index = results.getInt("ORDINAL_POSITION") - 1; if (index < 0) { continue; // actually the return type } for(int i = ret.size(); i < index; ++i) { ret.add(null); } String name = results.getString("COLUMN_NAME"); if (index == ret.size()) { ret.add(name); } else { ret.set(index, name); } } } LOG.debug("getColumnsNamesForProcedure returns " + StringUtils.join(ret, ",")); return ret.toArray(new String[ret.size()]); } finally { results.close(); getConnection().commit(); } } catch (SQLException e) { LoggingUtils.logAll(LOG, "Error reading procedure metadata: ", e); throw new RuntimeException("Can't fetch column names for procedure.", e); } }
Example 16
Source File: CallParameterMetaData.java From spring-analysis-note with MIT License | 2 votes |
/** * Determine whether the declared parameter qualifies as a 'return' parameter * for our purposes: type {@link DatabaseMetaData#procedureColumnReturn} or * {@link DatabaseMetaData#procedureColumnResult}. * @since 4.3.15 */ public boolean isReturnParameter() { return (this.parameterType == DatabaseMetaData.procedureColumnReturn || this.parameterType == DatabaseMetaData.procedureColumnResult); }
Example 17
Source File: CallParameterMetaData.java From java-technology-stack with MIT License | 2 votes |
/** * Determine whether the declared parameter qualifies as a 'return' parameter * for our purposes: type {@link DatabaseMetaData#procedureColumnReturn} or * {@link DatabaseMetaData#procedureColumnResult}. * @since 4.3.15 */ public boolean isReturnParameter() { return (this.parameterType == DatabaseMetaData.procedureColumnReturn || this.parameterType == DatabaseMetaData.procedureColumnResult); }