-
-
Creates a table data set out of an array.
Parameters:
Name |
Type |
Description |
rows |
Array
|
array of rows |
Returns:
table data set that contains the data of the array
-
Type
-
module:tableDataSet~TableDataSet
Example
var tableDataSetLib = $.import("sap.hana.testtools.unit.util", "tableDataSet");
// the table data has three columns "Id", "col2" and "COL3" with three rows.
var dataAsArray = [ {
Id : 1,
col2 : "A",
COL3 : 1.0
}, {
Id : 2,
col2 : "B",
COL3 : 2.0
}, {
Id : 3,
col2 : "C",
COL3 : 3.0
} ];
var tableDataSet = tableDataSetLib.createFromArray(dataAsArray);
-
-
Creates a table data set out of an array of comma-separated-value list.
Parameters:
Name |
Type |
Description |
csvList |
Array
|
array of comma separated values |
containsHeaderLine |
Boolean
|
true when the first line contains the name of columns |
Returns:
table data set that contains the data of the csv list
-
Type
-
module:tableDataSet~TableDataSet
Example
var tableDataSetLib = $.import("sap.hana.testtools.unit.util", "tableDataSet");
// the table data has three columns "Id", "col2" and "COL3" with three rows.
var dataAsCSVArray = [["Id", "col2", "COL3"],
[1, "A", "1.0"],
[2, "B", "2.0"],
[3, "C", "3.0"]];
var tableDataSet = tableDataSetLib.createFromCSVList(dataAsCSVArray, true);
-
-
Creates a table data set out of a json.
Parameters:
Name |
Type |
Description |
json |
Object
|
each property contains a set of values |
Returns:
table data set that contains the data of the json
-
Type
-
module:tableDataSet~TableDataSet
Example
var tableDataSetLib = $.import("sap.hana.testtools.unit.util", "tableDataSet");
// the table data has three columns "Id", "col2" and "COL3" with three rows.
var dataAsJSON = {
Id : [ 1, 2, 3 ],
col2 : [ "A", "B", "C" ],
COL3 : [ 1.0, 2.0, 3.0 ]
};
var tableDataSet = tableDataSetLib.createFromJSON(dataAsJSON);
var tableDataSet = tableDataSetLib.createFromJSON({Id : 1, col2 : "A", COL3 : 1.0});
-
-
Creates a table data set out of a ResultSet.
Parameters:
Name |
Type |
Description |
resultSet |
$.db.ResultSet
|
$.hdb.ResultSet
|
database result set |
Returns:
table data set that contains the data of the resultSet
-
Type
-
module:tableDataSet~TableDataSet
Example
var tableDataSetLib = $.import("sap.hana.testtools.unit.util", "tableDataSet");
var statement = null;
var resultSet = null;
try {
statement = this.dbConnection.prepareStatement("select 1 as Id, 'B' as col2 from dummy");
resultSet = statement.executeQuery();
var tableDataSet = tableDataSetLib.createFromResultSet(resultSet);
checkTableDataSet(tableDataSet, 1, 2);
} finally {
if (resultSet) {
resultSet.close();
}
if (statement) {
statement.close();
}
}
-
<inner> isTableDataSet(obj) → {Boolean}
-
Checks whether the passed object is a TableDataSet instance.
Parameters:
Name |
Type |
Description |
obj |
Object
|
any object |
Returns:
true if passed object is a TableDataSet instance
-
Type
-
Boolean