## MgServerFunction

MgServerFunction — Represents a function in the DBMS.

## Synopsis

    struct      MgServerFunction;
    struct      MgServerFunctionPrivate;
    guint       mg_server_function_get_type     (void);
    GObject*    mg_server_function_new          (MgServer *srv);
    void        mg_server_function_set_dbms_id  (MgServerFunction *func,
                                                 const gchar *id);
    const gchar* mg_server_function_get_dbms_id (MgServerFunction *func);
    void        mg_server_function_set_sqlname  (MgServerFunction *func,
                                                 const gchar *sqlname);
    const gchar* mg_server_function_get_sqlname (MgServerFunction *func);
    void        mg_server_function_set_arg_types
                                                (MgServerFunction *func,
                                                 const GSList *arg_types);
    const GSList* mg_server_function_get_arg_types
                                                (MgServerFunction *func);
    void        mg_server_function_set_ret_type (MgServerFunction *func,
                                                 MgServerDataType *dt);
    MgServerDataType* mg_server_function_get_ret_type
                                                (MgServerFunction *func);
    gboolean    mg_server_function_accepts_args (MgServerFunction *func,
                                                 const GSList *arg_types);

## Object Hierarchy

      GObject
       +----MgBase
             +----MgServerFunction

## Implemented Interfaces

MgServerFunction implements MgXmlStorage.

## Properties

      "prop"                 gpointer             : Read / Write

## Signal Prototypes

    "templ-signal"
                void        user_function      (MgServerFunction *mgserverfunction,
                                                gpointer user_data);

## Description

The MgServerFunction represents a function, it has zero or more input parameters, and one and only one return type. In this way it does not represent procedures which does not return any data type. Also the argument types are always of the IN kind (no OUT or IN OUT kinds); there may one day be a specific object for procedures. It does not either represent a function returning a SET OF a given data type; there may on day be a specific object for such functions.

Because functions can be polymorphic, the name is not enough to identify them, so the DBMS provides a unique id which can be used to uniquely identify a function.

It implements the MgXmlStorage interface.

## Details

### struct MgServerFunction

    struct MgServerFunction;

### struct MgServerFunctionPrivate

    struct MgServerFunctionPrivate;

### mg_server_function_get_type ()

    guint       mg_server_function_get_type     (void);

Returns : |

### mg_server_function_new ()

    GObject*    mg_server_function_new          (MgServer *srv);

Creates a new MgServerFunction object

`srv` : | a MgServer object
Returns : | the new object

### mg_server_function_set_dbms_id ()

    void        mg_server_function_set_dbms_id  (MgServerFunction *func,
                                                 const gchar *id);

Set the DBMS identifier of the function

`func` : | a MgServerFunction object
`id` : | the DBMS identifier

### mg_server_function_get_dbms_id ()

    const gchar* mg_server_function_get_dbms_id (MgServerFunction *func);

Get the DBMS identifier of the function

`func` : | a MgServerFunction object
Returns : | the function's id

### mg_server_function_set_sqlname ()

    void        mg_server_function_set_sqlname  (MgServerFunction *func,
                                                 const gchar *sqlname);

Set the SQL name of the data type.

`func` : | a MgServerFunction object
`sqlname` : |

### mg_server_function_get_sqlname ()

    const gchar* mg_server_function_get_sqlname (MgServerFunction *func);

Get the DBMS's name of a data type.

`func` : | a MgServerFunction object
Returns : | the name of the data type

### mg_server_function_set_arg_types ()

    void        mg_server_function_set_arg_types
                                                (MgServerFunction *func,
                                                 const GSList *arg_types);

Set the arguments types of a function

`func` : | a MgServerFunction object
`arg_types` : | a list of MgServerDataType objects or NULL values ordered to represent the data types of the function's arguments .

### mg_server_function_get_arg_types ()

    const GSList* mg_server_function_get_arg_types
                                                (MgServerFunction *func);

To consult the list of arguments types (and number) of a function.

`func` : | a MgServerFunction object
Returns : | a list of MgServerDataType objects, the list MUST NOT be modified.

### mg_server_function_set_ret_type ()

    void        mg_server_function_set_ret_type (MgServerFunction *func,
                                                 MgServerDataType *dt);

Set the return type of a function

`func` : | a MgServerFunction object
`dt` : | a MgServerDataType object or NULL

### mg_server_function_get_ret_type ()

    MgServerDataType* mg_server_function_get_ret_type
                                                (MgServerFunction *func);

To consult the return type of a function.

`func` : | a MgServerFunction object
Returns : | a MgServerDataType object.

### mg_server_function_accepts_args ()

    gboolean    mg_server_function_accepts_args (MgServerFunction *func,
                                                 const GSList *arg_types);

Test if the proposed list of arguments (`arg_types`) would be accepted by the `func` function.

The non acceptance can be beause of data type incompatibilities or a wrong number of data types.

`func` : | a MgServerFunction object
`arg_types` : | a list of MgServerDataType objects or NULL values, ordered
Returns : | TRUE if accepted

## Properties

"`prop`" (gpointer : Read / Write) |

## Signals

### The "templ-signal" signal

    void        user_function                  (MgServerFunction *mgserverfunction,
                                                gpointer user_data);

`mgserverfunction` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.