SourceMod::IResultRow Class Reference

Represents a one database result row. More...

#include <public/IDBDriver.h>

List of all members.

Public Member Functions

virtual DBResult GetString (unsigned int columnId, const char **pString, size_t *length)=0
 Retrieves a database field result as a string.
virtual DBResult CopyString (unsigned int columnId, char *buffer, size_t maxlength, size_t *written)=0
 Retrieves a database field result as a string, using a user-supplied buffer. If the field is NULL, an empty string will be copied.
virtual DBResult GetFloat (unsigned int columnId, float *pFloat)=0
 Retrieves a database field result as a float.
virtual DBResult GetInt (unsigned int columnId, int *pInt)=0
 Retrieves a database field result as an integer.
virtual bool IsNull (unsigned int columnId)=0
 Returns whether or not a field is NULL.
virtual size_t GetDataSize (unsigned int columnId)=0
 Returns the size of a field (text/raw/blob) in bytes. For strings, this returned size will not include the null terminator.
virtual DBResult GetBlob (unsigned int columnId, const void **pData, size_t *length)=0
 Retrieves field data as a raw bitstream. The pointer returned will become invalid after advancing to the next row.
virtual DBResult CopyBlob (unsigned int columnId, void *buffer, size_t maxlength, size_t *written)=0
 Copies field data as a raw bitstream.


Detailed Description

Represents a one database result row.

Note that type mismatches will only occur when type safety is being enforced. So far this is only the case for prepared statements in MySQL and SQLite.

Also, it is worth noting that retrieving as raw data will never cause a type mismatch.

Definition at line 85 of file IDBDriver.h.


Member Function Documentation

virtual DBResult SourceMod::IResultRow::GetString ( unsigned int  columnId,
const char **  pString,
size_t *  length 
) [pure virtual]

Retrieves a database field result as a string.

For NULL values, the resulting string pointer will be non-NULL but empty. The pointer returned will become invalid after advancing to the next row.

Parameters:
columnId Column to use, starting from 0.
pString Pointer to store a pointer to the string.
length Optional pointer to store the string length.
Returns:
A DBResult return code.

virtual DBResult SourceMod::IResultRow::CopyString ( unsigned int  columnId,
char *  buffer,
size_t  maxlength,
size_t *  written 
) [pure virtual]

Retrieves a database field result as a string, using a user-supplied buffer. If the field is NULL, an empty string will be copied.

Parameters:
columnId Column to use, starting from 0.
buffer Buffer to store string in.
maxlength Maximum length of the buffer.
written Optional pointer to store the number of bytes written, excluding the null terminator.
Returns:
A DBResult return code.

virtual DBResult SourceMod::IResultRow::GetFloat ( unsigned int  columnId,
float *  pFloat 
) [pure virtual]

Retrieves a database field result as a float.

For NULL entries, the returned float value will be 0.0.

Parameters:
columnId Column to use, starting from 0.
pFloat Pointer to a floating point number to set.
Returns:
A DBResult return code.

virtual DBResult SourceMod::IResultRow::GetInt ( unsigned int  columnId,
int *  pInt 
) [pure virtual]

Retrieves a database field result as an integer.

For NULL entries, the returned integer value will be 0.

Parameters:
columnId Column to use, starting from 0.
pInt Pointer to an integer number to set.
Returns:
A DBResult return code.

virtual bool SourceMod::IResultRow::IsNull ( unsigned int  columnId  )  [pure virtual]

Returns whether or not a field is NULL.

Parameters:
columnId Column to use, starting from 0.
Returns:
True if field is NULL, false otherwise.

virtual size_t SourceMod::IResultRow::GetDataSize ( unsigned int  columnId  )  [pure virtual]

Returns the size of a field (text/raw/blob) in bytes. For strings, this returned size will not include the null terminator.

When used on fields that are not of variable length, the size returned will be the number of bytes required to store the internal data. Note that the data size will correspond to the ACTUAL data type, not the COLUMN type.

Parameters:
columnId Column to use, starting from 0.
Returns:
Number of bytes required to store the data, or 0 on failure.

virtual DBResult SourceMod::IResultRow::GetBlob ( unsigned int  columnId,
const void **  pData,
size_t *  length 
) [pure virtual]

Retrieves field data as a raw bitstream. The pointer returned will become invalid after advancing to the next row.

Parameters:
columnId Column to use, starting from 0.
pData Pointer to store the raw bit stream. If the data is NULL, a NULL pointer will be returned.
length Pointer to store the data length.
Returns:
A DBResult return code.

virtual DBResult SourceMod::IResultRow::CopyBlob ( unsigned int  columnId,
void *  buffer,
size_t  maxlength,
size_t *  written 
) [pure virtual]

Copies field data as a raw bitstream.

Parameters:
columnId Column to use, starting from 0.
buffer Pointer to copy the data to. If the data is NULL, no data will be copied.
maxlength Maximum length of the buffer.
written Optional pointer to store the number of bytes written.
Returns:
A DBResult return code.


The documentation for this class was generated from the following file:
Generated on Thu Aug 28 22:10:20 2008 for SourceMod SDK by  doxygen 1.5.1