SqlCTypeMetadata Class Reference

Provides access to type metadata information for SQL C types. More...

Inherits Simba::Support::TypeMetadata.

List of all members.

Public Member Functions

void CheckValidity () const
 Throws a BadTypeMetadataException if any metadata is invalid or inconsistent for the type. Ignores values which don't matter for a particular type.
simba_signed_native GetCapacity () const
 Returns the number of bytes available for data storage. For string data this includes room for a null terminator.
simba_unsigned_native GetLengthOrIntervalPrecision () const
 Get the length/interval precision for this metadata object.
simba_int16 GetPrecision () const
 Returns the precision. See comments on SetPrecision().
simba_int16 GetPrecisionForDataConversion ()
 Returns the "precision" value to be used in data conversions.
simba_int16 GetScale () const
 Returns the scale. See comments on SetScale().
simba_int16 GetSqlCType () const
 Get the SQL C type for this metadata object.
bool IsLengthOrIntervalPrecisionDefault ()
 True iff the length/interval leading precision was not set by the application.
bool IsPrecisionDefault ()
 True iff precision was not set by the application.
void SetFixedCapacity (simba_signed_native in_fixedCapacity)
 Sets the fixed capacity for this type. Also sets the m_hasFixedCapacity flag to true.
void SetLengthOrIntervalPrecision (simba_unsigned_native in_lengthOrIntervalPrec)
 Sets the length / interval precision.
void SetLengthOrIntervalPrecisionOverridden ()
 Notifies this object that the default value of lengthOrIntervalPrecision was overridden by the application.
void SetPrecision (simba_int16 in_precision)
 Sets the precision of the type.
void SetPrecisionOverridden ()
 Notifies this object that the default value of precision was overridden by the application.
void SetScale (simba_int16 in_scale)
 Sets the precision of the type. Sets the scale of the type.
 SqlCTypeMetadata (simba_int16 in_sqlCType, bool in_shouldReturnPrecision)
 Constructor. NOTE: A new SqlCTypeMetadata is NOT properly initialized during construction. It is the responsibility of SqlTypeMetadataFactory to initialize instances.
 ~SqlCTypeMetadata ()
 Destructor.

Protected Attributes

bool m_defaultLengthOrIntervalPrecision
 True iff the length/interval leading precision was not set by the application.
bool m_defaultPrecision
 True iff precision was not set by the application.
simba_signed_native m_fixedCapacity
 Fixed capacity in bytes. Ignored if m_hasFixedCapacity is false.
bool m_hasFixedCapacity
 Indicates if the capacity is fixed. If true, then m_fixedCapacity holds the data capacity in bytes. If false, then m_octetLength holds the data capacity in bytes.
simba_unsigned_native m_lengthOrIntervalPrecision
 Length or interval precision.
simba_int16 m_precision
 Precision.
simba_int16 m_scale
 Scale.
bool m_shouldReturnPrecision
 True if returns m_precision when GetPrecisionForDataConversion() is called. m_lengthOrIntervalPrecision is returned otherwise.
simba_int16 m_sqlCType
 SQL C type.

Friends

class SqlCData
class SqlCTypeMetadataFactory

Detailed Description

Provides access to type metadata information for SQL C types.


Constructor & Destructor Documentation

SqlCTypeMetadata ( simba_int16  in_sqlCType,
bool  in_shouldReturnPrecision 
)

Constructor. NOTE: A new SqlCTypeMetadata is NOT properly initialized during construction. It is the responsibility of SqlTypeMetadataFactory to initialize instances.

Parameters:
in_shouldReturnPrecision True if returns m_precision when GetPrecisionForDataConversion() is called.
~SqlCTypeMetadata (  ) 

Destructor.


Member Function Documentation

void CheckValidity (  )  const [virtual]

Throws a BadTypeMetadataException if any metadata is invalid or inconsistent for the type. Ignores values which don't matter for a particular type.

Implements TypeMetadata.

simba_signed_native GetCapacity (  )  const [inline]

Returns the number of bytes available for data storage. For string data this includes room for a null terminator.

simba_unsigned_native GetLengthOrIntervalPrecision (  )  const [inline]

Get the length/interval precision for this metadata object.

See comments on SetLengthOrIntervalPrecision().

Returns:
The length/interval precision.
simba_int16 GetPrecision (  )  const [inline]

Returns the precision. See comments on SetPrecision().

simba_int16 GetPrecisionForDataConversion (  )  [inline]

Returns the "precision" value to be used in data conversions.

This is the value of GetPrecision() for approximate numeric, exact numeric, datetime, and interval types. This is the value of GetLengthOrIntervalPrecision() for all other types.

simba_int16 GetScale (  )  const [inline]

Returns the scale. See comments on SetScale().

simba_int16 GetSqlCType (  )  const [inline]

Get the SQL C type for this metadata object.

Returns:
The SQL C type as defined for ODBC.
bool IsLengthOrIntervalPrecisionDefault (  ) 

True iff the length/interval leading precision was not set by the application.

Returns:
Whether LengthOrIntervalPrecision was explicitly set by the application
bool IsPrecisionDefault (  ) 

True iff precision was not set by the application.

Returns:
Whether Precision was explicitly set by the application
void SetFixedCapacity ( simba_signed_native  in_fixedCapacity  ) 

Sets the fixed capacity for this type. Also sets the m_hasFixedCapacity flag to true.

Parameters:
in_fixedCapacity Capacity to set.
void SetLengthOrIntervalPrecision ( simba_unsigned_native  in_lengthOrIntervalPrec  ) 

Sets the length / interval precision.

This is the number of elements for a character/binary data type, or the number of digits for the fractional component of a datetime or interval type.

This value is used for the SQL_DESC_LENGTH and SQL_DESC_DATETIME_INTERVAL_PRECISION field for SQLGetDescField and SQLSetDescField when the type is not an exact numeric or approximate numeric. It is also used for the SQL_DESC_PRECISION field for a type which is not a datetime or interval, an exact numeric, or an approximate numeric.

NOTE: Interval precisions are expected to fit into the positive part of a simba_int32. If an interval precision goes over, it will be reported through SQLGetDescField as a negative value.

Parameters:
in_lengthOrIntervalPrec 
void SetLengthOrIntervalPrecisionOverridden (  ) 

Notifies this object that the default value of lengthOrIntervalPrecision was overridden by the application.

Causes LengthOrIntervalPrecisionIsDefault() to return false

void SetPrecision ( simba_int16  in_precision  ) 

Sets the precision of the type.

This value is used for the SQL_DESC_PRECISION for SQLGetDescField and SQLSetDescField for approximate numeric, exact numeric, and datetime and interval types. This value is used for SQL_DEC_LENGTH and SQL_DESC_DATETIME_INTERVAL_PRECISION for exact and approximate numeric types. This value is used for SQL_DESC_SCALE for datetime and interval types.

Parameters:
in_precision 
void SetPrecisionOverridden (  ) 

Notifies this object that the default value of precision was overridden by the application.

Causes PrecisionIsDefault() to return false

void SetScale ( simba_int16  in_scale  ) 

Sets the precision of the type. Sets the scale of the type.

This value is used for the SQL_DESC_SCALE field for SQLGetDescField and SQLSetDescField when the type is not a datetime or interval.

Parameters:
in_scale 

Friends And Related Function Documentation

friend class SqlCData [friend]
friend class SqlCTypeMetadataFactory [friend]

Member Data Documentation

True iff the length/interval leading precision was not set by the application.

bool m_defaultPrecision [protected]

True iff precision was not set by the application.

Fixed capacity in bytes. Ignored if m_hasFixedCapacity is false.

bool m_hasFixedCapacity [protected]

Indicates if the capacity is fixed. If true, then m_fixedCapacity holds the data capacity in bytes. If false, then m_octetLength holds the data capacity in bytes.

Length or interval precision.

NOTE: m_lengthOrIntervalPrecision, m_scale, and m_precision are stored here instead of in TypeMetadata, even though they are shared by SqlTypeMetadata as well, because their values are used in slightly different ways. It is more clear to have different Set and Get methods on SqlCTypeMetadata and SqlTypeMetadata with different comments than to have really complicated comments on Set and Get methods on TypeMetadata. The DSI only needs to worry about SqlTypeMetadata's usage of these values.

simba_int16 m_precision [protected]

Precision.

simba_int16 m_scale [protected]

Scale.

bool m_shouldReturnPrecision [protected]

True if returns m_precision when GetPrecisionForDataConversion() is called. m_lengthOrIntervalPrecision is returned otherwise.

simba_int16 m_sqlCType [protected]

SQL C type.


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

Generated on Wed May 17 14:21:19 2017 for SimbaEngine 10.1.3.1011 by simba