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-gda-command.html
46 * - GdaCommand* -> Command
47 * - GdaTransaction* -> Transaction
58 import tango
.io
.Stdout
; // use the tango loging?
62 private import gdac
.gdatypes
;
64 private import gdac
.gda
;
67 private import gda
.Transaction
;
74 * The GdaCommand structure holds data needed to issue a command to the
76 * Applications usually create a GdaCommand (via gda_command_new), set its
77 * properties (via the gda_command_set_* functions) and pass it over to the
78 * database using the GdaConnection functions.
79 * One interesting thing about GdaCommand's is that they can be reused over
80 * and over. That is, applications don't need to create a command every time
81 * they want to run something on the connected database. Moreover, the ability
82 * to create command strings with placeholders allows the use of parameters to
83 * specify the values for those placeholders. Thus, an application can create a
84 * command of the form:
85 * INSERT INTO employees VALUES (id, name, address, salary)
86 * and reuse the same command over and over, just using different values for the
88 * The value for the placeholders is specified when sending the GdaCommand to a
89 * database connection, which is done via the gda_connection_execute function.
94 /** the main Gtk struct */
95 protected GdaCommand
* gdaCommand
;
98 public GdaCommand
* getCommandStruct()
104 /** the main Gtk struct as a void* */
105 protected void* getStruct()
107 return cast(void*)gdaCommand
;
111 * Sets our main struct and passes it to the parent class
113 public this (GdaCommand
* gdaCommand
)
117 if ( gdaCommand
is null )
122 Stdout("struct gdaCommand is null on constructor").newline
;
126 printf("struct gdaCommand is null on constructor");
133 assert(gdaCommand
!is null, "struct gdaCommand is null on constructor");
135 this.gdaCommand
= gdaCommand
;
149 public static GType
getType()
151 // GType gda_command_get_type (void);
152 return gda_command_get_type();
156 * Creates a new GdaCommand from the parameters that should be freed by
157 * calling gda_command_free.
158 * If there are conflicting options, this will set options to
159 * GDA_COMMAND_OPTION_DEFAULT.
161 * the text of the command.
163 * a GdaCommandType value.
165 * a GdaCommandOptions value.
167 * a newly allocated GdaCommand.
169 public this (char[] text
, GdaCommandType type
, GdaCommandOptions options
)
171 // GdaCommand* gda_command_new (const gchar *text, GdaCommandType type, GdaCommandOptions options);
172 this(cast(GdaCommand
*)gda_command_new(Str
.toStringz(text
), type
, options
) );
176 * Frees the resources allocated by gda_command_new.
182 // void gda_command_free (GdaCommand *cmd);
183 gda_command_free(gdaCommand
);
187 * Creates a new GdaCommand from an existing one.
189 * command to get a copy from.
191 * a newly allocated GdaCommand with a copy of the data in cmd.
193 public Command
copy()
195 // GdaCommand* gda_command_copy (GdaCommand *cmd);
196 return new Command( gda_command_copy(gdaCommand
) );
200 * Gets the command text held by cmd.
204 * the command string of cmd.
206 public char[] getText()
208 // const gchar* gda_command_get_text (GdaCommand *cmd);
209 return Str
.toString(gda_command_get_text(gdaCommand
) );
213 * Sets the command text of cmd.
219 public void setText(char[] text
)
221 // void gda_command_set_text (GdaCommand *cmd, const gchar *text);
222 gda_command_set_text(gdaCommand
, Str
.toStringz(text
));
226 * Gets the command type of cmd.
230 * the command type of cmd.
232 public GdaCommandType
getCommandType()
234 // GdaCommandType gda_command_get_command_type (GdaCommand *cmd);
235 return gda_command_get_command_type(gdaCommand
);
239 * Sets the command type of cmd.
245 public void setCommandType(GdaCommandType type
)
247 // void gda_command_set_command_type (GdaCommand *cmd, GdaCommandType type);
248 gda_command_set_command_type(gdaCommand
, type
);
252 * Gets the command options of cmd.
256 * the command options of cmd.
258 public GdaCommandOptions
getOptions()
260 // GdaCommandOptions gda_command_get_options (GdaCommand *cmd);
261 return gda_command_get_options(gdaCommand
);
265 * Sets the command options of cmd. If there conflicting options, it will just
266 * leave the value as before.
270 * the command options.
272 public void setOptions(GdaCommandOptions options
)
274 // void gda_command_set_options (GdaCommand *cmd, GdaCommandOptions options);
275 gda_command_set_options(gdaCommand
, options
);
279 * Gets the GdaTransaction associated with the given GdaCommand.
283 * the transaction for the command.
285 public Transaction
getTransaction()
287 // GdaTransaction* gda_command_get_transaction (GdaCommand *cmd);
288 return new Transaction( gda_command_get_transaction(gdaCommand
) );
292 * Sets the GdaTransaction associated with the given GdaCommand.
296 * a GdaTransaction object.
298 public void setTransaction(Transaction xaction
)
300 // void gda_command_set_transaction (GdaCommand *cmd, GdaTransaction *xaction);
301 gda_command_set_transaction(gdaCommand
, (xaction
is null) ?
null : xaction
.getTransactionStruct());