File: gda-command.xml

package info (click to toggle)
libgda2 1.2.4-1.2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 13,724 kB
  • ctags: 6,979
  • sloc: ansic: 47,166; xml: 19,896; sh: 8,797; makefile: 863; yacc: 202; lex: 129; cpp: 73
file content (361 lines) | stat: -rw-r--r-- 20,277 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<refentry id="libgda-gda-command">
<refmeta>
<refentrytitle role="top_of_page" id="libgda-gda-command.top_of_page">gda-command</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBGDA Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>gda-command</refname>
<refpurpose>Functions that deal with <link linkend="GdaCommand"><type>GdaCommand</type></link></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="libgda-gda-command.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
enum                <link linkend="GdaCommandOptions">GdaCommandOptions</link>;
#define             <link linkend="GDA-COMMAND-DEFAULT-OPTION:CAPS">GDA_COMMAND_DEFAULT_OPTION</link>
enum                <link linkend="GdaCommandType">GdaCommandType</link>;
                    <link linkend="GdaCommand">GdaCommand</link>;
#define             <link linkend="GDA-TYPE-COMMAND:CAPS">GDA_TYPE_COMMAND</link>
<link linkend="GType">GType</link>               <link linkend="gda-command-get-type">gda_command_get_type</link>                (void);
<link linkend="GdaCommand">GdaCommand</link>*         <link linkend="gda-command-new">gda_command_new</link>                     (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="GdaCommandType">GdaCommandType</link> type,
                                                         <link linkend="GdaCommandOptions">GdaCommandOptions</link> options);
<link linkend="void">void</link>                <link linkend="gda-command-free">gda_command_free</link>                    (<link linkend="GdaCommand">GdaCommand</link> *cmd);
<link linkend="GdaCommand">GdaCommand</link>*         <link linkend="gda-command-copy">gda_command_copy</link>                    (<link linkend="GdaCommand">GdaCommand</link> *cmd);
const <link linkend="gchar">gchar</link>*        <link linkend="gda-command-get-text">gda_command_get_text</link>                (<link linkend="GdaCommand">GdaCommand</link> *cmd);
<link linkend="void">void</link>                <link linkend="gda-command-set-text">gda_command_set_text</link>                (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         const <link linkend="gchar">gchar</link> *text);
<link linkend="GdaCommandType">GdaCommandType</link>      <link linkend="gda-command-get-command-type">gda_command_get_command_type</link>        (<link linkend="GdaCommand">GdaCommand</link> *cmd);
<link linkend="void">void</link>                <link linkend="gda-command-set-command-type">gda_command_set_command_type</link>        (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         <link linkend="GdaCommandType">GdaCommandType</link> type);
<link linkend="GdaCommandOptions">GdaCommandOptions</link>   <link linkend="gda-command-get-options">gda_command_get_options</link>             (<link linkend="GdaCommand">GdaCommand</link> *cmd);
<link linkend="void">void</link>                <link linkend="gda-command-set-options">gda_command_set_options</link>             (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         <link linkend="GdaCommandOptions">GdaCommandOptions</link> options);
<link linkend="GdaTransaction">GdaTransaction</link>*     <link linkend="gda-command-get-transaction">gda_command_get_transaction</link>         (<link linkend="GdaCommand">GdaCommand</link> *cmd);
<link linkend="void">void</link>                <link linkend="gda-command-set-transaction">gda_command_set_transaction</link>         (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         <link linkend="GdaTransaction">GdaTransaction</link> *xaction);
</synopsis>
</refsynopsisdiv>









<refsect1 id="libgda-gda-command.description" role="desc">
<title role="desc.title">Description</title>
<para>
  The <link linkend="GdaCommand"><type>GdaCommand</type></link> structure holds data needed to issue a command to the
  providers.
  Applications usually create a <link linkend="GdaCommand"><type>GdaCommand</type></link> (via <link linkend="gda-command-new"><type>gda_command_new</type></link>), set its
  properties (via the gda_command_set_* functions) and pass it over to the
  database using the <link linkend="GdaConnection"><type>GdaConnection</type></link> functions.
</para>
<para>
  One interesting thing about <link linkend="GdaCommand"><type>GdaCommand</type></link>'s is that they can be reused over
  and over. That is, applications don't need to create a command every time
  they want to run something on the connected database. Moreover, the ability
  to create command strings with placeholders allows the use of parameters to
  specify the values for those placeholders. Thus, an application can create a
  command of the form:
  <programlisting>
    INSERT INTO employees VALUES (%id, %name, %address, %salary)
  </programlisting>
  and reuse the same command over and over, just using different values for the
  placeholders.
</para>
<para>
  The value for the placeholders is specified when sending the <link linkend="GdaCommand"><type>GdaCommand</type></link> to a
  database connection, which is done via the <link linkend="gda-connection-execute"><type>gda_connection_execute</type></link> function.
</para>
</refsect1>

<refsect1 id="libgda-gda-command.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GdaCommandOptions" role="enum">
<title>enum GdaCommandOptions</title>
<indexterm zone="GdaCommandOptions"><primary>GdaCommandOptions</primary></indexterm><programlisting>typedef enum {
	GDA_COMMAND_OPTION_IGNORE_ERRORS  = 1,
	GDA_COMMAND_OPTION_STOP_ON_ERRORS = 1 &lt;&lt; 1,
	GDA_COMMAND_OPTION_BAD_OPTION     = 1 &lt;&lt; 2
} GdaCommandOptions;
</programlisting>
<para>
And OR'ed combination of GDA_COMMAND_OPTIONS_* values.

</para></refsect2>
<refsect2 id="GDA-COMMAND-DEFAULT-OPTION:CAPS" role="macro">
<title>GDA_COMMAND_DEFAULT_OPTION</title>
<indexterm zone="GDA-COMMAND-DEFAULT-OPTION:CAPS"><primary>GDA_COMMAND_DEFAULT_OPTION</primary></indexterm><programlisting>#define GDA_COMMAND_DEFAULT_OPTION GDA_COMMAND_OPTION_IGNORE_ERRORS
</programlisting>
<para>
This value is the one set by default. Currently is equal to
<link linkend="GDA-COMMAND-OPTION-STOP-ON-ERRORS:CAPS"><type>GDA_COMMAND_OPTION_STOP_ON_ERRORS</type></link>.

</para></refsect2>
<refsect2 id="GdaCommandType" role="enum">
<title>enum GdaCommandType</title>
<indexterm zone="GdaCommandType"><primary>GdaCommandType</primary></indexterm><programlisting>typedef enum {
	GDA_COMMAND_TYPE_SQL,
	GDA_COMMAND_TYPE_XML,
	GDA_COMMAND_TYPE_PROCEDURE,
	GDA_COMMAND_TYPE_TABLE,
	GDA_COMMAND_TYPE_SCHEMA,
	GDA_COMMAND_TYPE_INVALID
} GdaCommandType;
</programlisting>
<para>

</para><variablelist role="enum">
<varlistentry id="GDA-COMMAND-TYPE-SQL:CAPS" role="constant">
<term><literal>GDA_COMMAND_TYPE_SQL</literal></term>
<listitem><simpara>the text of the command is composed of zero or more SQL
sentences.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDA-COMMAND-TYPE-XML:CAPS" role="constant">
<term><literal>GDA_COMMAND_TYPE_XML</literal></term>
<listitem><simpara>
</simpara></listitem>
</varlistentry>
<varlistentry id="GDA-COMMAND-TYPE-PROCEDURE:CAPS" role="constant">
<term><literal>GDA_COMMAND_TYPE_PROCEDURE</literal></term>
<listitem><simpara>
</simpara></listitem>
</varlistentry>
<varlistentry id="GDA-COMMAND-TYPE-TABLE:CAPS" role="constant">
<term><literal>GDA_COMMAND_TYPE_TABLE</literal></term>
<listitem><simpara>the text of the command is composed of zero or more
table names.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDA-COMMAND-TYPE-SCHEMA:CAPS" role="constant">
<term><literal>GDA_COMMAND_TYPE_SCHEMA</literal></term>
<listitem><simpara>
</simpara></listitem>
</varlistentry>
<varlistentry id="GDA-COMMAND-TYPE-INVALID:CAPS" role="constant">
<term><literal>GDA_COMMAND_TYPE_INVALID</literal></term>
<listitem><simpara>

</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="GdaCommand" role="struct">
<title>GdaCommand</title>
<indexterm zone="GdaCommand"><primary>GdaCommand</primary></indexterm><programlisting>typedef struct {
	gchar *text;
	GdaCommandType type;
	GdaCommandOptions options;
	GdaTransaction *xaction;
} GdaCommand;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="GDA-TYPE-COMMAND:CAPS" role="macro">
<title>GDA_TYPE_COMMAND</title>
<indexterm zone="GDA-TYPE-COMMAND:CAPS"><primary>GDA_TYPE_COMMAND</primary></indexterm><programlisting>#define GDA_TYPE_COMMAND (gda_command_get_type ())
</programlisting>
<para>

</para></refsect2>
<refsect2 id="gda-command-get-type" role="function">
<title>gda_command_get_type ()</title>
<indexterm zone="gda-command-get-type"><primary>gda_command_get_type</primary></indexterm><programlisting><link linkend="GType">GType</link>               gda_command_get_type                (void);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-new" role="function">
<title>gda_command_new ()</title>
<indexterm zone="gda-command-new"><primary>gda_command_new</primary></indexterm><programlisting><link linkend="GdaCommand">GdaCommand</link>*         gda_command_new                     (const <link linkend="gchar">gchar</link> *text,
                                                         <link linkend="GdaCommandType">GdaCommandType</link> type,
                                                         <link linkend="GdaCommandOptions">GdaCommandOptions</link> options);</programlisting>
<para>
Creates a new <link linkend="GdaCommand"><type>GdaCommand</type></link> from the parameters that should be freed by
calling <link linkend="gda-command-free"><type>gda_command_free</type></link>.
</para>
<para>
If there are conflicting options, this will set <parameter>options</parameter> to
<link linkend="GDA-COMMAND-OPTION-DEFAULT:CAPS"><type>GDA_COMMAND_OPTION_DEFAULT</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>text</parameter>&nbsp;:</term>
<listitem><simpara> the text of the command.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>type</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommandType"><type>GdaCommandType</type></link> value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>options</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommandOptions"><type>GdaCommandOptions</type></link> value.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly allocated <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-free" role="function">
<title>gda_command_free ()</title>
<indexterm zone="gda-command-free"><primary>gda_command_free</primary></indexterm><programlisting><link linkend="void">void</link>                gda_command_free                    (<link linkend="GdaCommand">GdaCommand</link> *cmd);</programlisting>
<para>
Frees the resources allocated by <link linkend="gda-command-new"><type>gda_command_new</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-copy" role="function">
<title>gda_command_copy ()</title>
<indexterm zone="gda-command-copy"><primary>gda_command_copy</primary></indexterm><programlisting><link linkend="GdaCommand">GdaCommand</link>*         gda_command_copy                    (<link linkend="GdaCommand">GdaCommand</link> *cmd);</programlisting>
<para>
Creates a new <link linkend="GdaCommand"><type>GdaCommand</type></link> from an existing one.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> command to get a copy from.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly allocated <link linkend="GdaCommand"><type>GdaCommand</type></link> with a copy of the data in <parameter>cmd</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-get-text" role="function">
<title>gda_command_get_text ()</title>
<indexterm zone="gda-command-get-text"><primary>gda_command_get_text</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>*        gda_command_get_text                (<link linkend="GdaCommand">GdaCommand</link> *cmd);</programlisting>
<para>
Gets the command text held by <parameter>cmd</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the command string of <parameter>cmd</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-set-text" role="function">
<title>gda_command_set_text ()</title>
<indexterm zone="gda-command-set-text"><primary>gda_command_set_text</primary></indexterm><programlisting><link linkend="void">void</link>                gda_command_set_text                (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         const <link linkend="gchar">gchar</link> *text);</programlisting>
<para>
Sets the command text of <parameter>cmd</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>text</parameter>&nbsp;:</term>
<listitem><simpara> the command text.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-get-command-type" role="function">
<title>gda_command_get_command_type ()</title>
<indexterm zone="gda-command-get-command-type"><primary>gda_command_get_command_type</primary></indexterm><programlisting><link linkend="GdaCommandType">GdaCommandType</link>      gda_command_get_command_type        (<link linkend="GdaCommand">GdaCommand</link> *cmd);</programlisting>
<para>
Gets the command type of <parameter>cmd</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the command type of <parameter>cmd</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-set-command-type" role="function">
<title>gda_command_set_command_type ()</title>
<indexterm zone="gda-command-set-command-type"><primary>gda_command_set_command_type</primary></indexterm><programlisting><link linkend="void">void</link>                gda_command_set_command_type        (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         <link linkend="GdaCommandType">GdaCommandType</link> type);</programlisting>
<para>
Sets the command type of <parameter>cmd</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>type</parameter>&nbsp;:</term>
<listitem><simpara> the command type.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-get-options" role="function">
<title>gda_command_get_options ()</title>
<indexterm zone="gda-command-get-options"><primary>gda_command_get_options</primary></indexterm><programlisting><link linkend="GdaCommandOptions">GdaCommandOptions</link>   gda_command_get_options             (<link linkend="GdaCommand">GdaCommand</link> *cmd);</programlisting>
<para>
Gets the command options of <parameter>cmd</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the command options of <parameter>cmd</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-set-options" role="function">
<title>gda_command_set_options ()</title>
<indexterm zone="gda-command-set-options"><primary>gda_command_set_options</primary></indexterm><programlisting><link linkend="void">void</link>                gda_command_set_options             (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         <link linkend="GdaCommandOptions">GdaCommandOptions</link> options);</programlisting>
<para>
Sets the command options of <parameter>cmd</parameter>. If there conflicting options, it will just
leave the value as before.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>options</parameter>&nbsp;:</term>
<listitem><simpara> the command options.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-get-transaction" role="function">
<title>gda_command_get_transaction ()</title>
<indexterm zone="gda-command-get-transaction"><primary>gda_command_get_transaction</primary></indexterm><programlisting><link linkend="GdaTransaction">GdaTransaction</link>*     gda_command_get_transaction         (<link linkend="GdaCommand">GdaCommand</link> *cmd);</programlisting>
<para>
Gets the <link linkend="GdaTransaction"><type>GdaTransaction</type></link> associated with the given <link linkend="GdaCommand"><type>GdaCommand</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the transaction for the command.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gda-command-set-transaction" role="function">
<title>gda_command_set_transaction ()</title>
<indexterm zone="gda-command-set-transaction"><primary>gda_command_set_transaction</primary></indexterm><programlisting><link linkend="void">void</link>                gda_command_set_transaction         (<link linkend="GdaCommand">GdaCommand</link> *cmd,
                                                         <link linkend="GdaTransaction">GdaTransaction</link> *xaction);</programlisting>
<para>
Sets the <link linkend="GdaTransaction"><type>GdaTransaction</type></link> associated with the given <link linkend="GdaCommand"><type>GdaCommand</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cmd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaCommand"><type>GdaCommand</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xaction</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GdaTransaction"><type>GdaTransaction</type></link> object.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>