go to post Vitaliy Serdtsev · Jul 25, 2017 Try this: Property Amounts As %ArrayOfDataTypes [ SqlComputeCode = { set {*} = ##class(ContainerSize).GetTotalAmounts({ID})}, SqlComputed, Transient ]; ClassMethod GetTotalAmounts(thisID) As %List { quit $lb( $lb("GBP",1.23), $lb("EUR",2.45) ) }
go to post Vitaliy Serdtsev · Jul 21, 2017 Then try to use a newer JDBC driver (eg from 2017.1). It usually backwards compatible with older versions. If this does not help, then there is only upgrade of Caché.
go to post Vitaliy Serdtsev · Jul 20, 2017 There is a method $system.Memory.Clean(<cleancache>, <defragment>), but unfortunately it appeared only with version 2011.1. Try this code (consider that LONGVARCHAR = %Stream.GlobalCharacter) Read a CLOB through JDBC: try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Statement st = dbconn.createStatement(); ResultSet rs = st.executeQuery("Select ID,Text from eprinstance.isegment"); while (rs.next()) { int len; Reader reader = rs.getCharacterStream("Text"); while ((len = reader.read()) != -1) bos.write(len); System.out.println(bos); reader.close(); bos.reset(); } bos.close(); st.close(); rs.close(); System.out.println("OK!"); } finally { dbconn.close(); }
go to post Vitaliy Serdtsev · Jul 18, 2017 I didn't know that Caché allowed to use JOINs without specifying FROM. JOIN or SELECTOptional FROM Clause? But it should be noted that for JOIN not all usages are supported, for example: Supported: SELECT * FROM (select 'aaa' Column1,'bbb' Column2 union select 'ccc','ccc' union select 'xxx','yyy' union select 'hhh','zzz') Table1 LEFT OUTER JOIN (select 'ggg' Column1,'hhh' Column3 union select 'xxx','zzz') Table2 ON Table1.Column1=Table2.Column3 Not supported: SELECT * FROM (select 'aaa' Column1,'bbb' Column2 union select 'ccc','ccc' union select 'xxx','yyy' union select 'hhh','zzz') Table1 INNER JOIN (select 'ggg' Column1,'hhh' Column3 union select 'xxx','zzz') Table2 USING (Column1)
go to post Vitaliy Serdtsev · Jul 18, 2017 Non-optimal plan does not necessarily mean low speed. I have had cases where the query with the best plan to work longer than a query with worse plan. Now the optimizer is pretty advanced. Important to periodically make tuning table and add an index on each field involved in the search. When unknown parameters >5, is easier to do one query than to write a bunch of code.
go to post Vitaliy Serdtsev · Jul 18, 2017 Possible do on-other, namely to write one "universal" query: select * from person where (lastname=:lastname or :lastname is null) and (age > :age or :age is null) That is: sql = "select * from person where (lastname=? or ? is null) and (age > ? or ? is null)" resultset = statement.%Execute(param1, param1, param2, param2)
go to post Vitaliy Serdtsev · Jul 18, 2017 The solution with ##class(%xsd.hexBinary).LogicalToXSD works, but be careful, it only works when all characters in the string have codes <256. All right, because the function works with an array of bytes (binary). Therefore pre-to need lead N-byte string to single-byte string and only then do the conversion, for example: f trantable="SAME","UTF8" { w "-------",!,trantable,! s xN="π=3.14159..." zzdump xN w ! s x1=$zcvt(xN,"O",trantable) zzdump x1 w !! s hex=##class(%xsd.hexBinary).LogicalToXSD(x1) zw hex w $zcvt(##class(%xsd.hexBinary).XSDToLogical(hex),"I",trantable),!! } USER>d ^test ------- SAME 0000: 03C0 003D 0033 002E 0031 0034 0031 0035 π=3.1415 0008: 0039 002E 002E 002E 9... 0000: C0 03 3D 00 33 00 2E 00 31 00 34 00 31 00 35 00 À.=.3...1.4.1.5. 0010: 39 00 2E 00 2E 00 2E 00 9....... hex="C0033D0033002E00310034003100350039002E002E002E00" π=3.14159... ------- UTF8 0000: 03C0 003D 0033 002E 0031 0034 0031 0035 π=3.1415 0008: 0039 002E 002E 002E 9... 0000: CF 80 3D 33 2E 31 34 31 35 39 2E 2E 2E Ï.=3.14159... hex="CF803D332E31343135392E2E2E" π=3.14159...
go to post Vitaliy Serdtsev · Jul 14, 2017 s l=$lb("",,,,,"",,,"BOOLEAN","0",2,2,"1",,"bla",$lb(,,"bla","20050502123400"),"",1,"bla",,0) s jsonStr=[(l)].%ToJSON() w jsonStr,!! s obj=[].%FromJSON(jsonStr) s list=obj."0" zw list Result: ["\u0002\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0001\u0001\t\u0001BOOLEAN\u0003\u00010\u0003\u0004\u0002\u0003\u0004\u0002\u0003\u00011\u0001\u0005\u0001bla\u0019\u0001\u0001\u0001\u0005\u0001bla\u0010\u000120050502123400\u0002\u0001\u0003\u0004\u0001\u0005\u0001bla\u0001\u0002\u0004"] list=$lb("",,,,,"",,,"BOOLEAN","0",2,2,"1",,"bla",$lb(,,"bla","20050502123400"),"",1,"bla",,0)
go to post Vitaliy Serdtsev · Jul 13, 2017 Hi Uri. In my opinion, this possible hear only empirically through load testing on specific hardware. It is also important and the interface between Caché and the world .NET, namely the number of calls made to a DLLBetter performance. Sometimes the performance gain is observed when .NET refers to Caché (ADO.NET, eXTreme .NET Provider), and not vice versa (.NET Gateway). But it always requires a revision of the architecture. By the way, for .NET Provider/ADO.NET there is Connection Pooling
go to post Vitaliy Serdtsev · Jul 13, 2017 Personally, I prefer to use all out of the box, so as not to produce zoo libraries/technologies/languages, etc. Really, both operations possible to execute at a time, for instance so: w $$$FormatText("Create a signature and convert it to base64 (%1)",file64),! s cmd=$$$FormatText("openssl dgst -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1 -sign %1 %2 | openssl base64 -out %3 -nopad",fileKey,fileMsg,file64) w cmd,!! d $zf(-1,cmd)
go to post Vitaliy Serdtsev · Jul 13, 2017 In addition to said by Eduard: OpenSSL and error in reading openssl.conf file
go to post Vitaliy Serdtsev · Jul 13, 2017 Take a look at the source code of the queries ##class(%Global).[Find/Get()] Pattern Matching
go to post Vitaliy Serdtsev · Jul 13, 2017 What exactly did you do? Quote from doc: By default, the session timeout is to 900 seconds (15 minutes). You can change this default for a CSP application in the Management Portal; [Home] > [Security] > [Web Applications] page. Select the application and click Edit. Note that if a session changes CSP applications during its life span, its timeout value will not be updated according to the default timeout defined in the application that the session moved into. For example, if a session starts out in CSP Application A, with a default timeout of 900 seconds, and then moves into CSP Application B, which has a default timeout of 1800 seconds, the session will still timeout after 900 seconds. Check these points. Still see the page parameter AUTOLOGOUT.
go to post Vitaliy Serdtsev · Jul 13, 2017 It's the wrong solution, because it works not for all cases such as this: Set Text(1) = "Planet" Set Text(2) = "Championship" Set Text(3) = "2017" Set Text(4) = "IT"Here is more optimized code Sean: ClassMethod Main(ByRef Text) { f j=2:1:$o(Text(""),-1) f k=j:-1:2 s l=$l(Text(k))+1,$e(Text(k),l)=$e(Text(k-1),l,*),$e(Text(k-1),l,*)="" }
go to post Vitaliy Serdtsev · Jul 11, 2017 Session TimeoutFind: Session Termination and Cleanup Session Timeout Session Timeout for CSP Gateway