Jaa


SqlStatementExecutePermission.newmethod(String) Method

Definition

Creates a new instance of the SQLStatementExecutePermission class.

public:
 void newmethod(System::String ^ _sqlStatement);
public void newmethod (string _sqlStatement);
override this.newmethod : string -> unit
Public Sub newmethod (_sqlStatement As String)

Parameters

_sqlStatement
String

The SQL string to be executed.

Remarks

The following example performs an SQL query on the CustTable table, which runs on the server. The result of the query is stored in the resultSet object.

server static void main(Args _args) 
{ 
    DictTable  dictTable; 
    Connection connection; 
    Statement  statement; 
    str        sql; 
    ResultSet  resultSet; 
    SqlStatementExecutePermission perm; 
    dictTable = new DictTable(tableNum(CustTable)); 
    if (dictTable != null) 
        { 
           connection = new Connection(); 
           sql = strfmt( "SELECT * FROM %1", dictTable.name(DbBackend::Sql) ); 
           //Instantiate the permission class 
           perm = new SqlStatementExecutePermission(sql); 
           //check for permission to use statement 
           perm.assert(); 
           statement = connection.createStatement(); 
           resultSet = statement.executeQuery(sql); 
           //end the scope of the assert call 
           CodeAccessPermission::revertAssert(); 
        } 
}

Applies to