an Excellent Reference. you got the point.
for speed: If don't want to run a benchmark indirection isn't bad
as in this case: functionality counts
![]()
- Log in to post comments
an Excellent Reference. you got the point.
for speed: If don't want to run a benchmark indirection isn't bad
as in this case: functionality counts
![]()
I fully agree with your concerns. Especially related to parallel processing and sharding.
And modern code and design will never need this.
But there are millions of lines of old code out in the field that require these dirty tricks to survive.
And YES! You have to examine very carefully what you do.
It's a little bit like mountaineering:
Most take the cable car, some climb with ropes and a lot of fancy equipment. While a few free climbers use nothing than their body.
You have to understand the risks and to take your decision.
BINGO!
You got my point. Of course, you should be careful with the storage not to mix it up. Therefore the class method to keep all related globals in sync.
CLASSPARAMETERS are static and apply to class compile time.
You refer to it by ..#paramname in your class code
https://cedocs.intersystems.com/latest/csp/docbook/Doc.View.cls?KEY=RCOS_fparameter
see section References to Other Class Members
For Multiline SQL you may do it his way:
no solution for coloring inside a String
on "html to pdf converter freeware" google gave me 3 270 000 hits.
Why reinventing the wheel.
Place your HTML into a local file and let someone else do the dirty job.
There are enough solutions for a call-out to trigger the conversion.
Sorry, it didn't work with postgreSQL.
The error changed to a gateway error.
You can map stored procedures over the Gateway but not SQL functions:
I assume the same is happening also with Oracle.
Though it seems nonsense to me you can fake SQLUSER.ROW_NUMBER
for that purpose like this:
In your namespace create this class to simulate ROW_NUMBER()
#1) I'd suggest to increase the size of your LockTab as suggested by @Vic Sun
#2) There is a class in %SYS . ^SYS.Lock that could be useful for multiple Lock deletes.
and as I just learned to adjust LockTab size (SetMaxLockTableSize)
https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=SYS.Lock
#3) ^LOCKTAB from terminal command line in %SYS also shows the Locktab
check Locktable in the management portal to find if some other process has locked the table.
by do ##class(my.class).%UnlockExtent(0,1) you just can release yourr own LOCKs
I'm not an expert on Oracle and have no chance to test. Just an idea
Instead of ROWNUM the function ROW_NUMBER() should pass the syntax check as it is not a column identifier.
https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions137.htm
So a possible workaround could be to have a VIEW on Oracle including ROWNUM as a column
like SELECT ROWNUM as row, * from whatever_table
and then map the View instead of the original table just for this purpose.
Just as a side note.
mixing Caché tables with external tables (e.g. in a JOIN) is not possible.
%VID is a Caché internal workaround for subqueries to hide the fact that ROWNUM or ROW_NUMBER wasn't implemented
https://cedocs.intersystems.com/latest/csp/docbook/Doc.View.cls?KEY=RSQL_C189621
You can't mix it with external database access with internal features
instead, use the RowNumber implementation of your external DB (they vary by product)
https://www.w3schools.com/sql/sql_top.asp
https://docs.microsoft.com/en-us/sql/t-sql/functions/row-number-transact-sql?view=sql-server-ver15
You just can win. The workload moves to the external DB and you transfer fewer records
So I'd suggest involving WRC to check the sources where the double translation comes from.
(probably since ever)
just an idea to understand:
what do you see if your .stream is a %Stream.GlobalBinary ?
see this example to reproduce and explain that there is an unnecessary conversion on the way
.png)
as you showed in your example
"text": "Condição de pagamento sujeito a análise de crédito: "
@Rubens Silva
That sounds to me like double encoding.
I'd suggest using a HEX Editor (e.g. PSpad) to examine your files.
UTF-8 means that some characters have more than 8 bit.
By converting an already converted string you may get those strange effects.
And you found the way to avoid this already yourself.
I just tested a variable parameter list in SQL. It works: (simplified example)
with SQL:
so you can generate your JSON straght as ClassMethd
With 2013.* it is not built-in, but you can mimic it:
every Classmethod can be projected as SQLprocedure.
I'm not sure if you can pass a variable list of arguments from SQL.
But this is the basic mechanic behind it
check SQL Function JSON_OBJECT
https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_jsonobject
and JSON_ARRAY
https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_jsonarray
with the related examples
Based on the changed question you may consider this solution with just 1 Common Class:
If you look to the Storage definition you see something similar:
Now you change the <Global> node to
this means if there is no variable %GLOBAL you see ^tabA but if you set %GLOBAL you see ^tabB
to set the variable also directly from SQL you may add this ClassMethod as SQLprocedure
now see the effect. first the test data:
and now the SQL query
next with pure SQL
The SQL procedure SetGlobal is independent of the rows:
It will be processed before the row selecting. So we set our local variable %GLOBAL there.
As it is part of the WHERE clause we have to check the return value.
So it works with any SLQ Query tool. eg. Mgmt Portal.
Setting the variable works of course also for object access.
instead of the explicit global you may try to use global name indirection.
Suggestion: Use a %variable to escape from scoping troubles.
see details : Subscript Indirection and $NAME function
Yes it is.
I missed it and entered via registration.
JOIN THE WEBINAR!
you may take this example from OpenExchange:
https://openexchange.intersystems.com/package/Light-weight-EXCEL-download
Al you have to do is to out-comment in ClassMethod OnPreHTTP()
this line : #; set %response.ContentType="application/vnd.ms-excel"
and the table goes to your browser.
you have to mimic %Next() as %session.Data is a Multidimensional Array)
COS is the acronym for Caché Object Script.
It is the oldest programming language in Caché , Ensemble, ... .
BTW. Your new approach looks promising and safe.
A native COS example is available in Open Exchange now.
WebSocket Client Demo in IRIS 2020.1
If I understand you correct you expect something like
INSERT INTO new.MESSAGE (SELECT * from EnsLib.HL7.Message where id = ? )
this may work for rather modest designed relational tables but I doubt it will work for some complex structure as EnsLib.HL7.Message .
Subclassing is not the way to solve your problem for 2 reasons:
There are ways to do something like this if you fiddle around in the storage structures.
BUT: for reasons of transparency, documentation, and maintainability
I'd strongly recommend to use DTL.
Fiddling around with COS in Ensemble is a rather tricky exercise.
Based on practical experience I can confirm that your successors will never forget you.
IRIS 2020.1 !!!