GetResultSetMetaData

Description

Returns the metadata result set in a cursor. This method is for use in JSP targets only.

Applies to

PSCursorClass objects

Syntax

cursorobject.GetResultSetMetaData ( )

Argument

Description

cursorobject

A variable that contains a reference to an instance of PSCursorClass

Returns

java.sql.ResultSetMetaData

Examples

Example 1

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() ); 
   } 

See also

GetResultSet