SQL Relay C++ API
Public Member Functions | Protected Member Functions | List of all members
sqlrexportfile Class Reference

#include <sqlrexportfile.h>

Inherits sqlrexport.

Inherited by sqlrexportcsv [virtual], and sqlrexportxml [virtual].

Public Member Functions

 sqlrexportfile ()
 
virtual ~sqlrexportfile ()
 
void setFileName (const char *filename)
 
const char * getFileName ()
 
virtual bool exportData ()
 
- Public Member Functions inherited from sqlrexport
 sqlrexport ()
 
virtual ~sqlrexport ()
 
void setSqlrConnection (sqlrconnection *sqlrcon)
 
void setSqlrCursor (sqlrcursor *sqlrcur)
 
sqlrconnectiongetSqlrConnection ()
 
sqlrcursorgetSqlrCursor ()
 
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 ()
 

Protected Member Functions

void setFileDescriptor (filedescriptor *fd)
 
filedescriptor * getFileDescriptor ()
 
- 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)
 

Detailed Description

The sqlrexportfile class provides a base class for child classes that wish to implement export of data from a database, via SQL Relay, to a file. It provides various common methods. Each child class should implement the exportData() method.

Constructor & Destructor Documentation

◆ sqlrexportfile()

sqlrexportfile::sqlrexportfile ( )

Creates an instance of the sqlrexportfile class.

◆ ~sqlrexportfile()

virtual sqlrexportfile::~sqlrexportfile ( )
virtual

Destroys this instance of the sqlrexportfile class.

Member Function Documentation

◆ exportData()

virtual bool sqlrexportfile::exportData ( )
virtual

Exports the result set of the cursor currently in use as set by the most recent call to setSqlrCursor() to the file currently in use as set by the most recent call to setFileName(), or to standard output if setFileName() was never called or setFileName(NULL) was called.

Returns true on success and false if an error occurred.

Note that the default implementation of this method just returns true. Child classes that support export to a file should override this method.

Reimplemented from sqlrexport.

Reimplemented in sqlrexportcsv, and sqlrexportxml.

◆ getFileDescriptor()

filedescriptor * sqlrexportfile::getFileDescriptor ( )
protected

Gets the file descriptor to which data is being exported.

May be called by implementations of exportData() or by implementations of the *Start/End() methods.

◆ getFileName()

const char * sqlrexportfile::getFileName ( )

Gets the name of the file to which data will be be exported.

May be called by implementations of exportData() or by implementations of the *Start/End() methods.

◆ setFileDescriptor()

void sqlrexportfile::setFileDescriptor ( filedescriptor * fd)
protected

Sets the file descriptor to which data is being exported.

Should be called by implementations of exportData(). Not commonly called by implementations of the *Start/End() methods.

◆ setFileName()

void sqlrexportfile::setFileName ( const char * filename)

Sets the name of the file to which data will be exported. If "filename" is NULL the data will be exported to standard output.

Not commonly called by implementation of exportData() or of the *Start/End() methods.