1 23 24 package com.mysql.jdbc; 25 26 import java.sql.ParameterMetaData ; 27 import java.sql.SQLException ; 28 29 public class MysqlParameterMetadata implements ParameterMetaData { 30 31 ResultSetMetaData metadata = null; 32 int parameterCount = 0; 33 34 35 MysqlParameterMetadata(Field[] fieldInfo, int parameterCount) { 36 this.metadata = new ResultSetMetaData(fieldInfo); 37 38 this.parameterCount = parameterCount; 39 } 40 41 public int getParameterCount() throws SQLException { 42 return this.parameterCount; 43 } 44 45 public int isNullable(int arg0) throws SQLException { 46 checkAvailable(); 47 48 return this.metadata.isNullable(arg0); 49 } 50 51 private void checkAvailable() throws SQLException { 52 if (this.metadata == null) { 53 throw new SQLException ( 54 "Parameter metadata not available for the given statement", 55 SQLError.SQL_STATE_DRIVER_NOT_CAPABLE); 56 } 57 } 58 59 public boolean isSigned(int arg0) throws SQLException { 60 checkAvailable(); 61 62 return (this.metadata.isSigned(arg0)); 63 } 64 65 public int getPrecision(int arg0) throws SQLException { 66 checkAvailable(); 67 68 return (this.metadata.getPrecision(arg0)); 69 } 70 71 public int getScale(int arg0) throws SQLException { 72 checkAvailable(); 73 74 return (this.metadata.getScale(arg0)); 75 } 76 77 public int getParameterType(int arg0) throws SQLException { 78 checkAvailable(); 79 80 return (this.metadata.getColumnType(arg0)); 81 } 82 83 public String getParameterTypeName(int arg0) throws SQLException { 84 checkAvailable(); 85 86 return (this.metadata.getColumnTypeName(arg0)); 87 } 88 89 public String getParameterClassName(int arg0) throws SQLException { 90 checkAvailable(); 91 92 return (this.metadata.getColumnClassName(arg0)); 93 } 94 95 public int getParameterMode(int arg0) throws SQLException { 96 return parameterModeIn; 97 } 98 } 99 | Popular Tags |