1 /* 2 * Copyright (C) 2005 - 2011 Vivien Malerba <malerba@gnome-db.org> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GDA_CONNECTION_EVENT_H__ 21 #define __GDA_CONNECTION_EVENT_H__ 22 23 #include <glib-object.h> 24 #include <libgda/gda-decl.h> 25 26 G_BEGIN_DECLS 27 28 #define GDA_TYPE_CONNECTION_EVENT (gda_connection_event_get_type()) 29 #define GDA_CONNECTION_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_CONNECTION_EVENT, GdaConnectionEvent)) 30 #define GDA_CONNECTION_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_CONNECTION_EVENT, GdaConnectionEventClass)) 31 #define GDA_IS_CONNECTION_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, GDA_TYPE_CONNECTION_EVENT)) 32 #define GDA_IS_CONNECTION_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GDA_TYPE_CONNECTION_EVENT)) 33 34 struct _GdaConnectionEvent { 35 GObject object; 36 GdaConnectionEventPrivate *priv; 37 }; 38 39 struct _GdaConnectionEventClass { 40 GObjectClass parent_class; 41 42 /*< private >*/ 43 /* Padding for future expansion */ 44 void (*_gda_reserved1) (void); 45 void (*_gda_reserved2) (void); 46 void (*_gda_reserved3) (void); 47 void (*_gda_reserved4) (void); 48 }; 49 50 typedef enum { 51 GDA_CONNECTION_EVENT_NOTICE, 52 GDA_CONNECTION_EVENT_WARNING, 53 GDA_CONNECTION_EVENT_ERROR, 54 GDA_CONNECTION_EVENT_COMMAND 55 56 } GdaConnectionEventType; 57 58 typedef enum 59 { 60 GDA_CONNECTION_EVENT_CODE_CONSTRAINT_VIOLATION, 61 GDA_CONNECTION_EVENT_CODE_RESTRICT_VIOLATION, 62 GDA_CONNECTION_EVENT_CODE_NOT_NULL_VIOLATION, 63 GDA_CONNECTION_EVENT_CODE_FOREIGN_KEY_VIOLATION, 64 GDA_CONNECTION_EVENT_CODE_UNIQUE_VIOLATION, 65 GDA_CONNECTION_EVENT_CODE_CHECK_VIOLATION, 66 GDA_CONNECTION_EVENT_CODE_INSUFFICIENT_PRIVILEGES, 67 GDA_CONNECTION_EVENT_CODE_UNDEFINED_COLUMN, 68 GDA_CONNECTION_EVENT_CODE_UNDEFINED_FUNCTION, 69 GDA_CONNECTION_EVENT_CODE_UNDEFINED_TABLE, 70 GDA_CONNECTION_EVENT_CODE_DUPLICATE_COLUMN, 71 GDA_CONNECTION_EVENT_CODE_DUPLICATE_DATABASE, 72 GDA_CONNECTION_EVENT_CODE_DUPLICATE_FUNCTION, 73 GDA_CONNECTION_EVENT_CODE_DUPLICATE_SCHEMA, 74 GDA_CONNECTION_EVENT_CODE_DUPLICATE_TABLE, 75 GDA_CONNECTION_EVENT_CODE_DUPLICATE_ALIAS, 76 GDA_CONNECTION_EVENT_CODE_DUPLICATE_OBJECT, 77 GDA_CONNECTION_EVENT_CODE_SYNTAX_ERROR, 78 GDA_CONNECTION_EVENT_CODE_UNKNOWN 79 } GdaConnectionEventCode; 80 81 #define GDA_SQLSTATE_NO_ERROR "00000" 82 #define GDA_SQLSTATE_GENERAL_ERROR "HY000" 83 84 /** 85 * SECTION:gda-connection-event 86 * @short_description: Any event which has occurred on a #GdaConnection 87 * @title: GdaConnectionEvent 88 * @stability: Stable 89 * @see_also: #GdaConnection 90 * 91 * Events occurring on a connection are each represented as a #GdaConnectionEvent object. Each #GdaConnection 92 * is responsible for keeping a list of past events; that list can be consulted using the 93 * gda_connection_get_events() function. 94 */ 95 96 GType gda_connection_event_get_type (void) G_GNUC_CONST; 97 98 void gda_connection_event_set_event_type (GdaConnectionEvent *event, GdaConnectionEventType type); 99 GdaConnectionEventType gda_connection_event_get_event_type (GdaConnectionEvent *event); 100 101 const gchar *gda_connection_event_get_description (GdaConnectionEvent *event); 102 void gda_connection_event_set_description (GdaConnectionEvent *event, const gchar *description); 103 glong gda_connection_event_get_code (GdaConnectionEvent *event); 104 void gda_connection_event_set_code (GdaConnectionEvent *event, glong code); 105 GdaConnectionEventCode gda_connection_event_get_gda_code (GdaConnectionEvent *event); 106 void gda_connection_event_set_gda_code (GdaConnectionEvent *event, GdaConnectionEventCode code); 107 const gchar *gda_connection_event_get_source (GdaConnectionEvent *event); 108 void gda_connection_event_set_source (GdaConnectionEvent *event, const gchar *source); 109 const gchar *gda_connection_event_get_sqlstate (GdaConnectionEvent *event); 110 void gda_connection_event_set_sqlstate (GdaConnectionEvent *event, const gchar *sqlstate); 111 112 G_END_DECLS 113 114 #endif 115