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 private import glib.Str;
62 
63 
64 private import gobject.ObjectG;
65 
66 /**
67  */
68 public class Transaction : ObjectG
69 {
70 	
71 	/** the main Gtk struct */
72 	protected GdaTransaction* gdaTransaction;
73 	
74 	
75 	/** Get the main Gtk struct */
76 	public GdaTransaction* getTransactionStruct()
77 	{
78 		return gdaTransaction;
79 	}
80 	
81 	
82 	/** the main Gtk struct as a void* */
83 	protected override void* getStruct()
84 	{
85 		return cast(void*)gdaTransaction;
86 	}
87 	
88 	/**
89 	 * Sets our main struct and passes it to the parent class
90 	 */
91 	public this (GdaTransaction* gdaTransaction)
92 	{
93 		super(cast(GObject*)gdaTransaction);
94 		this.gdaTransaction = gdaTransaction;
95 	}
96 	
97 	protected override void setStruct(GObject* obj)
98 	{
99 		super.setStruct(obj);
100 		gdaTransaction = cast(GdaTransaction*)obj;
101 	}
102 	
103 	/**
104 	 */
105 	
106 	/**
107 	 * Creates a new GdaTransaction object, which allows a fine-tune and
108 	 * full control of transactions to be used with providers.
109 	 * Params:
110 	 * name = name for the transaction.
111 	 * Throws: ConstructionException GTK+ fails to create the object.
112 	 */
113 	public this (string name)
114 	{
115 		// GdaTransaction* gda_transaction_new (const gchar *name);
116 		auto p = gda_transaction_new(Str.toStringz(name));
117 		if(p is null)
118 		{
119 			throw new ConstructionException("null returned by gda_transaction_new(Str.toStringz(name))");
120 		}
121 		this(cast(GdaTransaction*) p);
122 	}
123 	
124 	/**
125 	 * Gets the isolation level for the given transaction. This specifies
126 	 * the locking behavior for the database connection during the given
127 	 * transaction.
128 	 * Returns: the isolation level.
129 	 */
130 	public GdaTransactionIsolation getIsolationLevel()
131 	{
132 		// GdaTransactionIsolation gda_transaction_get_isolation_level  (GdaTransaction *xaction);
133 		return gda_transaction_get_isolation_level(gdaTransaction);
134 	}
135 	
136 	/**
137 	 * Sets the isolation level for the given transaction.
138 	 * Params:
139 	 * level = the isolation level.
140 	 */
141 	public void setIsolationLevel(GdaTransactionIsolation level)
142 	{
143 		// void gda_transaction_set_isolation_level (GdaTransaction *xaction,  GdaTransactionIsolation level);
144 		gda_transaction_set_isolation_level(gdaTransaction, level);
145 	}
146 	
147 	/**
148 	 * Retrieves the name of the given transaction, as specified by the
149 	 * client application (via a non-NULL parameter in the call to
150 	 * gda_transaction_new, or by calling gda_transaction_set_name).
151 	 * Note that some providers may set, when you call
152 	 * gda_connection_begin_transaction, the name of the transaction if
153 	 * it's not been specified by the client application, so this function
154 	 * may return, for some providers, values that you don't expect.
155 	 * Returns: the name of the transaction.
156 	 */
157 	public string getName()
158 	{
159 		// const gchar* gda_transaction_get_name (GdaTransaction *xaction);
160 		return Str.toString(gda_transaction_get_name(gdaTransaction));
161 	}
162 	
163 	/**
164 	 * Sets the name of the given transaction. This is very useful when
165 	 * using providers that support named transactions.
166 	 * Params:
167 	 * name = new name for the transaction.
168 	 */
169 	public void setName(string name)
170 	{
171 		// void gda_transaction_set_name (GdaTransaction *xaction,  const gchar *name);
172 		gda_transaction_set_name(gdaTransaction, Str.toStringz(name));
173 	}
174 }