Question
· Feb 28, 2020

Cannot invoke %SYSTEM.OBJ.LoadStream() by IRIS.ClassMethodStatusCode

trying importing classDefinition to Iris via LoadStream() fails with
zLoadStream+1^%SYSTEM.OBJ.1 ----> InterSystems.Data.IRISClient.IRISException : Exception thrown on server (code = 1192)...

Code is here; use any valid exported ClassDefinition as File to test that:

    public static void loadClassFromStream(this IRIS iris, string txt)
    {

        // IRISObject globalCharStr = IrisStreamExtensions.FromTxt(iris, text);
        var fp = @"C:\tmp\TestClass.xml";
        txt = File.ReadAllText(fp);

        var stream = new MemoryStream();
        var bytes = Encoding.Default.GetBytes(txt);
        stream.Write(bytes, 0, bytes.Length);
        stream.Flush();
        stream.Position = 0;

        var qspec = "/display=none /compile=0 /recursive=0 /relatedclasses=0 /subclasses=0";
        var errorlog = "";
        var loadedItems = "";

        var parameter = new object[]
        {
            stream, 
            qspec,  
            errorlog,
            loadedItems
        };

        try
        {
            iris.ClassMethodStatusCode("%SYSTEM.OBJ", "LoadStream", parameter);
        }
        catch (Exception e)
        {
            throw new IrisException("%SYSTEM.OBJ", "LoadStream", e);
        }            

    }
Discussion (4)1
Log in or sign up to continue