alternative to assert
[gtkD.git] / gtkD / srcgda / gda / Transaction.d
blobc11adf54e7332bb5e09f0c7ea1b576560c507b86
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = libgda-GdaTransaction.html
26 * outPack = gda
27 * outFile = Transaction
28 * strct = GdaTransaction
29 * realStrct=
30 * ctorStrct=
31 * clss = Transaction
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gda_transaction_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * structWrap:
45 * - GdaDataModel* -> DataModel
46 * - GdaFieldAttributes* -> FieldAttributes
47 * - GdaTransaction* -> Transaction
48 * module aliases:
49 * local aliases:
52 module gda.Transaction;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gdac.gdatypes;
64 private import gdac.gda;
71 /**
72 * Description
74 public class Transaction
77 /** the main Gtk struct */
78 protected GdaTransaction* gdaTransaction;
81 public GdaTransaction* getTransactionStruct()
83 return gdaTransaction;
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gdaTransaction;
93 /**
94 * Sets our main struct and passes it to the parent class
96 public this (GdaTransaction* gdaTransaction)
98 version(noAssert)
100 if ( gdaTransaction is null )
102 int zero = 0;
103 version(Tango)
105 Stdout("struct gdaTransaction is null on constructor").newline;
107 else
109 printf("struct gdaTransaction is null on constructor");
111 zero = zero / zero;
114 else
116 assert(gdaTransaction !is null, "struct gdaTransaction is null on constructor");
118 this.gdaTransaction = gdaTransaction;
126 * Creates a new GdaTransaction object, which allows a fine-tune and
127 * full control of transactions to be used with providers.
128 * name :
129 * name for the transaction.
130 * Returns :
131 * the newly created object.
133 public this (char[] name)
135 // GdaTransaction* gda_transaction_new (const gchar *name);
136 this(cast(GdaTransaction*)gda_transaction_new(Str.toStringz(name)) );
141 * Gets the isolation level for the given transaction. This specifies
142 * the locking behavior for the database connection during the given
143 * transaction.
144 * xaction :
145 * a GdaTransaction object.
146 * Returns :
147 * the isolation level.
149 public GdaTransactionIsolation getIsolationLevel()
151 // GdaTransactionIsolation gda_transaction_get_isolation_level (GdaTransaction *xaction);
152 return gda_transaction_get_isolation_level(gdaTransaction);
156 * Sets the isolation level for the given transaction.
157 * xaction :
158 * a GdaTransaction object.
159 * level :
160 * the isolation level.
162 public void setIsolationLevel(GdaTransactionIsolation level)
164 // void gda_transaction_set_isolation_level (GdaTransaction *xaction, GdaTransactionIsolation level);
165 gda_transaction_set_isolation_level(gdaTransaction, level);
169 * Retrieves the name of the given transaction, as specified by the
170 * client application (via a non-NULL parameter in the call to
171 * gda_transaction_new, or by calling gda_transaction_set_name).
172 * Note that some providers may set, when you call
173 * gda_connection_begin_transaction, the name of the transaction if
174 * it's not been specified by the client application, so this function
175 * may return, for some providers, values that you don't expect.
176 * xaction :
177 * a GdaTransaction object.
178 * Returns :
179 * the name of the transaction.
181 public char[] getName()
183 // const gchar* gda_transaction_get_name (GdaTransaction *xaction);
184 return Str.toString(gda_transaction_get_name(gdaTransaction) );
188 * Sets the name of the given transaction. This is very useful when
189 * using providers that support named transactions.
190 * xaction :
191 * a GdaTransaction object.
192 * name :
193 * new name for the transaction.
195 public void setName(char[] name)
197 // void gda_transaction_set_name (GdaTransaction *xaction, const gchar *name);
198 gda_transaction_set_name(gdaTransaction, Str.toStringz(name));