GGrnCommand

GGrnCommand — An object to create a Groonga command.

Functions

Properties

GGrnContext * context Read / Write / Construct Only
gchar * name Read / Write / Construct Only

Types and Values

struct GGrnCommand

Object Hierarchy

    GObject
    ╰── GGrnCommand

Description

The GGrnCommand is a class to create a Groonga command string.

Functions

ggrn_command_new ()

GGrnCommand *
ggrn_command_new (GGrnContext *context,
                  const gchar *name);

Allocates a new GGrnCommand.

Parameters

context

A GGrnContext.

 

name

The command name.

 

Returns

a new GGrnCommand.

Since 1.0.0


ggrn_command_add_argument ()

void
ggrn_command_add_argument (GGrnCommand *command,
                           const gchar *name,
                           const gchar *value);

Adds an argument of the command.

If you add the same name argument twice, the old argument value is overrode.

Parameters

command

A GGrnCommand.

 

name

The name of the argument.

 

value

The value of the argument.

 

Since 1.0.0


ggrn_command_escape ()

gchar *
ggrn_command_escape (GGrnCommand *command,
                     const gchar *value,
                     const gchar *target_characters,
                     char escape_character);

Escapes target_characters in value by escape_chracter .

For example:

1
2
3
4
5
6
7
gchar *escaped;
escaped = ggrn_command_escape(command,
                              "aA'\"()19",
                              "'\"()",
                              '\\');
g_print("%s\n", escaped); // -> aA\'\"\(\)19
g_free(escaped);

Parameters

command

A GGrnCommand.

 

value

The argument value.

 

target_characters

The characters to be escaped.

 

escape_character

The character to escape a character.

 

Returns

The escaped characters. It must be freed with g_free() when no longer needed.

It returns NULL for invalid input.

Since 1.0.1


ggrn_command_escape_query ()

gchar *
ggrn_command_escape_query (GGrnCommand *command,
                           const gchar *query);

Escapes special characters of query syntax in query .

For example:

1
2
3
4
gchar *escaped_query;
escaped_query = ggrn_command_escape_query(command, "column:aA'\"()19");
g_print("%s\n", escaped_query); // -> column\:aA'\"\(\)19
g_free(escaped_query);

Parameters

command

A GGrnCommand.

 

query

The query argument value.

 

Returns

The escaped query. It must be freed with g_free() when no longer needed.

It returns NULL for invalid input.

Since 1.0.1


ggrn_command_execute ()

gchar *
ggrn_command_execute (GGrnCommand *command);

Executes the command and returns the executed result.

Parameters

command

A GGrnCommand.

 

Returns

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

Since 1.0.0


ggrn_command_to_path ()

gchar *
ggrn_command_to_path (GGrnCommand *command);

Formats the command as path format like the following:

1
/d/table_create?name=Logs&flags=TABLE_NO_KEY

Parameters

command

A GGrnCommand.

 

Returns

The path format command. It must be freed with g_free() when no longer needed.

Since 1.0.0


ggrn_command_to_command_line ()

gchar *
ggrn_command_to_command_line (GGrnCommand *command);

Formats the command as command line format like the following:

1
table_create --name Logs --flags TABLE_NO_KEY

Parameters

command

A GGrnCommand.

 

Returns

The command line format command. It must be freed with g_free() when no longer needed.

Since 1.0.0

Types and Values

struct GGrnCommand

struct GGrnCommand;

A GGrnCommand is an object to create a Groonga command string. It is executable by ggrn_context_execute_command().

Property Details

The “context” property

  “context”                  GGrnContext *

The context for the command.

Flags: Read / Write / Construct Only


The “name” property

  “name”                     gchar *

The name of the command.

Flags: Read / Write / Construct Only

Default value: NULL