IT tutorials
 
Technology
 

Microsoft Dynamic AX 2009 : .Performance (part 4) - Transaction Performance - Set-Based Data Manipulation Operators - The delete_from Operator

10/28/2013 3:36:42 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3.1.3 The delete_from Operator

The delete_from operator is similar to the insert_recordset and update_recordset operators in that it parses a single statement to the database to delete multiple rows. The following X++ code shows the deletion of all sizes for an item.

static void DeleteSizes(Args _args)
{
InventSize inventSize;
;
ttsbegin;
delete_from inventSize
where inventSize.itemId == '1000';
ttscommit;
}


This code parses a statement to SQL Server in a similar syntax to DELETE <table> WHERE <predicates> and executes the same scenario as the following X++ code, which uses record-by-record deletes.

static void DeleteSizes(Args _args)
{
InventSize inventSize;
;
ttsbegin;
while select forupdate inventSize
where inventSize.itemId == '1000'
{
inventSize.delete();
}
ttscommit;
}


Again, the use of delete_from is preferred with respect to performance because a single statement is parsed to the database, rather than the multiple statements that the record-by-record version parses.

Like the downgrading insert_recordset and update_recordset operations, the delete_from operation could also be downgraded, and for similar reasons. Downgrade occurs if any of the following is true:

  • The table is entire-table cached.

  • The delete method, the aosValidateDelete method, or the aosValidateRead method is overridden on the target table.

  • Alerts have been set up to be triggered by deletes into the target table.

  • The database log has been configured to log deletes into the target table.

Downgrade also occurs if delete actions are defined on the table. The Dynamics AX application runtime automatically handles the downgrade and internally executes a scenario similar to the while select scenario shown in the preceding example.

You can avoid downgrades caused by the previously mentioned functionality, unless the table is entire-table cached. The record buffer contains methods that turn off the checks that the application runtime performs when determining whether to downgrade the delete_from operation. Here are the skip descriptions:

  • Calling skipDataMethods(true) prevents the check that determines whether the delete method is overridden.

  • Calling skipAosValidation(true) prevents the checks on the aosValidateDelete and aosValidateRead methods.

  • Calling skipDatabaseLog(true) prevents the check that determines whether the database log is configured to log deletion of records in the table.

  • Calling skipEvents(true) prevents the check that determines whether any alerts have been set to be triggered by the delete event on the table.

The preceding descriptions about the use of the skip methods, the no-skipping behavior in the event of downgrade, and the concurrency model for the update_recordset operator are equally valid for the use of the delete_from operator.

Note

The record buffer also contains a skipDeleteMethod method. Calling the methods as skipDeleteMethod(true) has the same effect as calling skipDataMethods(true). It invokes the same Dynamics AX application runtime logic, so you can use skipDeleteMethod in combination with insert_recordset and update_recordset, although it might not improve the readability of the X++ code.


 
Others
 
- Microsoft Dynamic AX 2009 : .Performance (part 3) - Transaction Performance - Set-Based Data Manipulation Operators - The update_recordset Operator
- Microsoft Dynamic AX 2009 : .Performance (part 2) - Transaction Performance - Set-Based Data Manipulation Operators - The insert_recordset Operator
- Microsoft Dynamic AX 2009 : .Performance (part 1) - Reducing Round-Trips Between the Client and the Server
- Exchange Server 2010 Quick Start Guide : Configuring Recipients (part 3) - Configuring a Postmaster Address, SSL Certificate , Entering the Product Key
- Exchange Server 2010 Quick Start Guide : Configuring Recipients (part 2) - Creating Distribution Groups, Organizational Health
- Exchange Server 2010 Quick Start Guide : Configuring Recipients (part 1)
- Sharepoint 2010 : Data Access Overview - Performance
- Sharepoint 2010 : Data Access Overview - Lists and Document Libraries
- Sharepoint 2010 : Data Access Overview - Columns (part 3) - Field Types - Inheriting from BaseFieldControl
- Sharepoint 2010 : Data Access Overview - Columns (part 2) - Field Types - Inheriting from SPField
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us