SQL Relay C++ API
|
#include <sqlrimportxml.h>
Inherits sqlrimportfile, and xmlsax.
Public Member Functions | |
sqlrimportxml () | |
virtual | ~sqlrimportxml () |
virtual bool | importData () |
Public Member Functions inherited from sqlrimportfile | |
sqlrimportfile () | |
virtual | ~sqlrimportfile () |
void | setFileName (const char *filename) |
const char * | getFileName () |
Public Member Functions inherited from sqlrimport | |
sqlrimport () | |
virtual | ~sqlrimport () |
void | setSqlrConnection (sqlrconnection *sqlrcon) |
void | setSqlrCursor (sqlrcursor *sqlrcur) |
sqlrconnection * | getSqlrConnection () |
sqlrcursor * | getSqlrCursor () |
void | insertPrimaryKey (const char *primarykeycolumnname, uint32_t primarykeycolumnindex, const char *primarykeysequence) |
void | removePrimaryKey () |
bool | getInsertPrimaryKey () |
const char * | getPrimaryKeyColumnName () |
uint32_t | getPrimaryKeyColumnIndex () |
const char * | getPrimaryKeySequence () |
void | insertStaticValue (const char *columnname, uint32_t columnindex, const char *value) |
void | removeStaticValue (uint32_t columnindex) |
const char * | getStaticValueColumnName (uint32_t index) |
const char * | getStaticValue (uint32_t index) |
uint32_t | getStaticValueCount () |
void | setDbType (const char *dbtype) |
const char * | getDbType () |
void | setObjectName (const char *objectname) |
const char * | getObjectName () |
void | setIgnoreColumns (bool ignorecolumns) |
bool | getIgnoreColumns () |
void | setIgnoreColumnsWithEmptyNames (bool ignorecolumnswithemptynames) |
bool | getIgnoreColumnsWithEmptyNames () |
void | setIgnoreEmptyRows (bool ignoreemptyrows) |
bool | getIgnoreEmptyRows () |
void | mapColumnName (const char *from, const char *to) |
const char * | getMappedColumnName (const char *from) |
void | setMixedCaseColumnNames () |
bool | getMixedCaseColumnNames () |
void | setLowerCaseColumnNames () |
bool | getLowerCaseColumnNames () |
void | setUpperCaseColumnNames () |
bool | getUpperCaseColumnNames () |
void | mapFieldValue (const char *from, const char *to) |
const char * | getMappedFieldValue (const char *from) |
void | setReformatDateTime (bool reformatdatetime) |
bool | getReformatDateTime () |
void | setDdMm (bool ddmm) |
bool | getDdMm () |
void | setYyyyDdMm (bool yyyyddmm) |
bool | getYyyyDdMm () |
void | setDateDelimiters (const char *datedelimiters) |
const char * | getDateDelimiters () |
void | setNoCenturyThreshold (uint16_t nocenturythreshold) |
uint16_t | getNoCenturyThreshold () |
void | setLastCenturyThreshold (uint16_t lastcenturythreshold) |
uint16_t | getLastCenturyThreshold () |
void | setDateTimeFormat (const char *datetimeformat) |
const char * | getDateTimeFormat () |
void | setCommitCount (uint64_t commitcount) |
uint64_t | getCommitCount () |
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 | getImportedRowCount () |
Additional Inherited Members | |
Protected Member Functions inherited from sqlrimportfile | |
void | setFileDescriptor (filedescriptor *fd) |
filedescriptor * | getFileDescriptor () |
Protected Member Functions inherited from sqlrimport | |
virtual bool | importStart () |
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 | importEnd () |
void | setExcludeRow (bool excluderow) |
bool | getExcludeRow () |
void | setCurrentRow (uint64_t currentrow) |
uint64_t | getCurrentRow () |
void | setCurrentColumn (uint32_t currentcol) |
uint32_t | getCurrentColumn () |
void | setCurrentColumnName (char *currentcolname) |
char * | getCurrentColumnName () |
void | setCurrentField (char *currentfield) |
char * | getCurrentField () |
void | setIsNumericColumn (uint64_t index, bool numeric) |
bool | getIsNumericColumn (uint64_t index) |
void | clearAreNumericColumns () |
void | setIsDateTimeColumn (uint64_t index, bool datetime) |
bool | getIsDateTimeColumn (uint64_t index) |
void | clearAreDateTimeColumns () |
void | setImportedRowCount (uint64_t importedrowcount) |
The sqlrimportxml class implements sqlrimport for XML files, specifically XML files exported by the sqlrexportxml class.
sqlrimportxml::sqlrimportxml | ( | ) |
Creates an instance of the sqlrimportxml class.
|
virtual |
Destroys this instance of the sqlrimportxml class.
|
virtual |
Imports data from the file set by the most recent call to setFileName(). The table or sequence to import the data into will be deried from the name attribute of the table or sequence tag inside the file and may be overridden using setObjectName().
The XML format is as follows.
For a table: (This example is a table of US states, exported from PostgreSQL)
<?xml version="1.0"?>
<column name="state_id" type="int4"> <column name="state_name" type="varchar"> <column name="state_abbreviation" type="varchar"> <column name="latitude" type="numeric"> <column name="longitude" type="numeric"> <column name="creation_date" type="date"> </columns> <rows> <row> <field>1</field> <field>Louisiana</field> <field>LA</field> <field>31.259800</field> <field>-92.658700</field> <field>2005-08-16</field> </row> <row> <field>2</field> <field>Texas</field> <field>TX</field> <field>31.653400</field> <field>-100.546900</field> <field>2005-08-17</field> </row> <row> <field>3</field> <field>Georgia</field> <field>GA</field> <field>32.750300</field> <field>-83.737800</field> <field>2005-08-16</field> </row> </rows>
For a sequence: (This example is a sequence used to generate ids for the table above, exported from PostgreSQL)
<?xml version="1.0"?> <sequence name="state_ids" value="4">
If setCommitCount() was called with a non-zero value then a commit will be called after every "commitcount" rows is inserted. No commit will be called if setCommitCount() was never called, or if setCommitCount(0) was called.
Returns true on success and false if an error occurred.
Reimplemented from sqlrimportfile.