go to post Vitaliy Serdtsev · Jan 23, 2023 You are absolutely right.There should be no discrepancies in the description of the task and in the code for checking the solution.
go to post Vitaliy Serdtsev · Jan 23, 2023 I suggest waiting for an answer from @Eduard Lebedyuk, the author of the discussion, who knows how really should be.
go to post Vitaliy Serdtsev · Jan 23, 2023 I'm looking at the output validation code, not Output, where there are no spaces at all on the right. It is a pity that there is confusion because of this! Class codeGolf.test.Pyramid Class codeGolf.test.Pyramid Extends %UnitTest.TestCase { ClassMethod openDisplay(Output filename As %String) { Set dir=##class(%SYSTEM.Process).CurrentDirectory() Set filename=dir_"temp.txt" Open filename:("NRW"):5 USE filename } ClassMethod getResult(filename As %String, Output list As %ListOfDataTypes) { Set list = ##class(%ListOfDataTypes).%New() Set file = ##class(%File).%New(filename) Set sc = file.Open( "R" ) If $$$ISERR(sc) quit While 'file.AtEnd { Do list.Insert(file.ReadLine()) } Do file.Close() Do ##class(%File).Delete(filename) } Method TestSimple() { Do ..openDisplay(.filename) Do ##class(codeGolf.Pyramid).Build(3) CLOSE filename Do ..getResult(filename, .result) Do $$$AssertEquals(result.GetAt(1), " # ") Do $$$AssertEquals(result.GetAt(3), "#####") } Method TestComplex() { Do ..openDisplay(.filename) Do ##class(codeGolf.Pyramid).Build(40) CLOSE filename Do ..getResult(filename, .result) Do $$$AssertEquals(result.GetAt(1), " # ") Do $$$AssertEquals(result.GetAt(23), " ############################################# ") Do $$$AssertEquals(result.GetAt(40), "###############################################################################") } }
go to post Vitaliy Serdtsev · Jan 23, 2023 size = 50 ClassMethod Build(f As %Integer) { s a="#" f i=f:-1:1 w ?i-1,a,?f*2-1,! s a=a_"##" } PS: if you look at the class codeGolf.test.Pyramid, you can see that the format of the output data for f=3 should be as follows: " # " " ### " "#####" So be careful.
go to post Vitaliy Serdtsev · Dec 21, 2022 Your example does not take into account which element is selected. For example, if you select the last element, then the list wins instead of the delimited string. s L=1e4,N=1e5,a="1",b=$lb(1) f i=2:1:L s a=a_"_"_i,b=b_$lb(i) s t=$zh f i=1:1:N s c=$p(a,"_",L) w $zh-t," s.",! s t=$zh f i=1:1:N s c=$li(b,L) w $zh-t," s.",!
go to post Vitaliy Serdtsev · Dec 21, 2022 I'll put in my five cents too. Firstly, Apache for Windows is installed very easily: you just need to unpack the archive and, if necessary (this is done once), register the service. Secondly, it is not difficult to find the Apache distribution for Windows, for example here: Apache Haus Downloads Thirdly, I always remove PWS and use my own Apache, so I welcome removing PWS from the IRIS distribution
go to post Vitaliy Serdtsev · Dec 1, 2022 It is not entirely clear that you are using Caché or IRIS 2021.1: #Caché I have two tables: one a local table using cache and the other is via an SQL gateway.. Product version: IRIS 2021.1 The presence/absence of restrictions on the execution of heterogeneous queries depends on this: Caché 2018.1.7: All the tables listed in the FROM clause of an SQL query must come from the same data source. Queries that join data from heterogeneous data sources are not allowed. IRIS 2021.1: Queries that join data from heterogeneous data sources are only supported for ODBC connections. When using JDBC, all tables listed in the FROM clause of an SQL query must come from the same data source.
go to post Vitaliy Serdtsev · Nov 11, 2022 size = 79 ClassMethod Order(a As %String) As %String { s r=a f i=1:1:5e5{s s=$p(a," ",i),w=$tr(s,1e20/17),$p(r," ",$tr(s,w))=w} q r }
go to post Vitaliy Serdtsev · Oct 24, 2022 Have you looked at the type of fields in the metadata? For me, the INTEGER type (4) is returned for ID, and the BIGINT type (-5) is returned for %ID. Try SELECT id, x, y, z FROM some_table order by %id and d rs.%GetMetadata().%Display() What are the default values for AdaptiveMode, AllowRowIDUpdate, IdKeyCPF, PKEY_IS_IDKEY ? Try disabling AdaptiveMode.
go to post Vitaliy Serdtsev · Oct 24, 2022 There is a faster way without opening the object: Class dc.test Extends %Persistent { ClassMethod Test() { s classname="dc.test", storagename="Default" w $$$defMemberKeyGet(classname,$$$cCLASSstorage,storagename,$$$cSDEFdatalocation) } Storage Default { <Data name="testDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> </Data> <DataLocation>^abc.1</DataLocation> <DefaultData>testDefaultData</DefaultData> <IdLocation>^dc.testD</IdLocation> <IndexLocation>^dc.testI</IndexLocation> <StreamLocation>^dc.testS</StreamLocation> <Type>%Library.CacheStorage</Type> } }Result: ^abc.1
go to post Vitaliy Serdtsev · Oct 20, 2022 Here are two ways: s s="12162,CHAPTER I,Certain infectious and parasitic diseases (A00-B99),003 (A20-A28),Certain zoonotic bacterial diseases,A28,""Other zoonotic bacterial diseases, not elsewhere classified"",A28,""Other zoonotic bacterial diseases, not elsewhere classified"",N,N,N,N,N,,,,,,,,,,G" d ##class(%DeepSee.TermList).%ParseCSVRecord(s,.arr1) zw arr1 w ! s list=$$CSVtoList^%occLibrary(s) d ##class(%ListOfDataTypes).BuildValueArray(list,.arr2) zw arr2 Take a look at the class methods %SQL.Util.Procedures
go to post Vitaliy Serdtsev · Oct 19, 2022 If there was a built-in function for expanding the list into a table, then the solution would be even shorter. An example of such a function: Class dc.golf.Kata [ Abstract ] { Query split( s As %VarString, delim As %VarString) As %Query(ROWSPEC = "word:%String") [ SqlProc ] { } ClassMethod splitExecute( ByRef qHandle As %Binary, s As %VarString, delim As %VarString) As %Status { d ##class(%ListOfDataTypes).BuildValueArray($lfs(s,delim),.qHandle) s qHandle=0 q $$$OK } ClassMethod splitFetch( ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = splitExecute ] { s d=$o(qHandle(qHandle),1,v) i d="" { s AtEnd=1 } else { s Row=$lb(v),qHandle=d } q $$$OK } } Now you can do a variety of things with the string, for example: select min(length(word)) "min",length(word) len,word from dc_golf.Kata_split('bitcoin take over the world maybe who knows perhaps',' ') Result: min len word 3 7 bitcoin 3 4 take 3 4 over 3 3 the 3 5 world 3 5 maybe 3 3 who 3 5 knows 3 7 perhaps
go to post Vitaliy Serdtsev · Oct 7, 2022 There are no such methods, because the size of the stream (file) can exceed the maximum length of the string, which at the moment is 3641144, so the type of string (%String, %VarString, %xsd.base64Binary, etc.) will not always be able to hold all the data. But also it is not difficult to read the stream into a line: ClassMethod StreamToStr(ByRef stream As %Stream.Object) As %String { s s="" d stream.Rewind() while 'stream.AtEnd { s s=s_stream.Read($$$MaxLocalLength) } q s }PS: above I have given methods, some of which are available in older versions of Caché.
go to post Vitaliy Serdtsev · Aug 19, 2022 See documentation for $SYSTEM.SQL.QueryToTable(): THIS METHOD IS DEPRECATED. Refer to $SYSTEM.SQL.Schema.QueryToTable instead.2021.1 Am I correct in saying that a create table as select is strictly as COPY operation of an existing table. Yes, see CREATE TABLE table AS SELECT query copies column definitions and column data from an existing table (or tables) into a new table based on the specified SELECT query.2022.1 To clarify, I used the $SYSTEM command to create table from query, because I kept getting errors with create table as select (didn't like my AS statement). What could have gone wrong there? Benjamin De Boe For that purpose, the CREATE TABLE .. AS SELECT .. syntax is offered by several other databases, and will appear in IRIS SQL soon. As a matter of fact, a developer is working on that command this very week :-) Because this feature has appeared since version IRIS 2022.1 (see link above).
go to post Vitaliy Serdtsev · Aug 4, 2022 well, looks so, but there are no methods, which will return available connections. USER>d $system.License.ConnectionListFunc().%Display() or d $system.License.ProcessListFunc().%Display()
go to post Vitaliy Serdtsev · Aug 4, 2022 Try to play around with the SetConnectionLimit() & SetUserLimit() methods. PS: I do not know what about DBeaver, but DbVisualizer has the ability to configure one physical connection.