Eduard Lebedyuk · Feb 12, 2022 go to post

Just checked XML spec and there's nothing about escaping $c(10) or $c(13).

The only symbols which must be escaped are:

  • " "
  • & &
  • ‘ '
  • ' '
  • < &lt;
  • > &gt;

You can check $zcvt - it produces the same output:

zw $zcvt("< > &" _$c(10)_$c(13)_ "TEST", "O", "XML")

If you need byte for byte compatibility you'll need a custom datatype with a redefined LogicalToXSD method. Something like:

Class test.XMLString Extends %String
{

ClassMethod LogicalToXSD(%val As %String) As %String [ CodeMode = objectgenerator, ServerOnly = 1 ]
{
    quit:%mode'="propertymethod" $$$OK
    Do %code.WriteLine($c(9) _ "set %val = $zcvt(%val,""O"",""XML"")")
    For replace=$lb("$c(10)","""&#xA"""),$lb("$c(13)","""&#xD""") {
        Set from = $lg(replace, 1)
        Set to = $lg(replace, 2)
        Do %code.WriteLine($c(9) _ "set %val = $replace(%val," _ from _ ", " _ to _")")
    }
    Do %code.WriteLine($c(9) _ "quit %val")
    Quit $$$OK
}

}
Eduard Lebedyuk · Feb 12, 2022 go to post

219 characters:

s r=##class(%Net.HttpRequest).%New(),r.Server="pm.community.intersystems.com",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/packages/zpm/latest/installer"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c")
Eduard Lebedyuk · Feb 12, 2022 go to post

Is it just a SELECT * FROM table query or is it something else?

Run the query in a Management Portal and compare the timings.

Eduard Lebedyuk · Feb 11, 2022 go to post

I think this would be enough:

Set P("Globals")="%DEFAULTDB"
Set tSC=##class(Config.Namespaces).Create("%All",.P)
Eduard Lebedyuk · Feb 11, 2022 go to post

No. %Save never throws an exception, just returns a %Status variable. In your scenario it would return an error indicating validation failure on LastName.

Class User.Person Extends %Persistent
{

Property LastName As %String(MAXLEN = 30);

/// do ##class(User.Person).Test()
ClassMethod Test()
{
    set obj = ..%New()
    set obj.LastName = $j("", 50)
    set sc = obj.%Save()    
    w $System.Status.GetErrorText(sc)
}
}

Results in:

ERROR #7201: Datatype value ' ' length longer than MAXLEN allowed of 30
  > ERROR #5802: Datatype validation failed on property 'User.Person:LastName', with value equal to " "
Eduard Lebedyuk · Feb 11, 2022 go to post
SELECT Name
FROM %Dictionary.CompiledIndex
WHERE PrimaryKey = 0 AND parent = 'your.class'
Eduard Lebedyuk · Feb 11, 2022 go to post

Fascinating. Maybe we can pack a separate container with a telnet client and a web page connected to it to debug business hosts in a browser.

Eduard Lebedyuk · Feb 11, 2022 go to post

Does foreground mode work only for windows with cterm/iristerm client or can any telnet client connect?

Eduard Lebedyuk · Feb 10, 2022 go to post

From the docs:

  • <STRINGSTACK> An expression is too long, there are too many expressions in an argument for a single command, or an expression contains many very long strings. Simplify the expression.
  • <MAXSTRING> There has been an attempt to specify or create a data string longer than the implementation allows. The maximum string size is 3,641,144 characters. Attempting to concatenate strings that would result in a string exceeding this maximum string size results in a <MAXSTRING> error.

MAXSTRING is always related to maximum length of 3,641,144 characters for one string (assuming long strings are enabled). STRINGSTACK can be raised in several different circumstances, including a lot of small strings, recursion and so on.

Increasing bbsiz may help avoid STRINGSTACK error, but not MAXSTRING.

In your case use streams by replacing:

set file=object.%Get(i).file

with:

set file=object.%Get(i).%Get("file",,"stream")
Eduard Lebedyuk · Feb 7, 2022 go to post

The issue is it would actually hang the process for 10 seconds. MakeTimerCall implementation would not - BP could process other messages in the meantime.

Eduard Lebedyuk · Feb 7, 2022 go to post

Check this answer if you need a CSV file.

If you need some custom format:

// prepare statement
set st =  ##class(%SQL.Statement).%New()
set st.%SelectMode = 1 // ODBC
set sc = st.%Prepare(query)
quit:$$$ISERR(sc) sc

// execute statement
#dim result As %SQL.StatementResult
set result = st.%Execute()
quit:result.%SQLCODE'=0 $$$ERROR($$$SQLError, result.%SQLCODE, result.%Message)

// iterate metadata (for example if you need a header)
#dim metadata As SQL.StatementMetadata
set metadata = result.%GetMetadata()
set columnCount = metadata.columns.Count()

for i=1:1:columnCount {
	#dim column As %SQL.StatementColumn
	set column = metadata.columns.GetAt(i)
}

// iterate results
while result.%Next() {
	for i=1:1:columnCount {
		set value = result.%GetData(i)
	}
}
Eduard Lebedyuk · Feb 5, 2022 go to post

"list of" will support this too in 2022.1

If you define Addresses list property like this:

Property Addresses As list Of Sample.Address(SQLPROJECTION = "table/column", STORAGEDEFAULT = "array");

Child table would be created.

Eduard Lebedyuk · Feb 4, 2022 go to post

Yes, looked promising but there are issues as we cant iterate positive/negative: 1,-1,2,-2 and so on.

Eduard Lebedyuk · Feb 2, 2022 go to post

And why starting with  -9 ?

Considering we need to hit anything from -9 to 9 where else should I start?

Eduard Lebedyuk · Feb 2, 2022 go to post

can't figure out how to check if the child process (in $zchild) is still running.  

Append 2 commands to your main command.

First one, execute before your main command to create a file with a name equal to process id.

Second one, execute after your main command. It deletes the file.

In your IRIS process check if the file exists.

Ugly but it works.

Eduard Lebedyuk · Feb 2, 2022 go to post

Can't reproduce. Can you post an example please?

Maybe you have a semicolon after your query?