1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = libgda-GdaTransaction.html 27 * outPack = gda 28 * outFile = Transaction 29 * strct = GdaTransaction 30 * realStrct= 31 * ctorStrct= 32 * clss = Transaction 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GObject 38 * implements: 39 * prefixes: 40 * - gda_transaction_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * structWrap: 48 * module aliases: 49 * local aliases: 50 * overrides: 51 */ 52 53 module gda.Transaction; 54 55 public import gdac.gdatypes; 56 57 private import gdac.gda; 58 private import glib.ConstructionException; 59 private import gobject.ObjectG; 60 61 62 private import glib.Str; 63 64 65 66 private import gobject.ObjectG; 67 68 /** 69 */ 70 public class Transaction : ObjectG 71 { 72 73 /** the main Gtk struct */ 74 protected GdaTransaction* gdaTransaction; 75 76 77 public GdaTransaction* getTransactionStruct() 78 { 79 return gdaTransaction; 80 } 81 82 83 /** the main Gtk struct as a void* */ 84 protected override void* getStruct() 85 { 86 return cast(void*)gdaTransaction; 87 } 88 89 /** 90 * Sets our main struct and passes it to the parent class 91 */ 92 public this (GdaTransaction* gdaTransaction) 93 { 94 super(cast(GObject*)gdaTransaction); 95 this.gdaTransaction = gdaTransaction; 96 } 97 98 protected override void setStruct(GObject* obj) 99 { 100 super.setStruct(obj); 101 gdaTransaction = cast(GdaTransaction*)obj; 102 } 103 104 /** 105 */ 106 107 /** 108 * Creates a new GdaTransaction object, which allows a fine-tune and 109 * full control of transactions to be used with providers. 110 * Params: 111 * name = name for the transaction. 112 * Throws: ConstructionException GTK+ fails to create the object. 113 */ 114 public this (string name) 115 { 116 // GdaTransaction* gda_transaction_new (const gchar *name); 117 auto p = gda_transaction_new(Str.toStringz(name)); 118 if(p is null) 119 { 120 throw new ConstructionException("null returned by gda_transaction_new(Str.toStringz(name))"); 121 } 122 this(cast(GdaTransaction*) p); 123 } 124 125 /** 126 * Gets the isolation level for the given transaction. This specifies 127 * the locking behavior for the database connection during the given 128 * transaction. 129 * Returns: the isolation level. 130 */ 131 public GdaTransactionIsolation getIsolationLevel() 132 { 133 // GdaTransactionIsolation gda_transaction_get_isolation_level (GdaTransaction *xaction); 134 return gda_transaction_get_isolation_level(gdaTransaction); 135 } 136 137 /** 138 * Sets the isolation level for the given transaction. 139 * Params: 140 * level = the isolation level. 141 */ 142 public void setIsolationLevel(GdaTransactionIsolation level) 143 { 144 // void gda_transaction_set_isolation_level (GdaTransaction *xaction, GdaTransactionIsolation level); 145 gda_transaction_set_isolation_level(gdaTransaction, level); 146 } 147 148 /** 149 * Retrieves the name of the given transaction, as specified by the 150 * client application (via a non-NULL parameter in the call to 151 * gda_transaction_new, or by calling gda_transaction_set_name). 152 * Note that some providers may set, when you call 153 * gda_connection_begin_transaction, the name of the transaction if 154 * it's not been specified by the client application, so this function 155 * may return, for some providers, values that you don't expect. 156 * Returns: the name of the transaction. 157 */ 158 public string getName() 159 { 160 // const gchar* gda_transaction_get_name (GdaTransaction *xaction); 161 return Str.toString(gda_transaction_get_name(gdaTransaction)); 162 } 163 164 /** 165 * Sets the name of the given transaction. This is very useful when 166 * using providers that support named transactions. 167 * Params: 168 * name = new name for the transaction. 169 */ 170 public void setName(string name) 171 { 172 // void gda_transaction_set_name (GdaTransaction *xaction, const gchar *name); 173 gda_transaction_set_name(gdaTransaction, Str.toStringz(name)); 174 } 175 }