Query and Update Sparx EA Repository with SQL

Sample Script to do it (using the Execute undocumented op)  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
option explicit
 
!INC Local Scripts.EAConstants-VBScript
!INC EAScriptLib.VBScript-Logging
 
'
' Script Name: SQL
' Author: Philippe Back
' Purpose: Demo SQL Invocation
' Date: 25/1/2011
'

Function SQLQuery(sql)
Dim sRes
LOGInfo("Query: " & sql)
sRes = Repository.SQLQuery(sql)
LOGInfo("Res: " & sRes)
End Function
 
Function SQLExec(sql)
Dim sRes
LOGInfo("Statement: " & sql)
sRes = Repository.Execute(sql)
LOGInfo("Res: " & sRes)
End Function
 
Sub Main
SQLQuery("SELECT * FROM T_OBJECT WHERE OBJECT_ID=1")
SQLExec("UPDATE T_OBJECT SET NAME='STUFF' WHERE OBJECT_ID=1")
End Sub
 
Main