Fire Foot API Reference Manual |
---|
FFDatabase — Class for handling database connections.
#include <ff-database.h> struct FFDatabase; struct FFDatabaseClass; FFDatabase* ff_database_new (void); const gchar* ff_database_get_server_name (FFDatabase *self); void ff_database_set_server_name (FFDatabase *self, const gchar *server_name); const gchar* ff_database_get_db_filename (FFDatabase *self); void ff_database_set_db_filename (FFDatabase *self, const gchar *file_name); const gchar* ff_database_get_user_name (FFDatabase *self); void ff_database_set_user_name (FFDatabase *self, const gchar *user_name); const gchar* ff_database_get_password (FFDatabase *self); void ff_database_set_password (FFDatabase *self, const gchar *password); const gchar* ff_database_get_character_set (FFDatabase *self); void ff_database_set_character_set (FFDatabase *self, const gchar *char_set); gint ff_database_get_sql_dialect (FFDatabase *self); void ff_database_set_sql_dialect (FFDatabase *self, gshort dialect); const gchar* ff_database_get_page_size (FFDatabase *self); void ff_database_set_page_size (FFDatabase *self, const gchar *page_size); const isc_db_handle ff_database_get_handle (FFDatabase *self); gchar* ff_database_get_server_version (FFDatabase *self); gboolean ff_database_connect (FFDatabase *self); void ff_database_disconnect (FFDatabase *self); gboolean ff_database_is_connected (FFDatabase *self); gboolean ff_database_create_db (FFDatabase *self); gboolean ff_database_drop_db (FFDatabase *self); gboolean ff_database_drop_db_named (FFDatabase *self, gchar *db_full_path);
struct FFDatabaseClass { void (* on_connect) (FFDatabase *self, gpointer data); void (* on_disconnect) (FFDatabase *self, gpointer data); void (* on_error) (FFDatabase *self, FFError *error, gpointer data); };
void (*on_connect) (FFDatabase *self, gpointer data) | Triggered after database connection. |
void (*on_disconnect) (FFDatabase *self, gpointer data) | Triggered after database disconnection. |
void (*on_error) (FFDatabase *self, FFError *error, gpointer data) | Triggered after an error is reised. |
FFDatabase* ff_database_new (void);
Constructor for FFDatabase class.
Returns : | A new FFDatabase object. |
const gchar* ff_database_get_server_name (FFDatabase *self);
Get database server name.
self : | A FFDatabase. |
Returns : | A string containing database server name. |
void ff_database_set_server_name (FFDatabase *self, const gchar *server_name);
Set database server name. Default is "localhost".
self : | A FFDatabase. |
server_name : | A string containing server name or IP. |
const gchar* ff_database_get_db_filename (FFDatabase *self);
Get database file name and path.
self : | A FFDatabase. |
Returns : | A string containing database file name and path. |
void ff_database_set_db_filename (FFDatabase *self, const gchar *file_name);
Set database file name.
self : | A FFDatabase. |
file_name : | A string containing file name and path od database. |
const gchar* ff_database_get_user_name (FFDatabase *self);
Get database user name.
self : | A FFDatabase. |
Returns : | A string containing the user name. |
void ff_database_set_user_name (FFDatabase *self, const gchar *user_name);
Set database user name.
self : | A FFDatabase. |
user_name : | A string containing database user name. |
const gchar* ff_database_get_password (FFDatabase *self);
Get database user password.
self : | A FFDatabase. |
Returns : | A string containing user password. |
void ff_database_set_password (FFDatabase *self, const gchar *password);
Set database user password.
self : | A FFDatabase. |
password : | A string containing user password. |
const gchar* ff_database_get_character_set (FFDatabase *self);
Get database character set.
self : | A FFDatabase. |
Returns : | A string containing database character ser. |
void ff_database_set_character_set (FFDatabase *self, const gchar *char_set);
Set database character set. Default is "NONE".
self : | A FFDatabase |
char_set : | A string containing database character set. |
gint ff_database_get_sql_dialect (FFDatabase *self);
Get database SQL dialect.
self : | A FFDatabase. |
Returns : | Dialect number of database. |
void ff_database_set_sql_dialect (FFDatabase *self, gshort dialect);
Set database SQL dialect. Default is 3.
self : | A FFDatabase. |
dialect : | Dialect number of database. |
const gchar* ff_database_get_page_size (FFDatabase *self);
Get database page size.
self : | A FFDatabase. |
Returns : | A string containing database page size. |
void ff_database_set_page_size (FFDatabase *self, const gchar *page_size);
Set database page size. Default is "4096". Valid values for page_size are "1024", "2048", "4096" and "8192". This value is used when a new database is created.
self : | A FFDatabase. |
page_size : | A string containing database page size. |
const isc_db_handle ff_database_get_handle (FFDatabase *self);
Get database handle.
self : | A FFDatabase. |
Returns : | A database handle or NULL if database is not connected. |
gchar* ff_database_get_server_version (FFDatabase *self);
Get Firebird server version number
self : | A FFDatabase. |
Returns : | A string containing server version, or NULL on error. String must be released by programmer after use. |
gboolean ff_database_connect (FFDatabase *self);
Open connection to database.
self : | A FFDatabase. |
Returns : | TRUE if successfully connected, or FALSE otherwise. |
void ff_database_disconnect (FFDatabase *self);
Disconnect from database.
self : | A FFDatabase. |
gboolean ff_database_is_connected (FFDatabase *self);
Check if connection with database server is open.
self : | A FFDatabase. |
Returns : | TRUE if database is connected, or FALSE otherwise. |
gboolean ff_database_create_db (FFDatabase *self);
Create a new empty database on server.
self : | A FFDatabase. |
Returns : | TRUE if database was created successfully, or FALSE otherwise. |
gboolean ff_database_drop_db (FFDatabase *self);
Drop current connected database from server.
self : | A FFDatabase. |
Returns : | TRUE if database was successfully dropped, or FALSE otherwise. |
gboolean ff_database_drop_db_named (FFDatabase *self, gchar *db_full_path);
Drop db_full_path database from server. Value of db_full_path must have following format: "server_name:/path/to/database/my_database.fdb" Examples: 192.168.0.1:/opt/databases/test_db.fdb server:/tmp/test_db.fdb
self : | A FFDatabase. |
db_full_path : | A string containing database full path. |
Returns : | TRUE if database was successfully dropped, or FALSE otherwise. |
<< Main | FFTransaction >> |