User Answers

To determine contents of %request, %response and %session objects you can add this to the beginning of your code

set %response.ContentType = "html"
do ##class(%CSP.Utils).DisplayAllObjects()
quit $$$OK

It would return detailed information about the request as an html page.

recreates the file with a randomized OriginalFilename

Recreates in the same folder?

What is the value of FilePath, WorkPath, ArchivePath, DeleteFromServer settings?

You need to solve the problem with file recreation, as specifying "binary" as a Charset setting gives you the correct hash.

While the table name cannot be a query argument, you can sanitize the input using:

Write $SYSTEM.SQL.TableExists("Sample.Person")

And as far as sanitizing the table access itself - SQL access privileges should take care of that.

You need to throw an exception. Sample proc:

Class Test.Obj
{

/// do ##class(Test.Obj).TestFunc().%Display()
Query Test() As %SQLQuery
{
SELECT Test.Obj_MyProc()
}

ClassMethod MyProc() As %String [ SqlProc ]
{
    Set tSC = $$$ERROR($$$GeneralError, "MyMsg")
    If $$$ISERR(tSC)
    {
        Throw ##class(%Exception.SQL).CreateFromSQLCODE(-400, $System.Status.GetErrorText(tSC))
        Quit ""
    }
    Quit "OK"
}

}

And after I call the procedure, this message is returned:

Either Enter or Ctrl-C would exit from the current loop. In your case Ctrl-C seems to work.

To determine contents of %request, %response and %session objects you can add this to the beginning of your code

set %response.ContentType = "html"
do ##class(%CSP.Utils).DisplayAllObjects()
quit $$$OK

It would return detailed information about the request as an html page.