/usr/include/libgdamm-5.0/libgdamm/statement.h is in libgdamm5.0-dev 4.99.11-0ubuntu1.
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 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | // -*- c++ -*-
// Generated by gmmproc 2.46.1 -- DO NOT MODIFY!
#ifndef _LIBGDAMM_STATEMENT_H
#define _LIBGDAMM_STATEMENT_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
// -*- C++ -*- //
/* statement.h
*
* Copyright 2006 libgdamm Development Team
*
* 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.1 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <libgdamm/set.h>
#include <libgdamm/holder.h>
#include <libgdamm/sqlstatement.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdaStatement GdaStatement;
typedef struct _GdaStatementClass GdaStatementClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gnome
{
namespace Gda
{ class Statement_Class; } // namespace Gda
} // namespace Gnome
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gnome
{
namespace Gda
{
class Connection;
/** @addtogroup libgdammEnums libgdamm Enums and Flags */
/**
*
* @ingroup libgdammEnums
* @par Bitwise operators:
* <tt>%StatementModelUsage operator|(StatementModelUsage, StatementModelUsage)</tt><br>
* <tt>%StatementModelUsage operator&(StatementModelUsage, StatementModelUsage)</tt><br>
* <tt>%StatementModelUsage operator^(StatementModelUsage, StatementModelUsage)</tt><br>
* <tt>%StatementModelUsage operator~(StatementModelUsage)</tt><br>
* <tt>%StatementModelUsage& operator|=(StatementModelUsage&, StatementModelUsage)</tt><br>
* <tt>%StatementModelUsage& operator&=(StatementModelUsage&, StatementModelUsage)</tt><br>
* <tt>%StatementModelUsage& operator^=(StatementModelUsage&, StatementModelUsage)</tt><br>
*/
enum StatementModelUsage
{
STATEMENT_MODEL_RANDOM_ACCESS = 1 << 0,
STATEMENT_MODEL_CURSOR_FORWARD = 1 << 1,
STATEMENT_MODEL_CURSOR_BACKWARD = 1 << 2,
STATEMENT_MODEL_CURSOR = 0x6,
STATEMENT_MODEL_ALLOW_NOPARAM = 1 << 3
};
/** @ingroup libgdammEnums */
inline StatementModelUsage operator|(StatementModelUsage lhs, StatementModelUsage rhs)
{ return static_cast<StatementModelUsage>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
/** @ingroup libgdammEnums */
inline StatementModelUsage operator&(StatementModelUsage lhs, StatementModelUsage rhs)
{ return static_cast<StatementModelUsage>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
/** @ingroup libgdammEnums */
inline StatementModelUsage operator^(StatementModelUsage lhs, StatementModelUsage rhs)
{ return static_cast<StatementModelUsage>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
/** @ingroup libgdammEnums */
inline StatementModelUsage operator~(StatementModelUsage flags)
{ return static_cast<StatementModelUsage>(~static_cast<unsigned>(flags)); }
/** @ingroup libgdammEnums */
inline StatementModelUsage& operator|=(StatementModelUsage& lhs, StatementModelUsage rhs)
{ return (lhs = static_cast<StatementModelUsage>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
/** @ingroup libgdammEnums */
inline StatementModelUsage& operator&=(StatementModelUsage& lhs, StatementModelUsage rhs)
{ return (lhs = static_cast<StatementModelUsage>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
/** @ingroup libgdammEnums */
inline StatementModelUsage& operator^=(StatementModelUsage& lhs, StatementModelUsage rhs)
{ return (lhs = static_cast<StatementModelUsage>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
} // namespace Gda
} // namespace Gnome
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gnome::Gda::StatementModelUsage> : public Glib::Value_Flags<Gnome::Gda::StatementModelUsage>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gnome
{
namespace Gda
{
/**
*
* @ingroup libgdammEnums
* @par Bitwise operators:
* <tt>%StatementSqlFlag operator|(StatementSqlFlag, StatementSqlFlag)</tt><br>
* <tt>%StatementSqlFlag operator&(StatementSqlFlag, StatementSqlFlag)</tt><br>
* <tt>%StatementSqlFlag operator^(StatementSqlFlag, StatementSqlFlag)</tt><br>
* <tt>%StatementSqlFlag operator~(StatementSqlFlag)</tt><br>
* <tt>%StatementSqlFlag& operator|=(StatementSqlFlag&, StatementSqlFlag)</tt><br>
* <tt>%StatementSqlFlag& operator&=(StatementSqlFlag&, StatementSqlFlag)</tt><br>
* <tt>%StatementSqlFlag& operator^=(StatementSqlFlag&, StatementSqlFlag)</tt><br>
*/
enum StatementSqlFlag
{
STATEMENT_SQL_PARAMS_AS_VALUES = 0x0,
STATEMENT_SQL_PRETTY = 1 << 0,
STATEMENT_SQL_PARAMS_LONG = 1 << 1,
STATEMENT_SQL_PARAMS_SHORT = 1 << 2,
STATEMENT_SQL_PARAMS_AS_COLON = 1 << 3,
STATEMENT_SQL_PARAMS_AS_DOLLAR = 1 << 4,
STATEMENT_SQL_PARAMS_AS_QMARK = 1 << 5,
STATEMENT_SQL_PARAMS_AS_UQMARK = 1 << 6
};
/** @ingroup libgdammEnums */
inline StatementSqlFlag operator|(StatementSqlFlag lhs, StatementSqlFlag rhs)
{ return static_cast<StatementSqlFlag>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
/** @ingroup libgdammEnums */
inline StatementSqlFlag operator&(StatementSqlFlag lhs, StatementSqlFlag rhs)
{ return static_cast<StatementSqlFlag>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
/** @ingroup libgdammEnums */
inline StatementSqlFlag operator^(StatementSqlFlag lhs, StatementSqlFlag rhs)
{ return static_cast<StatementSqlFlag>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
/** @ingroup libgdammEnums */
inline StatementSqlFlag operator~(StatementSqlFlag flags)
{ return static_cast<StatementSqlFlag>(~static_cast<unsigned>(flags)); }
/** @ingroup libgdammEnums */
inline StatementSqlFlag& operator|=(StatementSqlFlag& lhs, StatementSqlFlag rhs)
{ return (lhs = static_cast<StatementSqlFlag>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
/** @ingroup libgdammEnums */
inline StatementSqlFlag& operator&=(StatementSqlFlag& lhs, StatementSqlFlag rhs)
{ return (lhs = static_cast<StatementSqlFlag>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
/** @ingroup libgdammEnums */
inline StatementSqlFlag& operator^=(StatementSqlFlag& lhs, StatementSqlFlag rhs)
{ return (lhs = static_cast<StatementSqlFlag>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
} // namespace Gda
} // namespace Gnome
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gnome::Gda::StatementSqlFlag> : public Glib::Value_Flags<Gnome::Gda::StatementSqlFlag>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gnome
{
namespace Gda
{
class StatementError : public Glib::Error
{
public:
/**
*/
enum Code
{
STATEMENT_PARSE_ERROR,
STATEMENT_SYNTAX_ERROR,
STATEMENT_NO_CNC_ERROR,
STATEMENT_CNC_CLOSED_ERROR,
STATEMENT_EXEC_ERROR,
STATEMENT_PARAM_TYPE_ERROR,
STATEMENT_PARAM_ERROR
};
StatementError(Code error_code, const Glib::ustring& error_message);
explicit StatementError(GError* gobject);
Code code() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
static void throw_func(GError* gobject);
friend void wrap_init(); // uses throw_func()
#endif //DOXYGEN_SHOULD_SKIP_THIS
};
} // namespace Gda
} // namespace Gnome
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gnome::Gda::StatementError::Code> : public Glib::Value_Enum<Gnome::Gda::StatementError::Code>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gnome
{
namespace Gda
{
/** Single SQL statement.
*
* The Gda::Statement represents a single SQL statement (multiple statements
* can be grouped in a Batch object).
*
* A Gda::Statement can either be built "manually" by building a Gda::SqlStatement
* structure, or from an SQL statement using a Gda::SqlParser object.
* A GdaConnection can use a GdaStatement to:
*
* - 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()
* - 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.
* Note that it is possible to use the same Gda::Statement object at the same time
* with several Gda::Connection objects.
*
* @ingroup Connection
*/
class Statement : public Glib::Object
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef Statement CppObjectType;
typedef Statement_Class CppClassType;
typedef GdaStatement BaseObjectType;
typedef GdaStatementClass BaseClassType;
// noncopyable
Statement(const Statement&) = delete;
Statement& operator=(const Statement&) = delete;
private: friend class Statement_Class;
static CppClassType statement_class_;
protected:
explicit Statement(const Glib::ConstructParams& construct_params);
explicit Statement(GdaStatement* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
Statement(Statement&& src) noexcept;
Statement& operator=(Statement&& src) noexcept;
virtual ~Statement() noexcept;
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
GdaStatement* gobj() { return reinterpret_cast<GdaStatement*>(gobject_); }
///Provides access to the underlying C GObject.
const GdaStatement* gobj() const { return reinterpret_cast<GdaStatement*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GdaStatement* gobj_copy();
private:
protected:
Statement();
public:
static Glib::RefPtr<Statement> create();
/** Copy constructor
*
* @return A the new copy of @a orig.
*/
Glib::RefPtr<Statement> copy() const;
/** Creates a string representing the contents of @a stmt.
*
* @return A string containing the serialized version of @a stmt.
*/
Glib::ustring serialize() const;
//TODO: Should this be const? Probably not, because the caller could change Set. murrayc.
/** Get a new Gda::Set object which groups all the execution parameters
* which @a stmt needs. This new object is returned though @a out_params.
*
* Note that if @a stmt does not need any parameter, then @a out_params is set to <tt>0</tt>.
*
* @param out_params A place to store a new Gda::Set object, or <tt>0</tt>.
* @return <tt>true</tt> if no error occurred.
*/
bool get_parameters(Glib::RefPtr<Set>& out_params);
//TODO: Documentation:
Glib::ustring to_sql() const;
//TODO: Documentation:
Glib::ustring to_sql(const Glib::RefPtr<const Set>& params) const;
//gtkmmproc error: gda_statement_to_sql : ignored method defs lookup failed
typedef std::vector< const Glib::RefPtr<Holder> > HolderVector;
//TODO: Add an overload without the params?
/** Renders @a stmt as an SQL statement, with some control on how it is rendered.
*
* If @a cnc is not <tt>0</tt>, then the rendered SQL will better be suited to be used by @a cnc (in particular
* it may include some SQL tweaks and/or proprietary extensions specific to the database engine used by @a cnc):
* in this case the result is similar to calling Gda::Connection::statement_to_sql().
*
* @param cnc A Gda::Connection object, or <tt>0</tt>.
* @param params Parameters contained in a single Gda::Set object.
* @param flags A set of flags to control the rendering.
* @param params_used A place to store the list of actual Gda::Holder objects in @a params used to do the rendering, or <tt>0</tt>.
* @return A new string if no error occurred.
*/
Glib::ustring to_sql(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<const Set>& params,
StatementSqlFlag flags, const HolderVector& params_used) const;
/** Get the type of statement held by @a stmt. It returns GDA_SQL_STATEMENT_NONE if
* @a stmt does not hold any statement
*
* @return The statement type.
*/
SqlStatementType get_statement_type() const;
/** Tells if @a stmt is composed only of spaces (that is it has no real SQL code), and is completely
* useless as such.
*
* @return <tt>true</tt> if executing @a stmt does nothing.
*/
bool is_useless() const;
/** Checks that @a stmt's structure is correct.
*
* @return <tt>true</tt> if @a stmt's structure is correct.
*/
bool check_structure() const;
/** If @a cnc is not <tt>0</tt> then checks that every object (table, field, function) used in @a stmt
* actually exists in @a cnc's database
*
* If @a cnc is <tt>0</tt>, then cleans anything related to @a cnc in @a stmt.
*
* See gda_sql_statement_check_validity() for more information.
*
* @param cnc A Gda::Connection object, or <tt>0</tt>.
* @return <tt>true</tt> if every object actually exists in @a cnc's database.
*/
bool check_validity(const Glib::RefPtr<Connection>& cnc) const;
/** "Normalizes" some parts of @a stmt, see gda_sql_statement_normalize() for more
* information.
*
* @param cnc A Gda::Connection object.
* @return <tt>true</tt> if no error occurred.
*/
bool normalize(const Glib::RefPtr<Connection>& cnc);
//TODO: Use a real GType in libgda?
/**
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< gpointer > property_structure() ;
/**
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< gpointer > property_structure() const;
//The m4 conversion is here because it is only for signals:
/**
* @par Slot Prototype:
* <tt>void on_my_%checked(const Glib::RefPtr<Connection>& cnc, bool valid)</tt>
*
*/
Glib::SignalProxy2< void,const Glib::RefPtr<Connection>&,bool > signal_checked();
/**
* @par Slot Prototype:
* <tt>void on_my_%reset()</tt>
*
*/
Glib::SignalProxy0< void > signal_reset();
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
/// This is a default handler for the signal signal_checked().
virtual void on_checked(const Glib::RefPtr<Connection>& cnc, bool valid);
/// This is a default handler for the signal signal_reset().
virtual void on_reset();
};
} // namespace Gda
} // namespace Gnome
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gnome::Gda::Statement
*/
Glib::RefPtr<Gnome::Gda::Statement> wrap(GdaStatement* object, bool take_copy = false);
}
#endif /* _LIBGDAMM_STATEMENT_H */
|