private void sendRowDescription(ResultSetMetaData meta) throws Exception { if (meta == null) { sendNoData(); } else { int columns = meta.getColumnCount(); int[] types = new int[columns]; int[] precision = new int[columns]; String[] names = new String[columns]; for (int i = 0; i < columns; i++) { String name = meta.getColumnName(i + 1); names[i] = name; int type = meta.getColumnType(i + 1); type = PgServer.convertType(type); // the ODBC client needs the column pg_catalog.pg_index // to be of type 'int2vector' // if (name.equalsIgnoreCase("indkey") && // "pg_index".equalsIgnoreCase(meta.getTableName(i + 1))) { // type = PgServer.PG_TYPE_INT2VECTOR; // } precision[i] = meta.getColumnDisplaySize(i + 1); server.checkType(type); types[i] = type; } startMessage('T'); writeShort(columns); for (int i = 0; i < columns; i++) { writeString(StringUtils.toLowerEnglish(names[i])); // object ID writeInt(0); // attribute number of the column writeShort(0); // data type writeInt(types[i]); // pg_type.typlen writeShort(getTypeSize(types[i], precision[i])); // pg_attribute.atttypmod writeInt(-1); // text writeShort(0); } sendMessage(); } }