GGrnContext

GGrnContext — A context for operating a database.

Synopsis

struct              GGrnContext;
struct              GGrnContextClass;
GGrnContext *       ggrn_context_new                    (void);
gboolean            ggrn_context_open_database          (GGrnContext *context,
                                                         const gchar *path,
                                                         GError **error);
gboolean            ggrn_context_create_database        (GGrnContext *context,
                                                         const gchar *path,
                                                         GError **error);
gchar *             ggrn_context_execute_command        (GGrnContext *context,
                                                         const gchar *command);
gboolean            ggrn_context_send_command           (GGrnContext *context,
                                                         const gchar *command,
                                                         GError **error);
gchar *             ggrn_context_receive_result         (GGrnContext *context);

Object Hierarchy

  GObject
   +----GGrnContext

Description

The GGrnContext is a class to keep all information about database operations.

Details

struct GGrnContext

struct GGrnContext;

A GGrnContext is the operation context for a database.


struct GGrnContextClass

struct GGrnContextClass {
    GObjectClass parent_class;
};


ggrn_context_new ()

GGrnContext *       ggrn_context_new                    (void);

Allocates a new GGrnContext.

Returns :

a new GGrnContext.

Since 1.0.0


ggrn_context_open_database ()

gboolean            ggrn_context_open_database          (GGrnContext *context,
                                                         const gchar *path,
                                                         GError **error);

Opens a database.

context :

A GGrnContext.

path :

The path of the database to be opened.

error :

return location for a GError, or NULL.

Returns :

TRUE on success, FALSE if an error occurred.

Since 1.0.0


ggrn_context_create_database ()

gboolean            ggrn_context_create_database        (GGrnContext *context,
                                                         const gchar *path,
                                                         GError **error);

Creates a new database.

context :

A GGrnContext.

path :

The path of the database to be created, or NULL for temporary database. [allow-none]

error :

return location for a GError, or NULL.

Returns :

TRUE on success, FALSE if an error is occurred.

Since 1.0.0


ggrn_context_execute_command ()

gchar *             ggrn_context_execute_command        (GGrnContext *context,
                                                         const gchar *command);

Executes a Groonga command and returns the executed result.

context :

A GGrnContext.

command :

The Groonga command to be executed. See http://groonga.org/docs/reference/command.html about Groonga command.

Returns :

The executed result of command. It must be freed with g_free() when no longer needed.

Since 1.0.0


ggrn_context_send_command ()

gboolean            ggrn_context_send_command           (GGrnContext *context,
                                                         const gchar *command,
                                                         GError **error);

Sends a Groonga command. Use ggrn_context_receive_result() to receive the result of the sent command.

Normally, you should use high-level API ggrn_context_execute_command(). If you want to get error details of the executed command, use this API.

context :

A GGrnContext.

command :

The Groonga command to be sent. See http://groonga.org/docs/reference/command.html about Groonga command.

Returns :

TRUE on success, FALSE if an error is occurred.

Since 1.0.0


ggrn_context_receive_result ()

gchar *             ggrn_context_receive_result         (GGrnContext *context);

Receives the result of the sent command by ggrn_context_send_command().

context :

A GGrnContext.

Returns :

The result of the sent command. It must be freed with g_free() when no longer needed.

Since 1.0.0