Saturday, May 23, 2015

MQL- Transaction

Transaction involves accessing the database or producing a change in the database. All MQL Statement involve transactions.

Two Types of MQL Transaction

1) Implicit Transaction
2) Explicit Transaction

IMPLICIT TRANSACTION

           When ever you enter MQL Statement, the transaction is started and, if the statement is valid, the transaction is committed. Ex-

add person mohan

As soon as you enter the statement, Matrix starts the transaction to define a person named mohan. If that person is already defined, the statement is invalid and the transaction aborts—the statement is not processed and the database remains unchanged. If the person is not already defined, Matrix is committed to (the completion of) the transaction of adding a new person. Once a transaction is committed, the statement is fully processed and it cannot be undone. In this case, mohan would be added to the database.

 EXPLICIT TRANSACTION

  Some MQL statements enable you to explicitly commit, abort and start transaction.Ex-

                          abort transaction [NAME];
                          commit transaction;
                          print transaction;
                          start transaction [read];
                          set transaction wait|nowait|savepoint [NAME];
 


You can also update the transaction. Ex- 

                        start transaction update;
                        add businessobject Part “001820” 0
                        policy Part
                        description “Part of mobile for xyz model”;
                        checkin businessobject Part “001820” 0 PB8XCVR;
                        add businessobject Part ”001821” 0    
                        policy Drawing
                        description “Substitute Part of 001820”;
                        checkin businessobject Drawing ”001821” 0 PB8XCVR;
                        commit transaction;

This transaction is started and the current state of the database is saved. The add businessobject statements create businessobjects, and the checkin businessobject statements add the files. When the commit transaction statement is processed, MQL examines all the statements that it processed since the start transaction. If no error are detected, all changes made by the statements are permanently made to the database. .



Friday, May 8, 2015

MQL Statement

MQL Statement consists of a keyword, clauses and values. MQL Statements follow their own set of protocol and conventions as in any programming languages(SQL, MySql). Mql Statement may or may not contain clauses. All clauses begin with keyword and separated with a space, tab or carriage return.

Example of MQL Statement with clauses:

       add attribute "modifiedDate"
              description "this is the modified date of the product"
              type datetime

When we are using MQL, there are two important MQL Statement: Quit and Help.

QUIT Statement

             The quit statement exits the matrix command interface and returns control to the OS.In simple word, if we want to terminate our MQL session, just enter:

             quit [integer];

HELP Statement

              The help statement is available for various MQL statement categories. If you do not know which category you want or you want to get a listing of the entire contents of the help file,
enter:

             help all;