|
17 | 17 |
|
18 | 18 | package com.pivotal.gemfirexd.internal.engine.diag; |
19 | 19 |
|
| 20 | +import java.sql.Clob; |
20 | 21 | import java.sql.ResultSetMetaData; |
21 | 22 | import java.sql.SQLException; |
22 | 23 | import java.sql.Types; |
|
32 | 33 | import com.pivotal.gemfirexd.internal.engine.Misc; |
33 | 34 | import com.pivotal.gemfirexd.internal.engine.jdbc.GemFireXDRuntimeException; |
34 | 35 | import com.pivotal.gemfirexd.internal.iapi.sql.ResultColumnDescriptor; |
| 36 | +import com.pivotal.gemfirexd.internal.iapi.types.HarmonySerialClob; |
35 | 37 | import com.pivotal.gemfirexd.internal.impl.jdbc.EmbedResultSetMetaData; |
| 38 | +import com.pivotal.gemfirexd.internal.impl.jdbc.Util; |
36 | 39 | import com.pivotal.gemfirexd.internal.shared.common.reference.Limits; |
| 40 | +import com.pivotal.gemfirexd.internal.shared.common.reference.SQLState; |
37 | 41 | import org.slf4j.Logger; |
38 | 42 | import org.slf4j.LoggerFactory; |
39 | 43 |
|
@@ -138,12 +142,30 @@ protected Object getObjectForColumn(int columnNumber) throws SQLException { |
138 | 142 | return this.currentTableColumn.maxWidth; |
139 | 143 | case 14: // NULLABLE |
140 | 144 | return this.currentTableColumn.nullable; |
| 145 | + case 15: // VIEWTEXT |
| 146 | + // only show for ordinal 0 and avoid repetition |
| 147 | + if (this.currentTableColumns.nextIndex() == 1) { |
| 148 | + return this.currentTableMeta.viewText; |
| 149 | + } else return null; |
141 | 150 | default: |
142 | 151 | throw new GemFireXDRuntimeException("unexpected column=" + |
143 | 152 | columnNumber + " for HiveTablesVTI"); |
144 | 153 | } |
145 | 154 | } |
146 | 155 |
|
| 156 | + @Override |
| 157 | + public Clob getClob(int columnNumber) throws SQLException { |
| 158 | + switch (columnNumber) { |
| 159 | + case 15: // VIEWTEXT |
| 160 | + String viewText = getString(columnNumber); |
| 161 | + return viewText != null ? new HarmonySerialClob(viewText) : null; |
| 162 | + |
| 163 | + default: |
| 164 | + throw Util.generateCsSQLException(SQLState.LANG_VTI_BLOB_CLOB_UNSUPPORTED, |
| 165 | + "HIVETABLES", columnNumber); |
| 166 | + } |
| 167 | + } |
| 168 | + |
147 | 169 | /** |
148 | 170 | * Metadata |
149 | 171 | */ |
@@ -176,6 +198,8 @@ protected Object getObjectForColumn(int columnNumber) throws SQLException { |
176 | 198 |
|
177 | 199 | private static final String NULLABLE = "NULLABLE"; |
178 | 200 |
|
| 201 | + private static final String VIEWTEXT = "VIEWTEXT"; |
| 202 | + |
179 | 203 | private static final ResultColumnDescriptor[] columnInfo = { |
180 | 204 | EmbedResultSetMetaData.getResultColumnDescriptor(SCHEMA, |
181 | 205 | Types.VARCHAR, false, 128), |
@@ -205,6 +229,8 @@ protected Object getObjectForColumn(int columnNumber) throws SQLException { |
205 | 229 | Types.INTEGER, false), |
206 | 230 | EmbedResultSetMetaData.getResultColumnDescriptor(NULLABLE, |
207 | 231 | Types.BOOLEAN, false), |
| 232 | + EmbedResultSetMetaData.getResultColumnDescriptor(VIEWTEXT, |
| 233 | + Types.CLOB, true), |
208 | 234 | }; |
209 | 235 |
|
210 | 236 | private static final ResultSetMetaData metadata = new EmbedResultSetMetaData( |
|
0 commit comments