FFRecordset

FFRecordset — Class for handling recordset objects.

Synopsis


#include <ff-recordset.h>


struct      FFRecordset;
struct      FFRecordsetClass;

FFRecordset* ff_recordset_new               (void);

void        ff_recordset_set_table_name     (FFRecordset *self,
                                             const gchar *table_name);
const gchar* ff_recordset_get_table_name    (FFRecordset *self);
void        ff_recordset_set_default_transaction
                                            (FFRecordset *self,
                                             FFTransaction *tr);
FFTransaction* ff_recordset_get_default_transaction
                                            (FFRecordset *self);

gboolean    ff_recordset_open               (FFRecordset *self);
gboolean    ff_recordset_is_open            (FFRecordset *self);
gboolean    ff_recordset_close              (FFRecordset *self);
gboolean    ff_recordset_fetchall           (FFRecordset *self,
                                             gboolean stop_on_error);

guint       ff_recordset_record_count       (FFRecordset *self);
guint       ff_recordset_field_count        (FFRecordset *self);
const gchar* ff_recordset_get_field_name    (FFRecordset *self,
                                             guint col_number);
FFValue*    ff_recordset_get_value          (FFRecordset *self,
                                             guint row_number,
                                             guint col_number);
FFRow*      ff_recordset_get_row            (FFRecordset *self,
                                             guint record_number);


Description

The job of a recordset is to hold data from a table, and let the programmer access its data more than once without the need of constantly fetch it.

Details

struct FFRecordset

struct FFRecordset {

	gboolean auto_fetch;  /*< Auto-fetch records if accessed row doesn't exists (Default: FALSE) >*/
};


struct FFRecordsetClass

struct FFRecordsetClass {

	void (* on_error)               (FFRecordset *self, gchar *message, gpointer data);
	void (* on_open)		(FFRecordset *self, gpointer data);
	void (* on_close)		(FFRecordset *self, gpointer data);
};


ff_recordset_new ()

FFRecordset* ff_recordset_new               (void);

Constructor for FFRecordset class.

Returns : A new FFRecordset object.

ff_recordset_set_table_name ()

void        ff_recordset_set_table_name     (FFRecordset *self,
                                             const gchar *table_name);

Set table name for recordset.

self : A FFRecordset.
table_name : A string.

ff_recordset_get_table_name ()

const gchar* ff_recordset_get_table_name    (FFRecordset *self);

Get recordsets table name.

self : A FFRecordset.
Returns : A string containing the table name.

ff_recordset_set_default_transaction ()

void        ff_recordset_set_default_transaction
                                            (FFRecordset *self,
                                             FFTransaction *tr);

Set self default transaction.

self : A FFRecordset.
tr : A FFTransaction.

ff_recordset_get_default_transaction ()

FFTransaction* ff_recordset_get_default_transaction
                                            (FFRecordset *self);

Get default transaction.

self : A FFRecordset.
Returns : A FFTransaction.

ff_recordset_open ()

gboolean    ff_recordset_open               (FFRecordset *self);

Open current table.

self : A FFRecordset.
Returns : TRUE if table was oppened successfully, or FALSE otherwise.

ff_recordset_is_open ()

gboolean    ff_recordset_is_open            (FFRecordset *self);

Get recordset open status.

self : A FFRecordset.
Returns : TRUE if recordset is open, or FALSE otherwise.

ff_recordset_close ()

gboolean    ff_recordset_close              (FFRecordset *self);

Close an opened recordset.

self : A FFRecordset.
Returns : TRUE if recordset was closed successfully, or FALSE otherwise.

ff_recordset_fetchall ()

gboolean    ff_recordset_fetchall           (FFRecordset *self,
                                             gboolean stop_on_error);

Fetch all records from table. If stop_on_error is TRUE function stops fetching after first error, or if stop_on_error is FALSE continue fetching if possible.

self : A FFRecordset.
stop_on_error : A boolean flag.
Returns : TRUE if at least one fetch was successful, or FALSE if an error was raised and stop_on_error was TRUE.

ff_recordset_record_count ()

guint       ff_recordset_record_count       (FFRecordset *self);

Get number of fetched records. To get the number of all records in table you must call ff_recordset_fetchall() at least once.

self : A FFRecordset.
Returns : Number of records.

ff_recordset_field_count ()

guint       ff_recordset_field_count        (FFRecordset *self);

Get number of fields in recordset.

self : A FFRecordset.
Returns : Number of fields.

ff_recordset_get_field_name ()

const gchar* ff_recordset_get_field_name    (FFRecordset *self,
                                             guint col_number);

Get the name of the column col_number.

self : A FFRecordset.
col_number : Number of the column.
Returns : A string containing column name.

ff_recordset_get_value ()

FFValue*    ff_recordset_get_value          (FFRecordset *self,
                                             guint row_number,
                                             guint col_number);

Get an FFValue from recordset's field. The returned value must be released by programmer after use.

self : A FFRecordset.
row_number : A row number.
col_number : A column number.
Returns : A new FFValue with the value of recordset field.

ff_recordset_get_row ()

FFRow*      ff_recordset_get_row            (FFRecordset *self,
                                             guint record_number);

Get a FFRow from recordset. The returned value must be released by programmer after use.

self : A FFRecordset.
record_number : Number of record to get.
Returns : A new FFRow with the value of record_number record.