Partilhar via


SqlStatementExecutePermission Class

Definition

Controls the ability to use SQL.

public ref class SqlStatementExecutePermission : Microsoft::Dynamics::Ax::Xpp::CodeAccessPermission
[Microsoft.Dynamics.Ax.Xpp.KernelClass]
public class SqlStatementExecutePermission : Microsoft.Dynamics.Ax.Xpp.CodeAccessPermission
[<Microsoft.Dynamics.Ax.Xpp.KernelClass>]
type SqlStatementExecutePermission = class
    inherit CodeAccessPermission
Public Class SqlStatementExecutePermission
Inherits CodeAccessPermission
Inheritance
Microsoft.Dynamics.AX.KernelInterop.ProxyBase
SqlStatementExecutePermission
Attributes

Remarks

This class is designed to check permissions for specific APIs. For a list of all protected APIs, see Secured APIs. You must call the assert method on the same tier, usually the server tier, that the corresponding CodeAccessPermission::demand method is called on before the protected API is executed. Call a method on the server tier from one of the following: a server static method, or a class instance method that is set to run on the server by using the RunOn class property

This 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. The assert method is called to declare that the code can then instantiate the AsciiIo class that is used to read and write data to a file.

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) ); 
           _perm = new SqlStatementExecutePermission(_sql); 
           // Check for permission to use the _statement. 
           _perm.assert(); 
           _statement = _connection.createStatement(); 
           _resultSet = _statement.executeQuery(_sql); 
           // End the scope of the assert call. 
           CodeAccessPermission::revertAssert(); 
        } 
}

Constructors

SqlStatementExecutePermission()
SqlStatementExecutePermission(IntPtr)
SqlStatementExecutePermission(String)

Fields

__k_SqlStatementExecutePermissionId
kernelClass (Inherited from XppObjectBase)

Methods

__shouldCallNew(Type)
addXppProxyReference(Type, Object) (Inherited from XppObjectBase)
assert()

Declares that the calling code can invoke an API that is protected by a permission.

(Inherited from CodeAccessPermission)
Call(String, Object[], Type[], Object[]) (Inherited from XppObjectBase)
cancelTimeOut(Int32) (Inherited from XppObjectBase)
Copy()

Creates and returns a copy of the current permission class object.

createKernelClass(Object[], Type[], Object[]) (Inherited from XppObjectBase)
demand()

Checks the call stack to determine whether the permission that is required to invoke an API has been granted to the calling code.

(Inherited from CodeAccessPermission)
equal(XppObjectBase) (Inherited from XppObjectBase)
finalize() (Inherited from XppObjectBase)
GetIntPtr() (Inherited from XppObjectBase)
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getXppProxyReference(Type) (Inherited from XppObjectBase)
handle()
IsManagedValid() (Inherited from XppObjectBase)
Issubsetof(CodeAccessPermission)

Determines whether a current permission is a subset of the specified permission.

kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
newmethod()

Initializes a new instance of the CodeAccessPermission class.

(Inherited from CodeAccessPermission)
newmethod(String)

Creates a new instance of the SQLStatementExecutePermission class.

notify() (Inherited from XppObjectBase)
notifyAll() (Inherited from XppObjectBase)
objectOnServer()
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32, Boolean)
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32)
Obsolete.
(Inherited from XppObjectBase)
usageCount() (Inherited from XppObjectBase)
VerifyKernelClass() (Inherited from XppObjectBase)
wait() (Inherited from XppObjectBase)
Xml() (Inherited from XppObjectBase)
Xml(Int32) (Inherited from XppObjectBase)

Applies to