VSCP Helper Library
Using the C++ classes directly
The CANAL helper libray
Other documentation
Using the C++ classes directly
The CANAL helper libray
Other documentation
int tableCreate( const unsigned char *pTableData );
Create table from XML data.
Pointer to string containing UTF8 XML definition of table.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableDelete( const unsigned char *pName, int bDeleteFile );
Delete named table.
Name of an existing table.
If TRUE (!=0) the database file also should be deleted. If not it will be reused if a table with the same name is created later.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableList( unsigned char **pLists );
Get a list of all defined tables.
List of null terminated strings that will get filled with table names. The list is allocated on the heap and must be freed by the user. If no result is returned set to a NULL pointer.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableListInfo( const unsigned char *pName, unsigned char *pTableInfo, int bXML );
Delete named table.
Name of an existing table.
Pointer to string that contain information about the table. The list is allocated on the heap and must be freed by the user. If no result is returned set to a NULL pointer.
If TREU (!=0) info will be returned as BASE64 encoded XML data.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGet( const unsigned char *pName, const char *pFrom, const char *pTo, unsigned char **pResultArray, BOOL bFull );
Get data from a named table in a range to-from. One can fetch all columns of the table (bFull) or just datetime and value (default).
Name of an existing table.
Datetime from which data should be fetched. Should be given on ISO 8601 format YY-MM-DDTHH:MM:SS.
Datetime up to which data is fetched. Should be given on ISO 8601 format YY-MM-DDTHH:MM:SS.
List of null terminated strings that will get filled with rows (if any) from the table. The list is allocated on the heap and must be freed by the user. If no result is returned set to a NULL pointer.
YY-MM-DDTHH:MM:SSsss, value1[,other fields]<CR><LF> YY-MM-DDTHH:MM:SSsss, value2[,other fields]<CR><LF> YY-MM-DDTHH:MM:SSsss, value3[,other fields]<CR><LF> ... YY-MM-DDTHH:MM:SS, valuen[,other fields]<CR><LF>
If TREU (!=0) all fields of a table row is returned (other fields above) in a comma separated list. Note that datetime is always listed first followed by value regardless of how the columns of the table is arranged.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetRaw( const unsigned char *pName, const char *pFrom, const char *pTo, unsigned char **pResultArray );
Get data from a named table in a range to-from. All columns of the table is always returned.
Name of an existing table.
Datetime from which data should be fetched. Should be given on ISO 8601 format YY-MM-DDTHH:MM:SS.
Datetime up to which data is fetched. Should be given on ISO 8601 format YY-MM-DDTHH:MM:SS.
List of null terminated strings that will get filled with rows (if any) from the table. The list is allocated on the heap and must be freed by the user. If no result is returned set to a NULL pointer.
comma separated row of database columns<CR><LF> comma separated row of database columns<CR><LF> comma separated row of database columns<CR><LF> ... comma separated row of database columns<CR><LF>
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableLog( const unsigned char *pName, double value, char *pdt );
Log a value, date/time pair to a table.
Name of an existing table.
Value to log.
Pointer to date/time value. Can be NULL (or empty) and in which case the current date/time is used.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableLogSQL( const unsigned char *pName, const unsigned char *psql );
Log data to with a SQL expression.
Name of an existing table.
Pointer to string that contain SQL expression used to log data.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetNumRecords( const unsigned char *pName, const char *pFrom, const char *pTo, size_t *pRecords );
Get number of records for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
size_t that will get number of records in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetFirstDate( const unsigned char pName, const char *pFrom, const char *pTo, char *pFirst );
Get the first data/time for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
A string buffer that will get the first date/time in the interval on success. The buffer is supposed to hold a ISO formatted date/time value (YYYY-MM-DDTHH:MM:SS) so it should be able to hold at least twenty characters.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetLastDate( const unsigned char *pName, const char *pFrom, const char *pTo, char *pLast );
Get the last data/time for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
A string buffer that will get the last date/time in the interval on success. The buffer is supposed to hold a ISO formatted date/time value (YYYY-MM-DDTHH:MM:SS) so it should be able to hold at least twenty characters.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetSum( const unsigned char *pName, const char *pFrom, const char *pTo, double *pSum );
Get the sum of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the sum of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetMin( const unsigned char *pName, const char *pFrom, const char *pTo, double *pMin );
Get the minimum of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the minimum of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetMax( const unsigned char *pName, const char *pFrom, const char *pTo, double *pMax );
Get the maximum of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the maximum of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetAverage( const unsigned char *pName, const char *pFrom, const char *pTo, double *pAverage );
Get the average of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the average of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetMedian( const unsigned char *pName, const char *pFrom, const char *pTo, double *pMedian );
Get the median (middle/second quartile) of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the median of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetStdDev( const unsigned char *pName, const char *pFrom, const char *pTo, double *pStdDev );
Get the standard deviation of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the standard deviation of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetVariance( const unsigned char *pName, const char *pFrom, const char *pTo, double *pVariance );
Get the variance of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the variance of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetMode( const unsigned char *pName, const char *pFrom, const char *pTo, double *pMode );
Get the mode of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the mode of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetLowerQ( const unsigned char *pName, const char *pFrom, const char *pTo, double *pLowerQ );
Get the lower/first quartile of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the lower quartile of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableGetUpperQ( const unsigned char *pName, const char *pFrom, const char *pTo, double *pUpperQ );
Get the upper/third quartile of all values for an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
Pointer to a double that will get the upper quartile of all values in the interval on success.
CANAL_ERROR_SUCCESS on success or an error code on failure.
int tableClear( const unsigned char *pName, const char *pFrom, const char *pTo );
Remove all records in an interval in a named table.
Name of an existing table.
Date/time from which resulting data should be fetched. Set to “0000-01-01T00:00:00” for beginning of time.
Date/time to which resulting data should be fetched. Set to “9999-12-31T23:59:59” for end of time.
CANAL_ERROR_SUCCESS on success or an error code on failure.
Copyright © 2000-2017 Åke Hedman, Paradise of the Frog / Grodans Paradis AB