/usr/include/libgda-5.0/libgda/gda-statement.h is in libgda-5.0-dev 5.2.4-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /*
* Copyright (C) 2008 - 2011 Vivien Malerba <malerba@gnome-db.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GDA_STATEMENT_H_
#define _GDA_STATEMENT_H_
#include <glib-object.h>
#include <sql-parser/gda-statement-struct.h>
G_BEGIN_DECLS
#define GDA_TYPE_STATEMENT (gda_statement_get_type())
#define GDA_STATEMENT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gda_statement_get_type(), GdaStatement)
#define GDA_STATEMENT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gda_statement_get_type (), GdaStatementClass)
#define GDA_IS_STATEMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gda_statement_get_type ())
/* error reporting */
extern GQuark gda_statement_error_quark (void);
#define GDA_STATEMENT_ERROR gda_statement_error_quark ()
/**
* GdaStatementError:
* @GDA_STATEMENT_PARSE_ERROR:
* @GDA_STATEMENT_SYNTAX_ERROR:
* @GDA_STATEMENT_NO_CNC_ERROR:
* @GDA_STATEMENT_CNC_CLOSED_ERROR:
* @GDA_STATEMENT_EXEC_ERROR:
* @GDA_STATEMENT_PARAM_TYPE_ERROR:
* @GDA_STATEMENT_PARAM_ERROR:
*/
typedef enum
{
GDA_STATEMENT_PARSE_ERROR,
GDA_STATEMENT_SYNTAX_ERROR,
GDA_STATEMENT_NO_CNC_ERROR,
GDA_STATEMENT_CNC_CLOSED_ERROR,
GDA_STATEMENT_EXEC_ERROR,
GDA_STATEMENT_PARAM_TYPE_ERROR,
GDA_STATEMENT_PARAM_ERROR
} GdaStatementError;
/**
* GdaStatementModelUsage:
* @GDA_STATEMENT_MODEL_RANDOM_ACCESS: access to the data model will be random (usually this will result in a data model completely stored in memory)
* @GDA_STATEMENT_MODEL_CURSOR_FORWARD: access to the data model will be done using a cursor moving forward
* @GDA_STATEMENT_MODEL_CURSOR_BACKWARD: access to the data model will be done using a cursor moving backward
* @GDA_STATEMENT_MODEL_CURSOR: access to the data model will be done using a cursor (moving both forward and backward)
* @GDA_STATEMENT_MODEL_ALLOW_NOPARAM: specifies that the data model should be executed even if some parameters required to execute it are invalid (in this case the data model will have no row, and will automatically be re-run when the missing parameters are once again valid)
* @GDA_STATEMENT_MODEL_OFFLINE: specifies that the data model's contents will be fully loaded into the client side (the memory of the process using Libgda), not requiring the server any more to access the data (the default behaviour is to access the server any time data is to be read, and data is cached in memory). This flag is useful only if used in conjunction with the GDA_STATEMENT_MODEL_RANDOM_ACCESS flag (otherwise an error will be returned).
*
* These flags specify how the #GdaDataModel returned when executing a #GdaStatement will be used
*/
typedef enum {
GDA_STATEMENT_MODEL_RANDOM_ACCESS = 1 << 0,
GDA_STATEMENT_MODEL_CURSOR_FORWARD = 1 << 1,
GDA_STATEMENT_MODEL_CURSOR_BACKWARD = 1 << 2,
GDA_STATEMENT_MODEL_CURSOR = GDA_STATEMENT_MODEL_CURSOR_FORWARD | GDA_STATEMENT_MODEL_CURSOR_BACKWARD,
GDA_STATEMENT_MODEL_ALLOW_NOPARAM = 1 << 3,
GDA_STATEMENT_MODEL_OFFLINE = 1 << 4
} GdaStatementModelUsage;
/**
* GdaStatementSqlFlag:
* @GDA_STATEMENT_SQL_PARAMS_AS_VALUES: rendering will replace parameters with their values
* @GDA_STATEMENT_SQL_PRETTY: rendering will include newlines and indentation to make it easy to read
* @GDA_STATEMENT_SQL_PARAMS_LONG: parameters will be rendered using the "/* name:<param_name> ... */" syntax
* @GDA_STATEMENT_SQL_PARAMS_SHORT: parameters will be rendered using the "##<param_name>..." syntax
* @GDA_STATEMENT_SQL_PARAMS_AS_COLON: parameters will be rendered using the ":<param_name>" syntax
* @GDA_STATEMENT_SQL_PARAMS_AS_DOLLAR: parameters will be rendered using the "$<param_number>" syntax where parameters are numbered starting from 1
* @GDA_STATEMENT_SQL_PARAMS_AS_QMARK: parameters will be rendered using the "?<param_number>" syntax where parameters are numbered starting from 1
* @GDA_STATEMENT_SQL_PARAMS_AS_UQMARK: parameters will be rendered using the "?" syntax
* @GDA_STATEMENT_SQL_TIMEZONE_TO_GMT: time and timestamp with a timezone information are converted to GMT before rendering, and rendering does not show the timezone information
*
* Specifies rendering options
*/
typedef enum {
GDA_STATEMENT_SQL_PARAMS_AS_VALUES = 0,
GDA_STATEMENT_SQL_PRETTY = 1 << 0,
GDA_STATEMENT_SQL_PARAMS_LONG = 1 << 1,
GDA_STATEMENT_SQL_PARAMS_SHORT = 1 << 2,
GDA_STATEMENT_SQL_PARAMS_AS_COLON = 1 << 3,
GDA_STATEMENT_SQL_PARAMS_AS_DOLLAR = 1 << 4,
GDA_STATEMENT_SQL_PARAMS_AS_QMARK = 1 << 5,
GDA_STATEMENT_SQL_PARAMS_AS_UQMARK = 1 << 6,
GDA_STATEMENT_SQL_TIMEZONE_TO_GMT = 1 << 7
} GdaStatementSqlFlag;
/* struct for the object's data */
struct _GdaStatement
{
GObject object;
GdaStatementPrivate *priv;
};
/* struct for the object's class */
struct _GdaStatementClass
{
GObjectClass parent_class;
/* signals */
void (*checked) (GdaStatement *stmt, GdaConnection *cnc, gboolean checked);
void (*reset) (GdaStatement *stmt);
/*< private >*/
/* Padding for future expansion */
void (*_gda_reserved1) (void);
void (*_gda_reserved2) (void);
void (*_gda_reserved3) (void);
void (*_gda_reserved4) (void);
};
/**
* SECTION:gda-statement
* @short_description: Single SQL statement
* @title: GdaStatement
* @stability: Stable
* @see_also: #GdaBatch
*
* The #GdaStatement represents a single SQL statement (multiple statements can be grouped in a #GdaBatch object).
*
* A #GdaStatement can either be built by describing its constituing parts using a #GdaSqlBuilder object,
* or from an SQL statement using a #GdaSqlParser object.
*
* A #GdaConnection can use a #GdaStatement to:
* <itemizedlist>
* <listitem><para>prepare it for a future execution, the preparation step involves converting the #GdaStatement
* object into a structure used by the database's own API, see gda_connection_statement_prepare()</para></listitem>
* <listitem><para>execute it using gda_connection_statement_execute_select() if it is known that the statement is a
* selection statement, gda_connection_statement_execute_non_select() if it is not a selection statement, or
* gda_connection_statement_execute() when the type of expected result is unknown.</para></listitem>
* </itemizedlist>
* Note that it is possible to use the same #GdaStatement object at the same time with several #GdaConnection objects.
*/
GType gda_statement_get_type (void) G_GNUC_CONST;
GdaStatement *gda_statement_new (void);
GdaStatement *gda_statement_copy (GdaStatement *orig);
gchar *gda_statement_serialize (GdaStatement *stmt);
gboolean gda_statement_get_parameters (GdaStatement *stmt, GdaSet **out_params, GError **error);
#define gda_statement_to_sql(stmt,params,error) gda_statement_to_sql_extended ((stmt), NULL, (params), GDA_STATEMENT_SQL_PARAMS_SHORT, NULL, (error))
gchar *gda_statement_to_sql_extended (GdaStatement *stmt, GdaConnection *cnc,
GdaSet *params, GdaStatementSqlFlag flags,
GSList **params_used, GError **error);
GdaSqlStatementType gda_statement_get_statement_type (GdaStatement *stmt);
gboolean gda_statement_is_useless (GdaStatement *stmt);
gboolean gda_statement_check_structure (GdaStatement *stmt, GError **error);
gboolean gda_statement_check_validity (GdaStatement *stmt, GdaConnection *cnc, GError **error);
gboolean gda_statement_normalize (GdaStatement *stmt, GdaConnection *cnc, GError **error);
G_END_DECLS
#endif
|