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

88 lines
2.0 KiB
C

/*
* 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: Has a #GList.
* @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:
* @info: A #DbColumnInfo
* @spec: A #GvnParamSpec
* @table: Name of the table
* @name: Name of the column
* @display: The name given to it in the query
*
* Has the information of a column.
**/
struct _DbColumn
{
DbColumnInfo info;
GvnParamSpec * spec;
gchar * schema;
gchar * table;
gchar * table_alias;
gchar * name;
gchar * alias;
};
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