SQL Relay C++ API
|
#include <sqlrimport.h>
Inherited by sqlrimportfile [virtual]
.
Public Member Functions | |
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 () |
virtual bool | importData () |
uint64_t | getImportedRowCount () |
Protected Member Functions | |
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 sqlrimport class provides a base class for child classes that wish to implement import of data from a file into a database, via SQL Relay. It provides various common methods. Each child class must implement the importData() method.
sqlrimport::sqlrimport | ( | ) |
Creates an instance of the sqlrimport class.
|
virtual |
Destroys this instance of the sqlrimport class.
|
protectedvirtual |
This method should be called after a begin().
This implementation just returns true but a child class may override this method to do something else.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called before a begin().
This implementation just returns true but a child class may override this method to do something else.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protected |
Clears the data types of all columns, setting them to to non-date/time.
Not commonly called by implementations of the *Start/End() methods.
|
protected |
Clears the data types of all columns, setting them to to non-numeric.
Not commonly called by implementations of the *Start/End() methods.
|
protectedvirtual |
This method should be called after the import of each column.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Note that this method is called whether or not a column is ignored. For example... If setIgnoreColums(true) has been called, then this method will still be called for each column. If setIgnoreColumnsWithEmptyNames(true) has been called, then this method will still be called for each column, whether it is empty or not. getCurrentColumnName() will also return the (possibly empty) column name.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called after the import of the columns.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called prior to the import of the columns.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called prior to the import of each column.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
If you want to modify the value of the column name that is going to be imported, this is a good method to override and call setCurrentColumnName(). Note that setCurrentColumnName() takes a char *, not a const char * argument. A buffer must be allocated, populated, and passed in to it, and that buffer will eventually be deallocated by this class. Plan accordingly.
Note that this method is called whether or not a column is ignored. For example... If setIgnoreColums(true) has been called, then this method will still be called for each column. If setIgnoreColumnsWithEmptyNames(true) has been called, then this method will still be called for each column, whether it is empty or not. getCurrentColumnName() will also return the (possibly empty) column name.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called after a commit().
This implementation just returns true but a child class may override this method to do something else.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called before a commit().
This implementation just returns true but a child class may override this method to do something else.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called if a commit(), begin(), executeQuery(), or other database operation fails.
This implementation just returns false but a child class may override this method to do something else.
Should return true if import may continue, or false if should stop.
|
protectedvirtual |
This method should be called after the import of each field.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Note that this method is called whether or not a column or row is ignored or excluded. For example... If setIgnoreColumnsWithEmptyNames(true) has been called, then this method will still be called for each column, whether it is empty or not. getCurrentColumnName() will also return the (possibly empty) column name. If setIgnoreEmptyRows(true) has been called then this method will still be called for each column of each empty row. getCurrentField() will also return the (possibly empty) field.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called prior to the import of each field.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
If you want to modify the value of the field that is going to be imported, this is a good method to override and call setCurrentField(). Note that setCurrentField() takes a char *, not a const char * argument. A buffer must be allocated, populated, and passed in to it, and that buffer will eventually be deallocated by this class. Plan accordingly.
Note that this method is called whether or not a column or row is ignored or excluded. For example... If setIgnoreColumnsWithEmptyNames(true) has been called, then this method will still be called for each column, whether it is empty or not. getCurrentColumnName() will also return the (possibly empty) column name. If setIgnoreEmptyRows(true) has been called then this method will still be called for each column of each empty row. getCurrentField() will also return the (possibly empty) field.
Should return true on success and false if an error occurred and import should stop if this method return false.
uint8_t sqlrimport::getCoarseLogLevel | ( | ) |
Returns the coarse log level.
uint64_t sqlrimport::getCommitCount | ( | ) |
Returns the commit count.
|
protected |
Gets the index of the column that is currently being imported.
May be called by implementations of the *Start/End() methods.
|
protected |
Gets the name of the column that is currently being imported.
May be called by implementations of the *Start/End() methods.
|
protected |
Gets the value of the field that is currently being imported.
May be called by implementations of the *Start/End() methods.
|
protected |
Gets the index of the row that is currently being imported.
May be called by implementations of the *Start/End() methods.
const char * sqlrimport::getDateDelimiters | ( | ) |
Returns the value of the most recent call to setDateDelimiters() or NULL if setDateDelimiters() has never been called.
const char * sqlrimport::getDateTimeFormat | ( | ) |
Returns the value of the most recent call to setDateTimeFormat() or "YYYY-MM-DD HH24:MI:SS" if setDateTimeFormat() has never been called.
const char * sqlrimport::getDbType | ( | ) |
Returns the database type as set by setDbType().
bool sqlrimport::getDdMm | ( | ) |
|
protected |
Gets whether the current row of will be excluded or not. Rows that are excluded are not imported.
May be called by implementations of the *Start/End() methods.
uint8_t sqlrimport::getFineLogLevel | ( | ) |
Returns the fine log level.
bool sqlrimport::getIgnoreColumns | ( | ) |
Returns whether or not column information will be ignored.
bool sqlrimport::getIgnoreColumnsWithEmptyNames | ( | ) |
Returns whether or not columns with empty names will be ignored.
bool sqlrimport::getIgnoreEmptyRows | ( | ) |
Returns whether or not empty rows will be ignored.
uint64_t sqlrimport::getImportedRowCount | ( | ) |
Returns the number of rows that were imported by the most recent call to importData(), or the current number of rows that have been imported, if called from inside one of the Start()/End() methods.
bool sqlrimport::getInsertPrimaryKey | ( | ) |
Returns whether or not a primary key will be inserted, as set by insertPrimaryKey().
|
protected |
Get whether the data type of the column in position "index" is a date/time type or not.
May be called by implementations of the *Start/End() methods.
|
protected |
Get whether the data type of the column in position "index" is a numeric type or not.
May be called by implementations of the *Start/End() methods.
uint16_t sqlrimport::getLastCenturyThreshold | ( | ) |
Returns the value of the most recent call to setLastCenturyThreshold() or 10 if setLastCenturyThreshold() has never been called.
bool sqlrimport::getLogErrors | ( | ) |
Returns true if SQL errors will be logged at the coarse log level and false otherwise.
logger * sqlrimport::getLogger | ( | ) |
Returns the logger that is set to use when logging progress or NULL if no logger is set.
uint32_t sqlrimport::getLogIndent | ( | ) |
Returns the log indent.
bool sqlrimport::getLowerCaseColumnNames | ( | ) |
Returns true if column names are lower-cased and false otherwise.
const char * sqlrimport::getMappedColumnName | ( | const char * | from | ) |
Returns the name that "from" is mapped to, or NULL if "from" is not mapped to anything.
const char * sqlrimport::getMappedFieldValue | ( | const char * | from | ) |
Returns the value that "from" is mapped to, or NULL if "from" is not mapped to anything.
bool sqlrimport::getMixedCaseColumnNames | ( | ) |
Returns true if column names are left as-is and false otherwise.
uint16_t sqlrimport::getNoCenturyThreshold | ( | ) |
Returns the value of the most recent call to setNoCenturyThreshold() or 100 if setNoCenturyThreshold() has never been called.
const char * sqlrimport::getObjectName | ( | ) |
Returns the object name as set by setObjectName().
uint32_t sqlrimport::getPrimaryKeyColumnIndex | ( | ) |
Returns the primary key column index as set by insertPrimaryKey() or 0 if insertPrimaryKey() was never called, or if removePrimaryKey() was called.
const char * sqlrimport::getPrimaryKeyColumnName | ( | ) |
Returns the primary key column name as set by insertPrimaryKey() or NULL if insertPrimaryKey() was never called, or if removePrimaryKey() was called.
const char * sqlrimport::getPrimaryKeySequence | ( | ) |
Returns the primary key column sequence as set by insertPrimaryKey() or NULL if insertPrimaryKey() was never called, or if removePrimaryKey() was called.
bool sqlrimport::getReformatDateTime | ( | ) |
Returns whether or not date/time fields will be reformatted prior to import.
sqlrconnection * sqlrimport::getSqlrConnection | ( | ) |
Returns the instance of sqlrconnection that this instance is configured to use to insert data for the import.
sqlrcursor * sqlrimport::getSqlrCursor | ( | ) |
Returns the instance of sqlrursor that this instance is configured to use to insert data for the import.
const char * sqlrimport::getStaticValue | ( | uint32_t | index | ) |
Returns the static value that will be inserted at "index" as set by insertStaticValue() or NULL if insertStaticValue() was never called, or if removeStaticValue() was called.
const char * sqlrimport::getStaticValueColumnName | ( | uint32_t | index | ) |
Returns the column name for the static value that will be inserted at "index" as set by insertStaticValue() or NULL if insertStaticValue() was never called, or if removeStaticValue() was called.
uint32_t sqlrimport::getStaticValueCount | ( | ) |
Returns the number of static values that will be inserted as set by calls to insertStaticValue() or 0 if insertStaticValue() was never called, or if removeStaticValue() was called.
bool sqlrimport::getUpperCaseColumnNames | ( | ) |
Returns true if column names are upper-cased and false otherwise.
bool sqlrimport::getYyyyDdMm | ( | ) |
Returns the value of the most recent call to setYyyyDdMm() or false if setYyyyDdMm() has never been called.
|
virtual |
Imports data.
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.
Note that that default implementation of this method just returns true. Child classes should override this method.
Reimplemented in sqlrimportcsv, sqlrimportfile, and sqlrimportxml.
|
protectedvirtual |
This method should be called at the end of the import process.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called at the beginning of the import process.
This implementation just returns true but a child class may override this method to do something else.
At this point...
Should return true on success and false if an error occurred and import should stop if this method return false.
void sqlrimport::insertPrimaryKey | ( | const char * | primarykeycolumnname, |
uint32_t | primarykeycolumnindex, | ||
const char * | primarykeysequence ) |
Inserts a primary key at "primarykeycolumnindex".
If setIgnoreColumns(false) is set (the default) then "primarykeycolumnname" must be supplied. Otherwise it can be set to NULL or an empty string.
If "primarykeycolumnsequence" is non-empty and non-null then nextval('"primarykeycolumnsequence"') will be used to generate the key. Otherwise a NULL will be used in an attempt to trigger an autoincrement/serial column to generate a key.
void sqlrimport::insertStaticValue | ( | const char * | columnname, |
uint32_t | columnindex, | ||
const char * | value ) |
Inserts static value "value" at "columnindex" for all rows.
If setIgnoreColumns(false) is set (the default) then "columnname" must be supplied. Otherwise it can be set to NULL or an empty string.
void sqlrimport::mapColumnName | ( | const char * | from, |
const char * | to ) |
Maps column name "from" to "to". If "to" is NULL then the column is unmapped.
void sqlrimport::mapFieldValue | ( | const char * | from, |
const char * | to ) |
Maps field value "from" to "to". If "to" is NULL then the field is unmapped.
void sqlrimport::removePrimaryKey | ( | ) |
Removes any primary key configuaration set by a prior call to insertPrimaryKey().
void sqlrimport::removeStaticValue | ( | uint32_t | columnindex | ) |
Removes any static value configuaration at "columnindex" set by a prior call to insertStaticValue().
|
protectedvirtual |
This method should be called after the import of each row.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Note that this method is called whether or not a row is ignored or excluded. For example... If setIgnoreEmptyRows(true) has been called then this method will still be called for each empty row.
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called after the import of the rows.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called prior to the import of the rows.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
Should return true on success and false if an error occurred and import should stop if this method return false.
|
protectedvirtual |
This method should be called prior to the import of each row.
This implementation just returns true but a child class may override this method to do something else.
At this point, unless specifically set otherwise in an overridden method...
This is a good place to call setExcludeRow(true) if you don't want this row to be imported.
Note that this method is called whether or not a row is ignored or excluded. For example... If setIgnoreEmptyRows(true) has been called then this method will still be called for each empty row.
Should return true on success and false if an error occurred and import should stop if this method return false.
void sqlrimport::setCoarseLogLevel | ( | uint8_t | coarseloglevel | ) |
Sets the coarse log level. General log messages will be logged at this level. If the log level of "lg" (set by setLogger() above) is set equal to or greater than "coarseloglevel" then general log messages will be logged. Defaults to 0.
void sqlrimport::setCommitCount | ( | uint64_t | commitcount | ) |
Call commit after every "commitcount" inserts. If set to 0 then no commits will be called and the commit behavior will depend on the behavior of the instance of sqlrelay that we are connecting to. Defaults to 0.
|
protected |
Sets the index of the column that is currently being imported.
Not commonly called by implementations of the *Start/End() methods.
|
protected |
Sets the name of the column that is currently being imported.
Note that "currentcolname" is a char *, not a const char *. Whatever value it is set to will eventually be freed by this class. Set "currentcolname" accordingly.
May be called by columnStart(). Not commonly called by other *Start/End() methods.
|
protected |
Sets the value of the field that is currently being imported.
Note that "currentfield" is a char *, not a const char * argument. A buffer must be allocated, populated, and passed in to it, and that buffer will eventually be deallocated by this class. Plan accordingly.
Not commonly called by implementations of the *Start/End() methods.
|
protected |
Sets the index of the row that is currently being imported.
Not commonly called by implementations of the *Start/End() methods.
void sqlrimport::setDateDelimiters | ( | const char * | datedelimiters | ) |
If setReformatDateTime(true) has been called, then...
Sets the set of characters that will be used to parse dates to "datedelimiters".
Defaults to NULL which implies "/-.:".
Has no effect if setReformatDateTime(false) has been called or if setReformatDateTime() has never been called.
void sqlrimport::setDateTimeFormat | ( | const char * | datetimeformat | ) |
If setReformatDateTime(true) has been called, then...
Sets the format to use when reformatting date/times to "datetimeformat".
Defaults to "YYYY-MM-DD HH24:MI:SS".
Has no effect if setReformatDateTime(false) has been called or if setReformatDateTime() has never been called.
void sqlrimport::setDbType | ( | const char * | dbtype | ) |
Sets the database type, which impacts how things like escaping, sequences, and auto-increment fields are handled. Should be one of "postgresql", "mysql", "firebird", "oracle", "db2", or "informix". Or may be left empty or NULL for generic handling. Defaults to NULL.
void sqlrimport::setDdMm | ( | bool | ddmm | ) |
If setReformatDateTime(true) has been called, then...
If "ddmm" is set true then date/time fields in formats like xx/xx/xxxx, xx-xx-xxxx, xx.xx.xxxx, etc. will be interpreted as DD/MM/YYYY rather than MM/DD/YYYY.
If "ddmm" is set false then date/time fields in formats like xx/xx/xxxx, xx-xx-xxxx, xx.xx.xxxx, etc. will be interpreted as MM/DD/YYYY rather than MM/DD/YYYY.
Defaults to false.
Has no effect if setReformatDateTime(false) has been called or if setReformatDateTime() has never been called.
|
protected |
Sets whether the current row will be excluded or not. Rows that are excluded are not imported.
May be called by implementations of rowStart(). Not commonly called by other *Start/End() methods.
void sqlrimport::setFineLogLevel | ( | uint8_t | fineloglevel | ) |
Sets the fine log level. Detailed log messages will be logged at this level. If the log level of "lg" (set by setLogger() above) is set equal to or greater than "coarseloglevel" then general log messages will be logged. Defaults to 9.
void sqlrimport::setIgnoreColumns | ( | bool | ignorecolumns | ) |
If "ignorecolumns" is set false, then column information will be read from the import (eg. from the CSV header, from XML tags inside of the file, etc.) and used to define the column-order of the import data, which may be different from the column-order of the table, and may exclude nullable columns.
If "ignorecolumns" is set true, then any column information included in the import will be ignored. Import data will be assumed to be in the same column-order as the column-order of the table. This is useful, for example, when a CSV header contains different column names than the table.
Defaults to false.
void sqlrimport::setIgnoreColumnsWithEmptyNames | ( | bool | ignorecolumnswithemptynames | ) |
If "ignorecolumnswithemptynames" is set true, then columns with empty column names will be completely ignored. It will be as if those columns are completely absent from the CSV, which may be important to keep in mind when specifying indexes for primary keys or static values.
Note that "ignorecolumsnwithemptynames" is observed even if setIgnoreColumns(true) is set.
void sqlrimport::setIgnoreEmptyRows | ( | bool | ignoreemptyrows | ) |
Configures the instance to ignore empty rows.
|
protected |
Sets the number of rows that have been imported.
Not commonly called by implementations of the *Start/End() methods.
|
protected |
Sets whether the data type of the column in position "index" is a date/time type or not. If "datetime" is true then the type of the column is set to date/time. If "datetime" is false then the type of the column is set to non-date/time.
Not commonly called by implementations of the *Start/End() methods.
|
protected |
Sets whether the data type of the column in position "index" is a numeric type or not. If "numeric" is true then the type of the column is set to numeric. If "numeric" is false then the type of the column is set to non-numeric.
Not commonly called by implementations of the *Start/End() methods.
void sqlrimport::setLastCenturyThreshold | ( | uint16_t | lastcenturythreshold | ) |
If setReformatDateTime(true) has been called, then...
Sets the threshold for detecting whether a date that does not contain a century is meant to refer to the current or previous century.
Works in conjunction with setNoCenturyThreshold().
Eg. if set to 10 then
Eg. if set to 0 then
Defaults to 10.
Has no effect if setReformatDateTime(false) has been called or if setReformatDateTime() has never been called.
void sqlrimport::setLogErrors | ( | bool | logerrors | ) |
If "logerrors" is set true then SQL errors will be logged at the coarse log level. If set false then SQL errors will not be logged. Defaults to false.
void sqlrimport::setLogger | ( | logger * | lg | ) |
Sets the logger to use when logging progress to "lg". If "lg" is set to NULL then progress will not be logged. Defaults to NULL.
void sqlrimport::setLogIndent | ( | uint32_t | logindent | ) |
Sets the log indent level to "logindent". Defaults to 0.
void sqlrimport::setLowerCaseColumnNames | ( | ) |
Lower-cases colum names.
void sqlrimport::setMixedCaseColumnNames | ( | ) |
Leaves column names as-is.
void sqlrimport::setNoCenturyThreshold | ( | uint16_t | nocenturythreshold | ) |
If setReformatDateTime(true) has been called, then...
Sets the threshold for detecting that a date does not contain a century.
Works in conjunction with setLastCenturyThreshold().
Eg. if set to 100 then
Eg. if set to 0 then
Defaults to 100.
Has no effect if setReformatDateTime(false) has been called or if setReformatDateTime() has never been called.
void sqlrimport::setObjectName | ( | const char * | objectname | ) |
By default, the name of the table or sequence to import data into is derived from the import file (eg. from the CSV file name, or from an XML tag inside of the file). This method may be used to explicitly override that name, or provide one if none can be derived.
void sqlrimport::setReformatDateTime | ( | bool | reformatdatetime | ) |
If "reformatdatetime" is set true then date/time fields will be reformatted prior to import according to rules defined by setDdMm(), setYyyyDdMm(),setDateDelimiters(), setNoCenturyThreshold(), setLastCenturyThreshold(), and setDateTimeFormat().
If "reformatdatetime" is set false then date/time fields will be not reformatted prior to import.
Defaults to false.
void sqlrimport::setSqlrConnection | ( | sqlrconnection * | sqlrcon | ) |
Sets the instance of sqlrconnection that this instance will use to insert data for the import.
void sqlrimport::setSqlrCursor | ( | sqlrcursor * | sqlrcur | ) |
Sets the instance of sqlrcursor that this instance will use to insert data for the import.
void sqlrimport::setUpperCaseColumnNames | ( | ) |
Upper-cases colum names.
void sqlrimport::setYyyyDdMm | ( | bool | yyyyddmm | ) |
If setReformatDateTime(true) has been called, then...
If "yyyyddmm" is set true then date/time fields in formats like xxxx/xx/xx, xxxx-xx-xx, xxxx.xx.xx, etc. will be interpreted as YYYY/DD/MM rather than YYYY/MM/DD.
If "yyyyddmm" is set false then date/time fields in formats like xxxx/xx/xx, xxxx-xx-xx, xxxx.xx.xx, etc. will be interpreted as YYYY/MM/DD rather than YYYY/MM/DD.
Defaults to false.
Has no effect if setReformatDateTime(false) has been called or if setReformatDateTime() has never been called.