Class Reference
IRIS for UNIX 2024.1.2
|
|
Private
Storage
|
The sample class mentioned here (Sample.Person) is part of https://github.com/intersystems/Samples-Data. See Downloading Samples.
This class replays script-driven SQL tests. It provides an implementation of the
To write a test, start by creating a subclass of this class with appropriate values for the
Class Sample.SqlTest extends %UnitTest.TestSqlScript { Parameter DATACLASS = "Sample.Person"; Parameter DATAFILE = "person.data"; Parameter DATATAG = "person"; }
Write ##class(Sample.Person).Populate(100)
Set writer=##class(%XML.Writer).%New() Set writer.Charset="UTF-8" Set sc=writer.OutputToFile("person.data") Set sc=writer.RootElement("people") Set statement=##class(%SQL.Statement).%New() Set sc=statement.%PrepareClassQuery("Sample.Person","Extent") Set result=statement.%Execute() While result.%Next(.sc) { Set id=result.%Get("ID") Set person=##class(Sample.Person).%OpenId(id) Set sc=writer.Object(person,"person") } Set sc=writer.EndRootElement() Set sc=writer.EndDocument()
select max(SSN) from Sample.Person #### select count(ID) from Sample.Person ####count IDs
Do ##class(%UnitTest.Manager).RunTest("Sample",,"reference")
SQL> select max(SSN) from Sample.Person Aggregate_1: 992-27-1936: SQL> select count(ID) from Sample.Person Aggregate_1: 100: Test count IDs
Do ##class(%UnitTest.Manager).RunTest("Sample")
|
|
Properties | ||
---|---|---|
AutoPassword | Debug | SkipTest |
|
List that correlates XML tags in a data file with classes. Entries are of the form tag1:class1, ..., tagn:classn, with each entry specifying a pair ofDATATAG andDATACLASS parameter values.If
CORRELATIONLIST ,DATACLASS , andDATATAG are all specified, theDATATAG andDATACLASS pair are added to the end of theCORRELATIONLIST .
Specifies an XML-enabled class, such as Sample.Person, to be correlated with theDATATAG in theDATAFILE .
XML file, such as person.data, that contains data for theDATACLASS . If no directory name is specified by RunTest, then the current UnitTest directory is used.
Specifies an XML tag inDATAFILE , such as <person> (angle brackets omitted), to be correlated with theDATACLASS .
WhenTIMESCALE is a positive number, this parameter is part of the elapsed time message written to output.log. Override it to localize the display of elapsed time.
WhenTIMESCALE is a positive number, this parameter is part of the elapsed time message written to output.log. Override it to localize the spelling of "seconds."
If a test name is specified after the #### terminator in the script, it is written to output.log. Override this parameter to localize the spelling of "Test."
Set this parameter to 1 to dump the access plans used by each test in the test script. Use this feature when you need to verify plan stability from one release to the next, or when you want to investigate the impact of creating, dropping, or altering an index.
This parameter specifies the number of significant digits used to display elapsed time for each SQL statement to output.log. It can be used as a coarse indicator of differences in the run time of any individual query.The default value of "" prevents elapsed time information from being displayed at the end of each SQL statement in the test. Setting it to 1 will display the result in seconds. Setting it to 10 will display elapsed time in multiples of 10 seconds. Setting it to 0.1 will display elapsed time to the nearest tenth second.
|
This method deletes the extent of theDATACLASS and populates it from the file specified by theDATAFILE parameter.
This method reads SQL statements from scriptfile, writing their output to outputfile. Statements are terminated by a line that starts with "####".