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