MgRenderer

MgRenderer — Interface to get representations of objects as SQL statements, XML nodes or human readable text

Synopsis




            MgRenderer;
enum        MgRendererOptions;
GType       mg_renderer_get_type            (void);
GdaXqlItem* mg_renderer_render_as_xql       (MgRenderer *iface,
                                             MgContext *context,
                                             GError **error);
gchar*      mg_renderer_render_as_sql       (MgRenderer *iface,
                                             MgContext *context,
                                             guint options,
                                             GError **error);
gchar*      mg_renderer_render_as_str       (MgRenderer *iface,
                                             MgContext *context);
gboolean    mg_renderer_is_valid            (MgRenderer *iface,
                                             MgContext *context,
                                             GError **error);

Object Hierarchy


  GInterface
   +----MgRenderer

Prerequisites

MgRenderer requires GObject.

Known Implementations

MgRenderer is implemented by MgQfValue, MgQfField, MgTarget, MgQfAll, MgCondition, MgDbField, MgQuery and MgQfFunc.

Description

Details

MgRenderer

typedef struct _MgRenderer MgRenderer;


enum MgRendererOptions

typedef enum {
	MG_RENDERER_EXTRA_PRETTY_SQL   = 1 << 0,
	MG_RENDERER_EXTRA_VAL_ATTRS    = 1 << 1
} MgRendererOptions;

MG_RENDERER_EXTRA_PRETTY_SQLoption to make the SQL easy to read
MG_RENDERER_EXTRA_VAL_ATTRSoption to include extra information about the values which are variables (this is an extension of the SQL standard)

mg_renderer_get_type ()

GType       mg_renderer_get_type            (void);

Returns :

mg_renderer_render_as_xql ()

GdaXqlItem* mg_renderer_render_as_xql       (MgRenderer *iface,
                                             MgContext *context,
                                             GError **error);

Build a new XML node representing the object, in the specified context.

iface : an object which implements the MgRenderer interface
context : rendering context
error : location to store error, or NULL
Returns : the new XML node, or NULL in case of error

mg_renderer_render_as_sql ()

gchar*      mg_renderer_render_as_sql       (MgRenderer *iface,
                                             MgContext *context,
                                             guint options,
                                             GError **error);

Build a SQL statement representing the object, in the specified context.

If context is NULL, then no error related to missing parameters (which should be in the context) is returned, and missing values are replaced by 'human readable' SQL.

iface : an object which implements the MgRenderer interface
context : rendering context
options : OR'ed flags from MgRendererOptions to give some rendering options
error : location to store error, or NULL
Returns : the new SQL statement (new string), or NULL in case of error

mg_renderer_render_as_str ()

gchar*      mg_renderer_render_as_str       (MgRenderer *iface,
                                             MgContext *context);

Build a human readable string representing the object, in the specified context.

iface : an object which implements the MgRenderer interface
context : rendering context
Returns : the new string

mg_renderer_is_valid ()

gboolean    mg_renderer_is_valid            (MgRenderer *iface,
                                             MgContext *context,
                                             GError **error);

Tells if iface has all the necessary information in context to be rendered into a valid statement (which can be executed).

iface : an object which implements the MgRenderer interface
context : rendering context
error : location to store error, or NULL
Returns : TRUE if iface can be rendered with context