Question
· Nov 12, 2020

Can the $SYSTEM.SQL.DDLImport ClassMethod import Class Objects

In Cache WIndows environment:

Trying to use the $SYSTEM.SQL.DDLImport to import XML File that has ClassMethods, no SQL Table, but it doesn't appear to be working. I can use this ClassMethod to create SQL Tables. The manual method I have been using is to go into Cache Management Portal, Classes, Import.

I create an XML file first, then run the following to import but get no errors. Any ideas?

 Do $SYSTEM.SQL.DDLImport("Oracle",%ID,dlxml,logfl,0,"",";",2)

Beginning of XML file looks like...

<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2017.1.3 (Build 317U)" ts="2019-02-16 16:34:11">
<Class name="TEST.DATALINK">
<Description>
TEST.DATALINK - SETS UP LINKED TABLES ON CACHE ECP SERVER
;2018A; 01-FEB-2019 17:31 Smith  </Description>
<Super>%Persistent</Super>
<TimeChanged>65695,79183.295</TimeChanged>
<TimeCreated>65695,79183.295</TimeCreated>

<Method name="LinkTable">
<ClassMethod>1</ClassMethod>
<FormalSpec>gateway:%String,schema:%String,table:%String,newSchema:%String="",prikey:%String=""</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[

Discussion (2)1
Log in or sign up to continue

To load such XML files, you have to use

  • $system.OBJ.Load("/path/to/some.xml", "ck", .errors) - Just one file
  • $system.OBJ.LoadStream(stream, "ck", .errors) - Load from stream
  • $system.OBJ.LoadDir("/path/to/sources", "ck", .errors, 1) - Load any source code files, recursively
  • $system.OBJ.ImportDir("/path/to/sources", "*.xml", "ck", .errors, 1) - Load any source code files by specified filter, recursively