gda-value

Name

gda-value -- Functions for accesing GdaValue.

Synopsis



#define     TIMEZONE_INVALID
typedef     GdaValue;
typedef     GdaValueList;
enum        GdaValueType;
typedef     GdaDate;
typedef     GdaGeometricPoint;
typedef     GdaNumeric;
typedef     GdaTime;
typedef     GdaTimestamp;
GdaValue*   gda_value_new_null              (void);
GdaValue*   gda_value_new_bigint            (gint64 val);
GdaValue*   gda_value_new_binary            (gconstpointer val);
GdaValue*   gda_value_new_boolean           (gboolean val);
GdaValue*   gda_value_new_date              (const GdaDate *val);
GdaValue*   gda_value_new_double            (gdouble val);
GdaValue*   gda_value_new_geometric_point   (const GdaGeometricPoint *val);
GdaValue*   gda_value_new_integer           (gint val);
GdaValue*   gda_value_new_list              (const GdaValueList *val);
GdaValue*   gda_value_new_numeric           (const GdaNumeric *val);
GdaValue*   gda_value_new_single            (gfloat val);
GdaValue*   gda_value_new_smallint          (gshort val);
GdaValue*   gda_value_new_string            (const gchar *val);
GdaValue*   gda_value_new_time              (const GdaTime *val);
GdaValue*   gda_value_new_timestamp         (const GdaTimestamp *val);
GdaValue*   gda_value_new_tinyint           (gchar val);
void        gda_value_free                  (GdaValue *value);
gboolean    gda_value_isa                   (const GdaValue *value,
                                             GdaValueType type);
gboolean    gda_value_is_null               (GdaValue *value);
GdaValue*   gda_value_copy                  (const GdaValue *value);
gint64      gda_value_get_bigint            (GdaValue *value);
void        gda_value_set_bigint            (GdaValue *value,
                                             gint64 val);
gconstpointer gda_value_get_binary          (GdaValue *value);
void        gda_value_set_binary            (GdaValue *value,
                                             gconstpointer val,
                                             glong size);
gboolean    gda_value_get_boolean           (GdaValue *value);
void        gda_value_set_boolean           (GdaValue *value,
                                             gboolean val);
const GdaDate* gda_value_get_date           (GdaValue *value);
void        gda_value_set_date              (GdaValue *value,
                                             const GdaDate *val);
gdouble     gda_value_get_double            (GdaValue *value);
void        gda_value_set_double            (GdaValue *value,
                                             gdouble val);
const GdaGeometricPoint* gda_value_get_geometric_point
                                            (GdaValue *value);
void        gda_value_set_geometric_point   (GdaValue *value,
                                             const GdaGeometricPoint *val);
gint        gda_value_get_integer           (GdaValue *value);
void        gda_value_set_integer           (GdaValue *value,
                                             gint val);
const GdaValueList* gda_value_get_list      (GdaValue *value);
void        gda_value_set_list              (GdaValue *value,
                                             const GdaValueList *val);
void        gda_value_set_null              (GdaValue *value);
const GdaNumeric* gda_value_get_numeric     (GdaValue *value);
void        gda_value_set_numeric           (GdaValue *value,
                                             const GdaNumeric *val);
gfloat      gda_value_get_single            (GdaValue *value);
void        gda_value_set_single            (GdaValue *value,
                                             gfloat val);
gshort      gda_value_get_smallint          (GdaValue *value);
void        gda_value_set_smallint          (GdaValue *value,
                                             gshort val);
const gchar* gda_value_get_string           (GdaValue *value);
void        gda_value_set_string            (GdaValue *value,
                                             const gchar *val);
const GdaTime* gda_value_get_time           (GdaValue *value);
void        gda_value_set_time              (GdaValue *value,
                                             const GdaTime *val);
const GdaTimestamp* gda_value_get_timestamp (GdaValue *value);
void        gda_value_set_timestamp         (GdaValue *value,
                                             const GdaTimestamp *val);
gchar       gda_value_get_tinyint           (GdaValue *value);
void        gda_value_set_tinyint           (GdaValue *value,
                                             gchar val);
gchar*      gda_value_stringify             (GdaValue *value);

Description

A GdaValue holds the data for a (row, column) retrieved from a query to a database backend. The function provided here can get/set the data contained in it, obtain information about the type, get a string representation of the value... The functions gda_value_set_*() and gda_value_new_*() that receive a pointer to any data, get a newly allocated copy of the data.

Details

TIMEZONE_INVALID

#define TIMEZONE_INVALID (2*12*60*60)


GdaValue

typedef struct {
	GdaValueType type;
	union {
		gint64 v_bigint;
		gpointer v_binary;
		gboolean v_boolean;
		GdaDate v_date;
		gdouble v_double;
		GdaGeometricPoint v_point;
		gint v_integer;
		GdaValueList *v_list;
		GdaNumeric v_numeric;
		gfloat v_single;
		gshort v_smallint;
		gchar *v_string;
		GdaTime v_time;
		GdaTimestamp v_timestamp;
		gchar v_tinyint;
	} value;
} GdaValue;


GdaValueList

typedef GList GdaValueList;


enum GdaValueType

typedef enum {
	GDA_VALUE_TYPE_NULL,
	GDA_VALUE_TYPE_BIGINT,
	GDA_VALUE_TYPE_BINARY,
	GDA_VALUE_TYPE_BOOLEAN,
	GDA_VALUE_TYPE_DATE,
	GDA_VALUE_TYPE_DOUBLE,
	GDA_VALUE_TYPE_GEOMETRIC_POINT,
	GDA_VALUE_TYPE_INTEGER,
	GDA_VALUE_TYPE_LIST,
	GDA_VALUE_TYPE_NUMERIC,
	GDA_VALUE_TYPE_SINGLE,
	GDA_VALUE_TYPE_SMALLINT,
	GDA_VALUE_TYPE_STRING,
	GDA_VALUE_TYPE_TIME,
	GDA_VALUE_TYPE_TIMESTAMP,
	GDA_VALUE_TYPE_TINYINT,
	GDA_VALUE_TYPE_UNKNOWN
} GdaValueType;


GdaDate

typedef struct {
	gshort year;
	gushort month;
	gushort day;
} GdaDate;


GdaGeometricPoint

typedef struct {
	gdouble x;
	gdouble y;
} GdaGeometricPoint;


GdaNumeric

typedef struct {
	gchar *number;
	glong precision;
	glong width;
} GdaNumeric;


GdaTime

typedef struct {
	gushort hour;
	gushort minute;
	gushort second;
	glong timezone;	// # of seconds to the east UTC
} GdaTime;


GdaTimestamp

typedef struct {
	gshort year;
	gushort month;
	gushort day;
	gushort hour;
	gushort minute;
	gushort second;
	gulong fraction;
	glong timezone;	// # of seconds to the east UTC
} GdaTimestamp;


gda_value_new_null ()

GdaValue*   gda_value_new_null              (void);

Make a new GdaValue of type GDA_VALUE_TYPE_NULL.


gda_value_new_bigint ()

GdaValue*   gda_value_new_bigint            (gint64 val);

Make a new GdaValue of type GDA_VALUE_TYPE_BIGINT with value val.


gda_value_new_binary ()

GdaValue*   gda_value_new_binary            (gconstpointer val);

NOT IMPLEMENTED YET!!! Make a new GdaValue of type GDA_VALUE_TYPE_BINARY with value val.


gda_value_new_boolean ()

GdaValue*   gda_value_new_boolean           (gboolean val);

Make a new GdaValue of type GDA_VALUE_TYPE_BOOLEAN with value val.


gda_value_new_date ()

GdaValue*   gda_value_new_date              (const GdaDate *val);

Make a new GdaValue of type GDA_VALUE_TYPE_DATE with value val.


gda_value_new_double ()

GdaValue*   gda_value_new_double            (gdouble val);

Make a new GdaValue of type GDA_VALUE_TYPE_DOUBLE with value val.


gda_value_new_geometric_point ()

GdaValue*   gda_value_new_geometric_point   (const GdaGeometricPoint *val);

Make a new GdaValue of type GDA_VALUE_TYPE_GEOMETRIC_POINT with value val.


gda_value_new_integer ()

GdaValue*   gda_value_new_integer           (gint val);

Make a new GdaValue of type GDA_VALUE_TYPE_INTEGER with value val.


gda_value_new_list ()

GdaValue*   gda_value_new_list              (const GdaValueList *val);

Make a new GdaValue of type GDA_VALUE_TYPE_LIST with value val.


gda_value_new_numeric ()

GdaValue*   gda_value_new_numeric           (const GdaNumeric *val);

Make a new GdaValue of type GDA_VALUE_TYPE_NUMERIC with value val.


gda_value_new_single ()

GdaValue*   gda_value_new_single            (gfloat val);

Make a new GdaValue of type GDA_VALUE_TYPE_SINGLE with value val.


gda_value_new_smallint ()

GdaValue*   gda_value_new_smallint          (gshort val);

Make a new GdaValue of type GDA_VALUE_TYPE_SMALLINT with value val.


gda_value_new_string ()

GdaValue*   gda_value_new_string            (const gchar *val);

Make a new GdaValue of type GDA_VALUE_TYPE_STRING with value val.


gda_value_new_time ()

GdaValue*   gda_value_new_time              (const GdaTime *val);

Make a new GdaValue of type GDA_VALUE_TYPE_TIME with value val.


gda_value_new_timestamp ()

GdaValue*   gda_value_new_timestamp         (const GdaTimestamp *val);

Make a new GdaValue of type GDA_VALUE_TYPE_TIMESTAMP with value val.


gda_value_new_tinyint ()

GdaValue*   gda_value_new_tinyint           (gchar val);

Make a new GdaValue of type GDA_VALUE_TYPE_TINYINT with value val.


gda_value_free ()

void        gda_value_free                  (GdaValue *value);

Deallocates all memory associated to a GdaValue.


gda_value_isa ()

gboolean    gda_value_isa                   (const GdaValue *value,
                                             GdaValueType type);

Test if a given value is of type type.


gda_value_is_null ()

gboolean    gda_value_is_null               (GdaValue *value);

Tests if a given value is of type GDA_VALUE_TYPE_NULL.


gda_value_copy ()

GdaValue*   gda_value_copy                  (const GdaValue *value);

Creates a new GdaValue from an existing one.


gda_value_get_bigint ()

gint64      gda_value_get_bigint            (GdaValue *value);

Gets the value stored in value.


gda_value_set_bigint ()

void        gda_value_set_bigint            (GdaValue *value,
                                             gint64 val);

Stores val into value.


gda_value_get_binary ()

gconstpointer gda_value_get_binary          (GdaValue *value);

NOT IMPLEMENTED YET!!! Gets the value stored in value.


gda_value_set_binary ()

void        gda_value_set_binary            (GdaValue *value,
                                             gconstpointer val,
                                             glong size);

NOT IMPLEMENTED YET!!! Stores val into value.


gda_value_get_boolean ()

gboolean    gda_value_get_boolean           (GdaValue *value);

Gets the value stored in value.


gda_value_set_boolean ()

void        gda_value_set_boolean           (GdaValue *value,
                                             gboolean val);

Stores val into value.


gda_value_get_date ()

const GdaDate* gda_value_get_date           (GdaValue *value);

Gets the value stored in value.


gda_value_set_date ()

void        gda_value_set_date              (GdaValue *value,
                                             const GdaDate *val);

Stores val into value.


gda_value_get_double ()

gdouble     gda_value_get_double            (GdaValue *value);

Gets the value stored in value.


gda_value_set_double ()

void        gda_value_set_double            (GdaValue *value,
                                             gdouble val);

Stores val into value.


gda_value_get_geometric_point ()

const GdaGeometricPoint* gda_value_get_geometric_point
                                            (GdaValue *value);

Gets the value stored in value.


gda_value_set_geometric_point ()

void        gda_value_set_geometric_point   (GdaValue *value,
                                             const GdaGeometricPoint *val);

Stores val into value.


gda_value_get_integer ()

gint        gda_value_get_integer           (GdaValue *value);

Gets the value stored in value.


gda_value_set_integer ()

void        gda_value_set_integer           (GdaValue *value,
                                             gint val);

Stores val into value.


gda_value_get_list ()

const GdaValueList* gda_value_get_list      (GdaValue *value);

Gets the value stored in value.


gda_value_set_list ()

void        gda_value_set_list              (GdaValue *value,
                                             const GdaValueList *val);

Stores val into value.


gda_value_set_null ()

void        gda_value_set_null              (GdaValue *value);

Sets the type of value to GDA_VALUE_TYPE_NULL.


gda_value_get_numeric ()

const GdaNumeric* gda_value_get_numeric     (GdaValue *value);

Gets the value stored in value.


gda_value_set_numeric ()

void        gda_value_set_numeric           (GdaValue *value,
                                             const GdaNumeric *val);

Stores val into value.


gda_value_get_single ()

gfloat      gda_value_get_single            (GdaValue *value);

Gets the value stored in value.


gda_value_set_single ()

void        gda_value_set_single            (GdaValue *value,
                                             gfloat val);

Stores val into value.


gda_value_get_smallint ()

gshort      gda_value_get_smallint          (GdaValue *value);

Gets the value stored in value.


gda_value_set_smallint ()

void        gda_value_set_smallint          (GdaValue *value,
                                             gshort val);

Stores val into value.


gda_value_get_string ()

const gchar* gda_value_get_string           (GdaValue *value);

Gets the value stored in value.


gda_value_set_string ()

void        gda_value_set_string            (GdaValue *value,
                                             const gchar *val);

Stores val into value.


gda_value_get_time ()

const GdaTime* gda_value_get_time           (GdaValue *value);

Gets the value stored in value.


gda_value_set_time ()

void        gda_value_set_time              (GdaValue *value,
                                             const GdaTime *val);

Stores val into value.


gda_value_get_timestamp ()

const GdaTimestamp* gda_value_get_timestamp (GdaValue *value);

Gets the value stored in value.


gda_value_set_timestamp ()

void        gda_value_set_timestamp         (GdaValue *value,
                                             const GdaTimestamp *val);

Stores val into value.


gda_value_get_tinyint ()

gchar       gda_value_get_tinyint           (GdaValue *value);

Gets the value stored in value.


gda_value_set_tinyint ()

void        gda_value_set_tinyint           (GdaValue *value,
                                             gchar val);

Stores val into value.


gda_value_stringify ()

gchar*      gda_value_stringify             (GdaValue *value);

Converts a GdaValue to its string representation as indicated by this table:

See Also

GdaRow