The ts_copy() function

The ts_copy() function makes and returns a copy of the given time series of the type in the type_id argument.

Syntax

ts_timeseries *
ts_copy(MI_CONNECTION *conn, 
       ts_timeseries *ts, 
       MI_TYPEID     *typeid)
conn
A valid DataBlade® API connection.
ts
The time series to be copied.
typeid
The ID of the row type of the time series to be copied.

Description

Since values returned by mi_value() are valid only until the next mi_next_row() or mi_query_finish() call, it is sometimes necessary to use ts_copy() to access a time series outside an mi_get_result() loop.

On the client, you must use the ts_copy() function to make a copy of a time series before you pass the time series as an argument to the mi_exec_prepare() statement.

Returns

A copy of the given time series. This value must be freed by the user by calling ts_free().