/* * Copyright (C) 2012 - Juan Ferrer Toribio * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DB_RESULT_H #define DB_RESULT_H #include #include "db-row.h" #define DB_TYPE_RESULT (db_result_get_type()) typedef struct _DbResult DbResult; typedef struct _DbColumn DbColumn; /** * DbResult: * @nrows: Number of rows. * @ncols: Number of columns. * @data: (element-type DbRow): Has a #GPtrArray. * @column: Has a #DbColumn. * * Has the information of a row. **/ struct _DbResult { gint nrows; gint ncols; GPtrArray * data; DbColumn * column; }; /** * DbColumnInfo: * @DB_COLUMN_PRI_KEY: Attribute primary Key. * @DB_COLUMN_UNIQUE: Attribute unique. * * Saves the information about if it is primary key or unique. **/ typedef enum { DB_COLUMN_PRI_KEY = 1 << 0 ,DB_COLUMN_UNIQUE = 1 << 1 } DbColumnInfo; /** * DbColumn: * @name: Name of the column * @alias: The name given to the column in the query * @table: Name of the table * @table_alias: The name given to the table in the query * @info: A #DbColumnInfo * @spec: A #GvnParamSpec * * The information of a column. **/ struct _DbColumn { gchar * name; gchar * alias; gchar * table; gchar * table_alias; gchar * schema; DbColumnInfo info; GvnParamSpec * spec; }; GType db_result_get_type (); DbResult * db_result_new (); DbRow * db_result_get_row (const DbResult * obj, gint row_index); void db_result_remove_row (DbResult * obj, gint row_index); DbResult * db_result_copy (const DbResult * obj); void db_result_free (DbResult * obj); #endif