Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

look::DbField Class Reference

Class representing a field of data. More...

#include <dbfield.h>

List of all members.

Public Methods

 DbField (LOOK_STMT theStmt, int theColumn)
 Constructor. More...

virtual ~DbField ()
 Destructor.

const LookTypeBaseGetValue (void) const
 Get the value of the data. More...

LookString GetAsString (void) const
 Get the data as a string. More...

LookInteger GetInteger (void) const
 Get the data as a LookInteger. More...

LookMoney GetMoney (void) const
 Get the data as a LookMoney. More...

LookDateTime GetDateTime (void) const
 Get the data as a LookDateTime. More...

LookFloat GetFloat (void) const
 Get the data as a LookFloat. More...

LookNumeric GetNumeric (void) const
 Get the data as a LookNumeric. More...

LookRawData GetRawData (void) const
 Get the data as a LookRawData. More...

bool IsNull () const
 Is the field null? More...


Static Public Methods

void SetFixEmptyStrings (bool theFlag)
bool SetFixEmptyStringsAuto (void)
 Set itFixesEmptyStrings (see constructor for use). More...


Detailed Description

Class representing a field of data.

This class represents a field of data (intersection of row and column). A DbRow has some of these, and is probably the only class which should construct them. A field can supply its data as various types


Constructor & Destructor Documentation

look::DbField::DbField ( LOOK_STMT theStmt,
int theColumn )
 

Constructor.

Constructor. This obtains the data from the interface layer and converts it into the appropriate type. If itFixesEmptyStrings, a string of " " is converted to an empty string. (SQL Server doesn't understand empty strings).

Parameters:
theStmt   Handle to get the data from the interface layer. (cursor).
theColumn   Column number.
Returns:
None (constructor)


Member Function Documentation

LookString look::DbField::GetAsString ( void ) const
 

Get the data as a string.

Get the data as a string. Floating point values are rounded to 3dp, dates use the default conversion specified in LookDateTime, money uses LookMoney::GetSimpleString(). If the data is not one of string, integer, float, date/time, money, numeric or raw data, an exception is thrown. This should be pretty unlikely.

Returns:
The data, converted.

LookDateTime look::DbField::GetDateTime ( void ) const
 

Get the data as a LookDateTime.

Get the data as a LookDateTime. If the data is not date/time, an exception is thrown. Note date and time data is all stored as LookDateTime.

Returns:
The integer.

LookFloat look::DbField::GetFloat ( void ) const
 

Get the data as a LookFloat.

Get the data as a LookFloat. If the data is not a float or numeric, an exception is thrown.

Returns:
The integer.

LookInteger look::DbField::GetInteger ( void ) const
 

Get the data as a LookInteger.

Get the data as a LookInteger. If the data is not integral or numeric, an exception is thrown.

Returns:
The integer.

LookMoney look::DbField::GetMoney ( void ) const
 

Get the data as a LookMoney.

Get the data as a LookMomey. If the data is not money or numeric, an exception is thrown.

Returns:
The integer.

LookNumeric look::DbField::GetNumeric ( void ) const
 

Get the data as a LookNumeric.

Get the data as a LookNumeric. If the data is not integral, money or numeric, an exception is thrown. (float would need a precision).

Returns:
The integer.

LookRawData look::DbField::GetRawData ( void ) const
 

Get the data as a LookRawData.

Get the data as a LookRawData. If the data is not raw (binary) data, an exception is thrown.

Returns:
The integer.

const LookTypeBase * look::DbField::GetValue ( void ) const
 

Get the value of the data.

Get the value of the data.

Returns:
A pointer to a LookTypeBase, which will remain valid as long as the DbField exists.

bool look::DbField::IsNull ( void ) const
 

Is the field null?

Is the field null?

Returns:
true if it is null.

bool look::DbField::SetFixEmptyStringsAuto ( void ) [static]
 

Set itFixesEmptyStrings (see constructor for use).

Set itFixesEmptyStrings according to the database type. (Currently only true for SQL Server)

The global connection must have been set before using this (DbConnection::SetGlobalConnection()).

Returns:
true for success.


The documentation for this class was generated from the following files:
Generated at Thu Jan 17 12:53:07 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001