GSQLCursor

GSQLCursor

Synopsis

                    GSQLCursorPrivate;
enum                GSQLCursorState;
enum                GSQLCursorBindType;
enum                GSQLCursorStmtType;
#define             GSQL_CURSOR_TYPE
                    GSQLCursor;
GSQLCursor*         gsql_cursor_new                     (GSQLSession *session,
                                                         gchar *sql);
GSQLCursorState     gsql_cursor_get_state               (GSQLCursor *cursor);
GSQLCursorState     gsql_cursor_open_with_bind          (GSQLCursor *cursor,
                                                         gboolean background,
                                                         GSQLCursorBindType btype,
                                                         ...);
GSQLCursorState     gsql_cursor_open                    (GSQLCursor *cursor,
                                                         gboolean background);
void                gsql_cursor_stop                    (GSQLCursor *cursor);
gint                gsql_cursor_fetch                   (GSQLCursor *cursor,
                                                         gint rows);
void                gsql_cursor_close                   (GSQLCursor *cursor);
void                gsql_cursor_notify_set              (GSQLCursor *cursor,
                                                         gboolean notify);

Object Hierarchy

  GObject
   +----GSQLCursor

Signals

  "close"                                          : Run First
  "state-changed"                                  : Run First

Description

Details

GSQLCursorPrivate

typedef struct _GSQLCursorPrivate GSQLCursorPrivate;


enum GSQLCursorState

typedef enum {
	GSQL_CURSOR_STATE_ERROR,
	GSQL_CURSOR_STATE_NONE,
	
	GSQL_CURSOR_STATE_RUN,
	GSQL_CURSOR_STATE_OPEN,
	GSQL_CURSOR_STATE_STOP,
	GSQL_CURSOR_STATE_FETCH,
	GSQL_CURSOR_STATE_FETCHED
} GSQLCursorState;


enum GSQLCursorBindType

typedef enum {
	GSQL_CURSOR_BIND_BY_NAME,
	GSQL_CURSOR_BIND_BY_POS
} GSQLCursorBindType;


enum GSQLCursorStmtType

typedef enum {

	GSQL_CURSOR_STMT_SELECT,
	GSQL_CURSOR_STMT_EXEC,
	GSQL_CURSOR_STMT_INSERT,
	GSQL_CURSOR_STMT_UPDATE,
	GSQL_CURSOR_STMT_DELETE,
	GSQL_CURSOR_STMT_DML, /* Common stmt type for Ins, Upd, Del */
	GSQL_CURSOR_STMT_CREATE,
	GSQL_CURSOR_STMT_DROP,
	GSQL_CURSOR_STMT_ALTER,
	GSQL_CURSOR_STMT_DDL /* commont stmt type for create, drop, alter */
} GSQLCursorStmtType;


GSQL_CURSOR_TYPE

#define GSQL_CURSOR_TYPE 			(gsql_cursor_get_type ())


GSQLCursor

typedef struct _GSQLCursor GSQLCursor;


gsql_cursor_new ()

GSQLCursor*         gsql_cursor_new                     (GSQLSession *session,
                                                         gchar *sql);

Creates a new GSQLCursor object

session :

A GSQLSession

sql :

SQL command

Returns :

the new GSQLCursor

gsql_cursor_get_state ()

GSQLCursorState     gsql_cursor_get_state               (GSQLCursor *cursor);

cursor :

Returns :


gsql_cursor_open_with_bind ()

GSQLCursorState     gsql_cursor_open_with_bind          (GSQLCursor *cursor,
                                                         gboolean background,
                                                         GSQLCursorBindType btype,
                                                         ...);

Run the cursor statement with binds. Pay attention to the args in example usage:

gsql_cursor_open_with_bind (cursor, FALSE, GSQL_CURSOR_BIND_BY_POS, G_TYPE_STRING, owner, G_TYPE_INT, 23, -1)

gsql_cursor_open_with_bind (cursor, FALSE, GSQL_CURSOR_BIND_BY_NAME, G_TYPE_STRING, "owner" G_TYPE_STRING, owner, G_TYPE_STRING, "type", G_TYPE_INT, 23, -1)

cursor :

A GSQLCursor

background :

bring to background

btype :

A GSQLCursorBindType (by position or by name)

... :

pairs of type (GType) and value, terminated with -1

Returns :

the GSQLCursorState

gsql_cursor_open ()

GSQLCursorState     gsql_cursor_open                    (GSQLCursor *cursor,
                                                         gboolean background);

Run the cursor statement.

cursor :

A GSQLCursor

background :

bring to background

Returns :

the GSQLCursorState

gsql_cursor_stop ()

void                gsql_cursor_stop                    (GSQLCursor *cursor);

Stop the statement execution.

cursor :

A GSQLCursor

gsql_cursor_fetch ()

gint                gsql_cursor_fetch                   (GSQLCursor *cursor,
                                                         gint rows);

Fetch the result.

cursor :

A GSQLCursor

rows :

***just reserved

Returns :

the number fetched rows.

gsql_cursor_close ()

void                gsql_cursor_close                   (GSQLCursor *cursor);

Close the cursor.

cursor :

A GSQLCursor

gsql_cursor_notify_set ()

void                gsql_cursor_notify_set              (GSQLCursor *cursor,
                                                         gboolean notify);

Set the notify property.

cursor :

A GSQLCursor

notify :

set TRUE if you would like get notify

Signal Details

The "close" signal

void                user_function                      (GSQLCursor *gsqlcursor,
                                                        gpointer    user_data)       : Run First

gsqlcursor :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "state-changed" signal

void                user_function                      (GSQLCursor *gsqlcursor,
                                                        gpointer    user_data)       : Run First

gsqlcursor :

the object which received the signal.

user_data :

user data set when the signal handler was connected.