function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
renaiah anamalla 6renaiah anamalla 6 

DML operations In apex

what is the Dml operation?
whats is the database.querylocator?
What is the interface?
What is the GovernerLimit in DML?
JonathanBaltzJonathanBaltz
All of these question can be answered with the Apex Code Developer's Guide.  I have provided a link below for your convienence. 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/
 
jyothsna reddy 5jyothsna reddy 5
Hi Renaiah,
DML operation:https://developer.salesforce.com/docs/atlas.en-us.apex_workbook.meta/apex_workbook/apex6_5.htm

Database.queryLocator:Use the Database.QueryLocator object when you are using a simple query (SELECT) to generate the scope of objects used in the batch job. If you use a QueryLocator object, the governor limit for the total number of records retrieved by SOQL queries is bypassed. For example, a batch Apex job for the Account object can return a QueryLocator for all account records (up to 50 million records) in an organization. Another example is a sharing recalculation for the Contact object that returns a QueryLocator for all contact records in an organization.

Interface:https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_interfaces.htm

Governer Limits:https://developer.salesforce.com/forums/ForumsMain?id=906F0000000MJ1fIAG


Hope it helps.

Regards,
Jyothsna D


 
Rupal KumarRupal Kumar
hi renaiah,
       Dml operation-
        
 You can perform DML operations using the Apex DML statements or the methods of the Database class.
           For lead conversion, use the convertLead method of the Database class. There is no DML counterpart for it.
        ​
1.   Insert Statement

      The insert DML operation adds one or more sObjects, such as individual accounts or contacts, to your organization’s data. insertis analogous        to the INSERT statement in SQL.

      Syntax insert sObjectinsert sObject[]

2.   Update Statement
      The update DML operation modifies one or more existing sObject records, such as individual accounts or contactsinvoice statements, in your         organization’s data. update is analogous to the UPDATE statement in SQL.

     Syntaxupdate sObjectupdate sObject[]

3.  Upsert Statement
      The upsert DML operation creates new records and updates sObject records within a single statement, using a specified field to determine            the      presence of existing objects, or the ID field if no field is specified.

     Syntax upsert sObject​​ [opt_field]upsert sObject[]​​ [opt_field]

4.   ​Delete Statement
       The delete DML operation deletes one or more existing sObject records, such as individual accounts or contacts, from your organization’s           data. delete is analogous to the delete() statement in the SOAP API.

     Syntax delete sObject | IDdelete sObject[] | ID[]

5. Undelete Statement
    The undelete DML operation restores one or more existing sObject records, such as individual accounts or contacts, from your                 organization’s Recycle Bin. undelete is analogous to the UNDELETE statement in SQL.

     Syntax undelete sObject | IDundelete sObject[] | ID[]

6.Merge Statement
  
The merge statement merges up to three records of the same sObject type into one of the records, deleting the others, and re-parenting any
r elated records.This DML operation does not have a matching Database system method.

Syntax merge sObject sObjectmerge sObject sObject[]

  Database.querylocator-

  QueryLocator Class Represents the record set returned by Database.getQueryLocator and used with Batch Apex.
  Database is namespace.
QueryLocator Methods

The following are methods for QueryLocator. All are instance methods.
getQuery()

Returns the query used to instantiate the Database.QueryLocator object. This is useful when testing the start method.
iterator()
Returns a new instance of a query locator iterator.

 Interface
An interface is like a class in which none of the methods have been implemented—the method signatures are there, but the body of each method is empty. To use an interface, another class must implement it by providing a body for all of the methods contained in the interface.

Interfaces can provide a layer of abstraction to your code. They separate the specific implementation of a method from the declaration for that method. This way you can have different implementations of a method based on your specific application.

Defining an interface is similar to defining a new class. For example, a company might have two types of purchase orders, ones that come from customers, and others that come from their employees. Both are a type of purchase order. Suppose you needed a method to provide a discount. The amount of the discount can depend on the type of purchase order.

You can model the general concept of a purchase order as an interface and have specific implementations for customers and employees. In the following example the focus is only on the discount aspect of a purchase order.

This is the definition of the PurchaseOrder interface.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_interfaces.htm


GovernerLimit in DML
Total number of records retrieved by SOQL queries-50,000
Total number of records retrieved by Database.getQueryLocator
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm


Thanks
Rupal Kumar
Mirketa Software Pvt Ltd
http://mirketa.com/index.html
 
Himanshu Rana 7Himanshu Rana 7

Hey Go Through this link to learn apex dml 

http://himanshurana.in/apex-data-manipulation-language/