Obtain jagged rows
When all the rows that a query retrieves are not the same type and length, the rows are called jagged rows.
Jagged rows occur as a result of a query that uses the
following syntax to request all the rows in a supertable and all its
subtables:
SELECT correlation_variable
FROM table_name correlation_variable;
In
the preceding query, table_name represents a supertable in
an inheritance hierarchy. Suppose you create the following schema
in which the table parent has one column, child has
two columns, and grandchild has three columns:
CREATE TABLE parent OF TYPE parent_t (num1 INTEGER);
INSERT INTO parent VALUES (10);
CREATE TABLE child OF TYPE child_t (num2 SMALLFLOAT)
UNDER parent;
INSERT INTO child VALUES (20, 3.5);
CREATE TABLE grandchild OF TYPE grandchild_t (name TEXT)
UNDER child;
INSERT INTO grandchild VALUES (30, 7.8, 'gundrun');
The following SELECT statement queries the parent supertable:
SELECT p FROM parent p;
This query returns the following three jagged rows:
p (parent_t)
num1
10
p (child_t)
num1 num2
20 3.5E+00
p (grandchild_t)
num1 num2 name
30 7.8E+00 gundrun
The DataBlade®
API indicates
that a query returned a jagged row as follows:
- The mi_value() or mi_value_by_name() function returns a value status of MI_ROW_VALUE.
- The contents of the MI_DATUM structure that holds the retrieved column is a pointer to a row structure.
The format of the columns depends on whether the control
mode for the query data is text or binary representation, as the following
table shows.
Control mode | Contents of elements within row structure |
---|---|
Text representation | Null-terminated strings |
Binary representation | Internal formats of column values |
For a list of the text and binary representations of data types, see Control modes for data.