Returns the metadata result set in a cursor. This method is for use in JSP targets only.
PSCursorClass objects
cursorobject.GetResultSetMetaData ( )
Argument |
Description |
---|---|
cursorobject |
A variable that contains a reference to an instance of PSCursorClass |
java.sql.ResultSetMetaData
The following example loops through the return value of the GetResultSetMetaData method to list all the columns and datatypes in the “employee” table of an ASA database accessed through JDBC:
try { PSConnectionClass dbconn = new PSConnectionClass(pageContext, "com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:2638", "dba","sql", true); PSCommandClass sqlcmd = dbconn.CreateCommand ("select * from employee"); PSCursorClass rs = sqlcmd.Execute(); java.sql.ResultSetMetaData meta = rs.GetResultSetMetaData(); for( int col=1; col<=meta.getColumnCount(); col++ ) psDocument.WriteLn( "Column: <B>" + meta.getColumnName(col) + "</B>\t, Type: <B>" + meta.getColumnTypeName(col)+"</B>" ); }
catch( Exception e ) { psDocument.WriteLn( " Error : " + e.toString() ); }