SQL Relay C++ API
|
#include <sqlrexportcsvjsondomnode.h>
Inherits sqlrexportdomnode.
Public Member Functions | |
sqlrexportcsvjsondomnode () | |
virtual | ~sqlrexportcsvjsondomnode () |
virtual bool | exportData () |
Public Member Functions inherited from sqlrexportdomnode | |
sqlrexportdomnode () | |
virtual | ~sqlrexportdomnode () |
void | setDomNode (domnode *dn) |
domnode * | getDomNode () |
void | setColumnsDomNode (domnode *dn) |
domnode * | getColumnsDomNode () |
void | setCurrentColumnDomNode (domnode *dn) |
domnode * | getCurrentColumnDomNode () |
void | setRowsDomNode (domnode *dn) |
domnode * | getRowsDomNode () |
void | setCurrentRowDomNode (domnode *dn) |
domnode * | getCurrentRowDomNode () |
void | setCurrentFieldDomNode (domnode *dn) |
domnode * | getCurrentFieldDomNode () |
Public Member Functions inherited from sqlrexport | |
sqlrexport () | |
virtual | ~sqlrexport () |
void | setSqlrConnection (sqlrconnection *sqlrcon) |
void | setSqlrCursor (sqlrcursor *sqlrcur) |
sqlrconnection * | getSqlrConnection () |
sqlrcursor * | getSqlrCursor () |
void | setTable (const char *table) |
const char * | getTable () |
void | setExcludeColumns (bool excludecolumns) |
bool | getExcludeColumns () |
void | setColumnsToExclude (const char *const *columnstoexclude) |
const char *const * | getColumnsToExclude () |
void | setLogger (logger *lg) |
logger * | getLogger () |
void | setCoarseLogLevel (uint8_t coarseloglevel) |
uint8_t | getCoarseLogLevel () |
void | setFineLogLevel (uint8_t fineloglevel) |
uint8_t | getFineLogLevel () |
void | setLogIndent (uint32_t logindent) |
uint32_t | getLogIndent () |
void | setLogErrors (bool logerrors) |
bool | getLogErrors () |
uint64_t | getExportedRowCount () |
Additional Inherited Members | |
Protected Member Functions inherited from sqlrexport | |
virtual bool | exportStart () |
virtual bool | columnsStart () |
virtual bool | columnStart () |
virtual bool | columnEnd () |
virtual bool | columnsEnd () |
virtual bool | rowsStart () |
virtual bool | rowStart () |
virtual bool | fieldStart () |
virtual bool | fieldEnd () |
virtual bool | rowEnd () |
virtual bool | rowsEnd () |
virtual bool | beginStart () |
virtual bool | beginEnd () |
virtual bool | commitStart () |
virtual bool | commitEnd () |
virtual bool | error (int64_t errornumber, const char *errormessage) |
virtual bool | exportEnd () |
void | setExcludeRow (bool excluderow) |
bool | getExcludeRow () |
void | setCurrentRow (uint64_t currentrow) |
uint64_t | getCurrentRow () |
void | setCurrentColumn (uint32_t currentcol) |
uint32_t | getCurrentColumn () |
void | setCurrentColumnName (const char *currentcolname) |
const char * | getCurrentColumnName () |
void | setCurrentField (const char *currentfield) |
const char * | getCurrentField () |
void | setIsNumericColumn (uint64_t index, bool numeric) |
bool | getIsNumericColumn (uint64_t index) |
void | clearAreNumericColumns () |
void | setExportedRowCount (uint64_t exportedrowcount) |
The sqlrexportcsvjsondomnode class implements sqlrexport to a json domnode, in a format similar to the DOM tree that the rudiments class csvdom defines to represent a CSV, though it uses the rules defined for representing JSON by the rudiments class jsondom.
sqlrexportcsvjsondomnode::sqlrexportcsvjsondomnode | ( | ) |
Creates an instance of the sqlrexportcsvjsondomnode class.
|
virtual |
Destroys this instance of the sqlrexportcsvjsondomnode class.
|
virtual |
Exports the result set of the cursor currently in use as set by the most recent call to setSqlrCursor() to the JSON domnode set by the most recent call to setJsonDomNode() in a format the represents the data using JSON.
The following result set:
0,0.0,field00,field01 1,1.1,field10,field11
would be represented like:
<h t="a"> <v t="s" v="col1"> <v t="s" v="col2"> <v t="s" v="col3"> <v t="s" v="col4"> </h> <r t="a"> <v t="n" v="0"> <v t="n" v="0.0"> <v t="s" v="field00"> <v t="s" v="field01"> </r> <r t="a"> <v t="n" v="1"> <v t="n" v="1.1"> <v t="s" v="field10"> <v t="s" v="field11"> </r>
This format is similar to the DOM tree that the rudiments class csvdom defines to represent a CSV, though it uses the rules defined for representing JSON by the rudiments class jsondom.
It consists of a "h"(eader) array, each "v"(alue) of which contains a "t"(ype) attribute of either "s"(tring) or "n"(umber) and a "v"(alue) attribute containing the column name.
It also consists of "r"(ecord) arrays, each "v"(alue) of which also contains a "t"(ype) attribute of either "s"(tring) or "n"(umber) and a "v"(alue).
The "h"(eader) and "r"(ecord) nodes are inspired by the CSV representation defined by csvdom, but the nodes of the tree are all consistent with the JSON representation defined by jsondom. As such, the tree can be operated on by methods that can operate on a jsondom tree.
Note that since there is no tag representing the set of records/rows, rather the tag for an each record/row is just appeneded to the top-level tag, there is no "rows domnode". As such, this method never calls setRowsDomNode(), and getRowsDomNode() always return NULL.
Returns true on success and false if an error occurred.
Reimplemented from sqlrexportdomnode.