The ts_open() function
The ts_open() function opens a time series.
Syntax
ts_tsdesc *
ts_open(MI_CONNECTION *conn,
ts_timeseries *ts,
MI_TYPEID *type_id,
mi_integer flags)
- conn
- A database connection. This argument is unused in the server.
- ts
- The time series to open.
- type_id
- The ID for the type of the time series to be opened. The ID is generally determined by looking in the MI_FPARAM structure.
- flags
- Valid values for the flags parameter are defined in tseries.h.
The flags argument values
Valid
values for the flags argument are defined in the
file tseries.h. (the integer value you use for
the flags argument is the sum of the desired values).
Valid options are:
- TSOPEN_RDWRITE
- The default mode for opening a time series. Indicates that the time series can be read and written to.
- TSOPEN_READ_HIDDEN
- Indicates that hidden elements should be treated as if they are not hidden.
- TSOPEN_READ_ONLY
- Indicates that the time series can only be read.
- TSOPEN_WRITE_HIDDEN
- Allows hidden elements to be written to without first revealing the element.
- TSOPEN_WRITE_AND_HIDE
- Causes any elements written to a time series also to be marked as hidden.
- TSOPEN_WRITE_AND_REVEAL
- Reveals any hidden element that is written.
- TSOPEN_NO_NULLS
- Affects the way elements are returned that have never been allocated
(TS_NULL_NOTALLOCATED). Usually, if an element has not been allocated,
it is returned as
NULL
. If TSOPEN_NO_NULLS is set, an element that has each column set toNULL
is returned instead.
These flags can be used in any combination except
the following four combinations:
- TSOPEN_WRITE_HIDDEN and TSOPEN_WRITE_AND_HIDE
- TSOPEN_WRITE_HIDDEN and TSOPEN_WRITE_AND_REVEAL
- TSOPEN_WRITE_AND_REVEAL and TSOPEN_WRITE_AND_HIDE
- TSOPEN_WRITE_HIDDEN, TSOPEN_WRITE_AND_HIDE, and TSOPEN_WRITE_AND_REVEAL
The TSOPEN_WRITE_HIDDEN, TSOPEN_WRITE_AND_REVEAL, and TSOPEN_WRITE_AND_HIDE flags cannot be used with TSOPEN_READ_HIDDEN.
Description
Almost all other functions depend on this function being called first.
Use ts_close to close the time series.
Returns
A descriptor for the open time series.
Example
See the ts_interp() function, The Interp function example, for an example of ts_open().