Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
SoftwareAndServices::Library::Database::DataTypeBase Class Referenceabstract

A base object for DataType objects. More...

#include <SaS/Sql/SQL.hpp>

+ Inheritance diagram for SoftwareAndServices::Library::Database::DataTypeBase:
+ Collaboration diagram for SoftwareAndServices::Library::Database::DataTypeBase:

Public Member Functions

 DataTypeBase (SQL::SqlDataType_e Dt)
 DataTypeBase - Constructor. More...
 
virtual ~DataTypeBase ()
 DataTypeBase - Destructor. More...
 
std::vector< int32_t > * Array () const
 Get the array information. More...
 
const char * ArraySpecs (const char *Format=NULL) const
 Print the array specifications, or NONE when they do not exist. More...
 
virtual const char * BaseType () const =0
 Get the C++ base type name. More...
 
virtual DataTypeBaseCopy () const =0
 Copy method. More...
 
virtual InstanceCount_t decInstance () const
 Decrement the instance. More...
 
void Dim (uint32_t Dim, int32_t DimSize)
 Set the maximum dimension (may grow). More...
 
virtual bool fromString (const char *TheValue)=0
 Convert the object value from a string. More...
 
bool fromString (const String &TheValue)
 Convert the object value from a string. More...
 
bool fromString (const std::string &TheValue)
 Convert the object value from a string. More...
 
virtual InstanceCount_t getInstance () const
 
virtual InstanceCount_t incInstance () const
 Increment the instance. More...
 
void operator delete (void *ToFree)
 
virtual const char * toString () const =0
 Convert the object value to a string. More...
 
SQL::SqlDataType_e Type () const
 
void Type (SQL::SqlDataType_e Dt)
 Set the SqlDataType_e for this object. More...
 

Static Public Member Functions

static bool GenExtractUtcTime_t (const char *ColName, String &Results)
 Generate an SQL statement that will extract a TIMESTAMP to UTC, as a time_t value as a (char*). More...
 
static bool ToSqlTime (time_t TheTimeT, String &Results)
 Convert a time_t in UTC, to a value acceptable to SQL as a timestamp. More...
 

Protected Attributes

std::vector< int32_t > * _ArrayInfo
 When an array, this pointer will be NON-NULL. More...
 
SQL::SqlDataType_e _Dt
 The data type. More...
 
char * _ToStringCache
 When non-NULL, the object value as a (char*). More...
 

Detailed Description

A base object for DataType objects.

Definition at line 1800 of file SQL.hpp.

Constructor & Destructor Documentation

◆ DataTypeBase()

SoftwareAndServices::Library::Database::DataTypeBase::DataTypeBase ( SQL::SqlDataType_e  Dt)

DataTypeBase - Constructor.

Parameters
DtThe type of data type.

◆ ~DataTypeBase()

virtual SoftwareAndServices::Library::Database::DataTypeBase::~DataTypeBase ( )
virtual

DataTypeBase - Destructor.

Member Function Documentation

◆ Array()

std::vector<int32_t>* SoftwareAndServices::Library::Database::DataTypeBase::Array ( ) const

Get the array information.

Returns
The array information, or NULL when NOT an array.

◆ ArraySpecs()

const char* SoftwareAndServices::Library::Database::DataTypeBase::ArraySpecs ( const char *  Format = NULL) const

Print the array specifications, or NONE when they do not exist.

([][], [3][10], ...)

Parameters
FormatWhen non-NULL, format using snprintf. When non-NULL a single 's' will be replaced with the results.

Example, Called with "SQLBIGINTs' could return with: SQLBIGINT[][], SQLBIGINT[3][10], or when there are no dimensions SQLBIGINT.

Note
The results are overwritten on each call.
Returns
The array specification optionally formatted with Format.

◆ BaseType()

virtual const char* SoftwareAndServices::Library::Database::DataTypeBase::BaseType ( ) const
pure virtual

Get the C++ base type name.

(int32_t, SQLTIMESTAMP, double, (char*), ...)

Implemented in SoftwareAndServices::Library::Database::SQLDOMAIN, SoftwareAndServices::Library::Database::SQLENUM, SoftwareAndServices::Library::Database::SQLTIMESTAMP, SoftwareAndServices::Library::Database::SQLTIMESTAMPTZ, SoftwareAndServices::Library::Database::SQLCIDR, SoftwareAndServices::Library::Database::SQLINET, SoftwareAndServices::Library::Database::SQLDATETIME, SoftwareAndServices::Library::Database::SQLVARCHAR, SoftwareAndServices::Library::Database::SQLDATE, SoftwareAndServices::Library::Database::SQLLINE, SoftwareAndServices::Library::Database::SQLBIT, SoftwareAndServices::Library::Database::SQLBOX, SoftwareAndServices::Library::Database::SQLLSEG, SoftwareAndServices::Library::Database::SQLTIME, SoftwareAndServices::Library::Database::SQLTIMETZ, SoftwareAndServices::Library::Database::SQLCIRCLE, SoftwareAndServices::Library::Database::SQLTSRANGE, SoftwareAndServices::Library::Database::SQLTSTZRANGE, SoftwareAndServices::Library::Database::SQLDATERANGE, SoftwareAndServices::Library::Database::SQLINT4RANGE, SoftwareAndServices::Library::Database::SQLINT8RANGE, SoftwareAndServices::Library::Database::SQLNUMERIC, SoftwareAndServices::Library::Database::SQLVARBINARY, SoftwareAndServices::Library::Database::SQLBINARY, SoftwareAndServices::Library::Database::SQLPOINT, SoftwareAndServices::Library::Database::SQLDOUBLEPRECISION, SoftwareAndServices::Library::Database::SQLSERIAL, SoftwareAndServices::Library::Database::SQLSMALLSERIAL, SoftwareAndServices::Library::Database::SQLCHAR, SoftwareAndServices::Library::Database::SQLINTEGER, SoftwareAndServices::Library::Database::SQLSMALLINT, SoftwareAndServices::Library::Database::SQLBIGINT, SoftwareAndServices::Library::Database::SQLBIGSERIAL, SoftwareAndServices::Library::Database::SQLPATH, SoftwareAndServices::Library::Database::SQLPOLYGON, SoftwareAndServices::Library::Database::SQLMACADDR, SoftwareAndServices::Library::Database::SQLBOOLEAN, SoftwareAndServices::Library::Database::SQLBYTEA, SoftwareAndServices::Library::Database::SQLREAL, SoftwareAndServices::Library::Database::SQLUUID, SoftwareAndServices::Library::Database::SQLMONEY, SoftwareAndServices::Library::Database::SQLTSVECTOR, and SoftwareAndServices::Library::Database::SQLTEXT.

◆ Copy()

virtual DataTypeBase* SoftwareAndServices::Library::Database::DataTypeBase::Copy ( ) const
pure virtual

Copy method.

Returns
A pointer to the new object.

Implemented in SoftwareAndServices::Library::Database::SQLDOMAIN, SoftwareAndServices::Library::Database::SQLTIMESTAMP, SoftwareAndServices::Library::Database::SQLTIMESTAMPTZ, SoftwareAndServices::Library::Database::SQLDATETIME, SoftwareAndServices::Library::Database::SQLDATE, SoftwareAndServices::Library::Database::SQLCIDR, SoftwareAndServices::Library::Database::SQLINET, SoftwareAndServices::Library::Database::SQLENUM, SoftwareAndServices::Library::Database::SQLTSRANGE, SoftwareAndServices::Library::Database::SQLTSTZRANGE, SoftwareAndServices::Library::Database::SQLINT4RANGE, SoftwareAndServices::Library::Database::SQLINT8RANGE, SoftwareAndServices::Library::Database::SQLDATERANGE, SoftwareAndServices::Library::Database::SQLLINE, SoftwareAndServices::Library::Database::SQLVARCHAR, SoftwareAndServices::Library::Database::SQLBOX, SoftwareAndServices::Library::Database::SQLLSEG, SoftwareAndServices::Library::Database::SQLBIT, SoftwareAndServices::Library::Database::SQLTIME, SoftwareAndServices::Library::Database::SQLTIMETZ, SoftwareAndServices::Library::Database::SQLVARBINARY, SoftwareAndServices::Library::Database::SQLBINARY, SoftwareAndServices::Library::Database::SQLCIRCLE, SoftwareAndServices::Library::Database::SQLNUMERIC, SoftwareAndServices::Library::Database::SQLPOINT, SoftwareAndServices::Library::Database::SQLPATH, SoftwareAndServices::Library::Database::SQLPOLYGON, SoftwareAndServices::Library::Database::SQLSERIAL, SoftwareAndServices::Library::Database::SQLSMALLSERIAL, SoftwareAndServices::Library::Database::SQLDOUBLEPRECISION, SoftwareAndServices::Library::Database::SQLINTEGER, SoftwareAndServices::Library::Database::SQLMACADDR, SoftwareAndServices::Library::Database::SQLSMALLINT, SoftwareAndServices::Library::Database::SQLBIGINT, SoftwareAndServices::Library::Database::SQLBIGSERIAL, SoftwareAndServices::Library::Database::SQLCHAR, SoftwareAndServices::Library::Database::SQLBOOLEAN, SoftwareAndServices::Library::Database::SQLUUID, SoftwareAndServices::Library::Database::SQLREAL, SoftwareAndServices::Library::Database::SQLMONEY, SoftwareAndServices::Library::Database::SQLTSVECTOR, SoftwareAndServices::Library::Database::SQLTEXT, and SoftwareAndServices::Library::Database::SQLBYTEA.

◆ decInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< DataTypeBase >::decInstance ( ) const
inlinevirtualinherited

Decrement the instance.

Returns
The instance count, after decrementing it.

Definition at line 129 of file instance.hpp.

◆ Dim()

void SoftwareAndServices::Library::Database::DataTypeBase::Dim ( uint32_t  Dim,
int32_t  DimSize 
)

Set the maximum dimension (may grow).

Parameters
DimNumberThe number of dimensions. When DimNumber is greater than the current number of dimensions, it is incremented. When less, only the size is set.
DimSizeThe size of dimension DimNumber.

◆ fromString() [1/3]

virtual bool SoftwareAndServices::Library::Database::DataTypeBase::fromString ( const char *  TheValue)
pure virtual

Convert the object value from a string.

Parameters
TheValueThe value to convert to the data type.

Implemented in SoftwareAndServices::Library::Database::SQLDOMAIN, SoftwareAndServices::Library::Database::SQLTIMESTAMP, SoftwareAndServices::Library::Database::SQLTIMESTAMPTZ, SoftwareAndServices::Library::Database::SQLDATETIME, SoftwareAndServices::Library::Database::SQLCIDR, SoftwareAndServices::Library::Database::SQLINET, SoftwareAndServices::Library::Database::SQLDATE, SoftwareAndServices::Library::Database::SQLTSRANGE, SoftwareAndServices::Library::Database::SQLTSTZRANGE, SoftwareAndServices::Library::Database::SQLINT4RANGE, SoftwareAndServices::Library::Database::SQLINT8RANGE, SoftwareAndServices::Library::Database::SQLDATERANGE, SoftwareAndServices::Library::Database::SQLLINE, SoftwareAndServices::Library::Database::SQLVARCHAR, SoftwareAndServices::Library::Database::SQLBOX, SoftwareAndServices::Library::Database::SQLLSEG, SoftwareAndServices::Library::Database::SQLBIT, SoftwareAndServices::Library::Database::SQLTIME, SoftwareAndServices::Library::Database::SQLTIMETZ, SoftwareAndServices::Library::Database::SQLVARBINARY, SoftwareAndServices::Library::Database::SQLBINARY, SoftwareAndServices::Library::Database::SQLCIRCLE, SoftwareAndServices::Library::Database::SQLNUMERIC, SoftwareAndServices::Library::Database::SQLPOINT, SoftwareAndServices::Library::Database::SQLPATH, SoftwareAndServices::Library::Database::SQLPOLYGON, SoftwareAndServices::Library::Database::SQLSERIAL, SoftwareAndServices::Library::Database::SQLSMALLSERIAL, SoftwareAndServices::Library::Database::SQLDOUBLEPRECISION, SoftwareAndServices::Library::Database::SQLINTEGER, SoftwareAndServices::Library::Database::SQLMACADDR, SoftwareAndServices::Library::Database::SQLSMALLINT, SoftwareAndServices::Library::Database::SQLBIGINT, SoftwareAndServices::Library::Database::SQLBIGSERIAL, SoftwareAndServices::Library::Database::SQLCHAR, SoftwareAndServices::Library::Database::SQLUUID, SoftwareAndServices::Library::Database::SQLBOOLEAN, SoftwareAndServices::Library::Database::SQLREAL, SoftwareAndServices::Library::Database::SQLMONEY, SoftwareAndServices::Library::Database::SQLTSVECTOR, SoftwareAndServices::Library::Database::SQLTEXT, and SoftwareAndServices::Library::Database::SQLENUM.

◆ fromString() [2/3]

bool SoftwareAndServices::Library::Database::DataTypeBase::fromString ( const String TheValue)

Convert the object value from a string.

Parameters
TheValueThe value to convert to the data type.

◆ fromString() [3/3]

bool SoftwareAndServices::Library::Database::DataTypeBase::fromString ( const std::string &  TheValue)

Convert the object value from a string.

Parameters
TheValueThe value to convert to the data type.

◆ GenExtractUtcTime_t()

static bool SoftwareAndServices::Library::Database::DataTypeBase::GenExtractUtcTime_t ( const char *  ColName,
String Results 
)
static

Generate an SQL statement that will extract a TIMESTAMP to UTC, as a time_t value as a (char*).

This does not fetch the column value, it generates the SQL SELECT string.

Called with ColName set to created, it will produce the string:

extract(epoch from created at time zone utc)

The results can be used in place of a column name in a SQL SELECT command.

Parameters
ColNameThe SQL table column name.
[out]ResultsWhere the results will be stored. The results will be appended to any existing value in Results.
Returns
true on success.

◆ getInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< DataTypeBase >::getInstance ( ) const
inlinevirtualinherited
Returns
The current instance count.

Definition at line 118 of file instance.hpp.

◆ incInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< DataTypeBase >::incInstance ( ) const
inlinevirtualinherited

Increment the instance.

Returns
The instance value, after incrementing it.

Definition at line 109 of file instance.hpp.

◆ ToSqlTime()

static bool SoftwareAndServices::Library::Database::DataTypeBase::ToSqlTime ( time_t  TheTimeT,
String Results 
)
static

Convert a time_t in UTC, to a value acceptable to SQL as a timestamp.

Parameters
TheTimeTThe time_t value.
ResultsWhere the results will be appended.
Returns
true if converted.

◆ toString()

virtual const char* SoftwareAndServices::Library::Database::DataTypeBase::toString ( ) const
pure virtual

Convert the object value to a string.

Implemented in SoftwareAndServices::Library::Database::SQLDOMAIN, SoftwareAndServices::Library::Database::SQLTIMESTAMP, SoftwareAndServices::Library::Database::SQLTIMESTAMPTZ, SoftwareAndServices::Library::Database::SQLDATETIME, SoftwareAndServices::Library::Database::SQLCIDR, SoftwareAndServices::Library::Database::SQLINET, SoftwareAndServices::Library::Database::SQLDATE, SoftwareAndServices::Library::Database::SQLTSRANGE, SoftwareAndServices::Library::Database::SQLTSTZRANGE, SoftwareAndServices::Library::Database::SQLINT4RANGE, SoftwareAndServices::Library::Database::SQLINT8RANGE, SoftwareAndServices::Library::Database::SQLDATERANGE, SoftwareAndServices::Library::Database::SQLVARCHAR, SoftwareAndServices::Library::Database::SQLLINE, SoftwareAndServices::Library::Database::SQLBIT, SoftwareAndServices::Library::Database::SQLBOX, SoftwareAndServices::Library::Database::SQLLSEG, SoftwareAndServices::Library::Database::SQLTIME, SoftwareAndServices::Library::Database::SQLTIMETZ, SoftwareAndServices::Library::Database::SQLCIRCLE, SoftwareAndServices::Library::Database::SQLVARBINARY, SoftwareAndServices::Library::Database::SQLBINARY, SoftwareAndServices::Library::Database::SQLNUMERIC, SoftwareAndServices::Library::Database::SQLPOINT, SoftwareAndServices::Library::Database::SQLSERIAL, SoftwareAndServices::Library::Database::SQLSMALLSERIAL, SoftwareAndServices::Library::Database::SQLDOUBLEPRECISION, SoftwareAndServices::Library::Database::SQLINTEGER, SoftwareAndServices::Library::Database::SQLSMALLINT, SoftwareAndServices::Library::Database::SQLBIGINT, SoftwareAndServices::Library::Database::SQLBIGSERIAL, SoftwareAndServices::Library::Database::SQLCHAR, SoftwareAndServices::Library::Database::SQLPATH, SoftwareAndServices::Library::Database::SQLPOLYGON, SoftwareAndServices::Library::Database::SQLMACADDR, SoftwareAndServices::Library::Database::SQLUUID, SoftwareAndServices::Library::Database::SQLBOOLEAN, SoftwareAndServices::Library::Database::SQLREAL, SoftwareAndServices::Library::Database::SQLMONEY, SoftwareAndServices::Library::Database::SQLTSVECTOR, SoftwareAndServices::Library::Database::SQLTEXT, and SoftwareAndServices::Library::Database::SQLENUM.

◆ Type() [1/2]

SQL::SqlDataType_e SoftwareAndServices::Library::Database::DataTypeBase::Type ( ) const
Returns
the SqlDataType_e for this object.

◆ Type() [2/2]

void SoftwareAndServices::Library::Database::DataTypeBase::Type ( SQL::SqlDataType_e  Dt)

Set the SqlDataType_e for this object.

Parameters
DtThe data type.

Member Data Documentation

◆ _ArrayInfo

std::vector<int32_t>* SoftwareAndServices::Library::Database::DataTypeBase::_ArrayInfo
protected

When an array, this pointer will be NON-NULL.

Definition at line 1968 of file SQL.hpp.

◆ _Dt

SQL::SqlDataType_e SoftwareAndServices::Library::Database::DataTypeBase::_Dt
protected

The data type.

Definition at line 1963 of file SQL.hpp.

◆ _ToStringCache

char* SoftwareAndServices::Library::Database::DataTypeBase::_ToStringCache
mutableprotected

When non-NULL, the object value as a (char*).

Definition at line 1973 of file SQL.hpp.


The documentation for this class was generated from the following file: