This repository has been archived on 2024-07-15. You can view files and clone it, but cannot push or open issues or pull requests.
hedera/db/db-result.h

89 lines
2.1 KiB
C
Raw Normal View History

2013-10-11 23:07:35 +00:00
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef DB_RESULT_H
#define DB_RESULT_H
#include <gvn/gvn.h>
#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.
2013-10-11 23:07:35 +00:00
* @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
2013-10-11 23:07:35 +00:00
* @info: A #DbColumnInfo
* @spec: A #GvnParamSpec
*
* The information of a column.
2013-10-11 23:07:35 +00:00
**/
struct _DbColumn
{
gchar * name;
gchar * alias;
gchar * table;
gchar * table_alias;
gchar * schema;
2013-10-11 23:07:35 +00:00
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