Archive for 'Matrix'

Connect to a Matrix database with Java

1
2
3
4
5
6
7
8
9
  Context context = new Context("");
  context.setUser("creator");
  context.setPassword("secret");
  context.setVault("eService Production");
  context.connect();
 
  context.disconnect();
  context.closeContext();
  System.exit(0);

Updating attributes for a Matrix object

1
2
3
4
5
6
7
8
9
  DomainObject do = new DomainObject(new BusinessObject("TYPE","NAME","REVISION","VAULT"));
  Map<String,String> m = new HashMap<String,String>();
  m.put("Attribute1", "textOne");
  m.put("Attribute2", "textTwo");
  if (do.exists(context)) {
    do.setAttributeValues(context, m);
  } else {
    // object does not exist
  }

Tagged with , , .

Using Transactions in MQL (0)

January 15th, 2009 by Frank Niedermann, under Matrix.

It’s often a good idea to use Transactions in MQL, this is how:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// start a transaction
start transaction update;
 
... MQL commands ...
 
// create savepoint
set transaction savepoint saveOne;
 
... MQL commands ...
 
// create savepoint
set transaction savepoint saveTwo;
 
// rollback until savepoint saveOne
abort transaction saveOne;
 
... MQL commands ...
 
// commit the MQL commands
commit transaction;
 
// abort (rollback) the MQL commands
abort transaction;

Tagged with , .

Export:

mql export Table BOMAnalysisReport xml into file file.xml;

Import: First show what would be imported and then import:

mql import Table * overwrite from file file.xml;
mql import list Table * overwrite from file file.xml;

Tagged with , .