~ubuntu-branches/ubuntu/precise/postgresql-9.1/precise-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/app-ecpg.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>ecpg</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.1beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="PostgreSQL Client Applications"
 
16
HREF="reference-client.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="dropuser"
 
19
HREF="app-dropuser.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="pg_basebackup"
 
22
HREF="app-pgbasebackup.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2011-04-27T21:20:33"></HEAD
 
30
><BODY
 
31
CLASS="REFENTRY"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.1beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="dropuser"
 
57
HREF="app-dropuser.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
TITLE="dropuser"
 
67
HREF="app-dropuser.html"
 
68
>Fast Backward</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
></TD
 
75
><TD
 
76
WIDTH="10%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="pg_basebackup"
 
81
HREF="app-pgbasebackup.html"
 
82
>Fast Forward</A
 
83
></TD
 
84
><TD
 
85
WIDTH="10%"
 
86
ALIGN="right"
 
87
VALIGN="top"
 
88
><A
 
89
TITLE="pg_basebackup"
 
90
HREF="app-pgbasebackup.html"
 
91
ACCESSKEY="N"
 
92
>Next</A
 
93
></TD
 
94
></TR
 
95
></TABLE
 
96
><HR
 
97
ALIGN="LEFT"
 
98
WIDTH="100%"></DIV
 
99
><H1
 
100
><A
 
101
NAME="APP-ECPG"
 
102
></A
 
103
><SPAN
 
104
CLASS="APPLICATION"
 
105
>ecpg</SPAN
 
106
></H1
 
107
><DIV
 
108
CLASS="REFNAMEDIV"
 
109
><A
 
110
NAME="AEN77881"
 
111
></A
 
112
><H2
 
113
>Name</H2
 
114
><SPAN
 
115
CLASS="APPLICATION"
 
116
>ecpg</SPAN
 
117
>&nbsp;--&nbsp;embedded SQL C preprocessor</DIV
 
118
><DIV
 
119
CLASS="REFSYNOPSISDIV"
 
120
><A
 
121
NAME="AEN77887"
 
122
></A
 
123
><H2
 
124
>Synopsis</H2
 
125
><P
 
126
><TT
 
127
CLASS="COMMAND"
 
128
>ecpg</TT
 
129
> [<TT
 
130
CLASS="REPLACEABLE"
 
131
><I
 
132
>option</I
 
133
></TT
 
134
>...]  <TT
 
135
CLASS="REPLACEABLE"
 
136
><I
 
137
>file</I
 
138
></TT
 
139
>... </P
 
140
></DIV
 
141
><DIV
 
142
CLASS="REFSECT1"
 
143
><A
 
144
NAME="APP-ECPG-DESCRIPTION"
 
145
></A
 
146
><H2
 
147
>Description</H2
 
148
><P
 
149
>   <TT
 
150
CLASS="COMMAND"
 
151
>ecpg</TT
 
152
> is the embedded SQL preprocessor for C
 
153
   programs.  It converts C programs with embedded SQL statements to
 
154
   normal C code by replacing the SQL invocations with special
 
155
   function calls.  The output files can then be processed with any C
 
156
   compiler tool chain.
 
157
  </P
 
158
><P
 
159
>   <TT
 
160
CLASS="COMMAND"
 
161
>ecpg</TT
 
162
> will convert each input file given on the
 
163
   command line to the corresponding C output file.  Input files
 
164
   preferably have the extension <TT
 
165
CLASS="FILENAME"
 
166
>.pgc</TT
 
167
>, in which
 
168
   case the extension will be replaced by <TT
 
169
CLASS="FILENAME"
 
170
>.c</TT
 
171
> to
 
172
   determine the output file name.  If the extension of the input file
 
173
   is not <TT
 
174
CLASS="FILENAME"
 
175
>.pgc</TT
 
176
>, then the output file name is
 
177
   computed by appending <TT
 
178
CLASS="LITERAL"
 
179
>.c</TT
 
180
> to the full file name.
 
181
   The output file name can also be overridden using the
 
182
   <TT
 
183
CLASS="OPTION"
 
184
>-o</TT
 
185
> option.
 
186
  </P
 
187
><P
 
188
>   This reference page does not describe the embedded SQL language.
 
189
   See <A
 
190
HREF="ecpg.html"
 
191
>Chapter 33</A
 
192
> for more information on that topic.
 
193
  </P
 
194
></DIV
 
195
><DIV
 
196
CLASS="REFSECT1"
 
197
><A
 
198
NAME="AEN77907"
 
199
></A
 
200
><H2
 
201
>Options</H2
 
202
><P
 
203
>   <TT
 
204
CLASS="COMMAND"
 
205
>ecpg</TT
 
206
> accepts the following command-line
 
207
   arguments:
 
208
 
 
209
   <P
 
210
></P
 
211
></P><DIV
 
212
CLASS="VARIABLELIST"
 
213
><DL
 
214
><DT
 
215
><TT
 
216
CLASS="OPTION"
 
217
>-c</TT
 
218
></DT
 
219
><DD
 
220
><P
 
221
>       Automatically generate certain C code from SQL code.  Currently, this
 
222
       works for <TT
 
223
CLASS="LITERAL"
 
224
>EXEC SQL TYPE</TT
 
225
>.
 
226
      </P
 
227
></DD
 
228
><DT
 
229
><TT
 
230
CLASS="OPTION"
 
231
>-C <TT
 
232
CLASS="REPLACEABLE"
 
233
><I
 
234
>mode</I
 
235
></TT
 
236
></TT
 
237
></DT
 
238
><DD
 
239
><P
 
240
>       Set a compatibility mode.  <TT
 
241
CLASS="REPLACEABLE"
 
242
><I
 
243
>mode</I
 
244
></TT
 
245
> can
 
246
       be <TT
 
247
CLASS="LITERAL"
 
248
>INFORMIX</TT
 
249
> or
 
250
       <TT
 
251
CLASS="LITERAL"
 
252
>INFORMIX_SE</TT
 
253
>.
 
254
      </P
 
255
></DD
 
256
><DT
 
257
><TT
 
258
CLASS="OPTION"
 
259
>-D <TT
 
260
CLASS="REPLACEABLE"
 
261
><I
 
262
>symbol</I
 
263
></TT
 
264
></TT
 
265
></DT
 
266
><DD
 
267
><P
 
268
>       Define a C preprocessor symbol.
 
269
      </P
 
270
></DD
 
271
><DT
 
272
><TT
 
273
CLASS="OPTION"
 
274
>-i</TT
 
275
></DT
 
276
><DD
 
277
><P
 
278
>       Parse system include files as well.
 
279
      </P
 
280
></DD
 
281
><DT
 
282
><TT
 
283
CLASS="OPTION"
 
284
>-I <TT
 
285
CLASS="REPLACEABLE"
 
286
><I
 
287
>directory</I
 
288
></TT
 
289
></TT
 
290
></DT
 
291
><DD
 
292
><P
 
293
>       Specify an additional include path, used to find files included
 
294
       via <TT
 
295
CLASS="LITERAL"
 
296
>EXEC SQL INCLUDE</TT
 
297
>.  Defaults are
 
298
       <TT
 
299
CLASS="FILENAME"
 
300
>.</TT
 
301
> (current directory),
 
302
       <TT
 
303
CLASS="FILENAME"
 
304
>/usr/local/include</TT
 
305
>, the
 
306
       <SPAN
 
307
CLASS="PRODUCTNAME"
 
308
>PostgreSQL</SPAN
 
309
> include directory which
 
310
       is defined at compile time (default:
 
311
       <TT
 
312
CLASS="FILENAME"
 
313
>/usr/local/pgsql/include</TT
 
314
>), and
 
315
       <TT
 
316
CLASS="FILENAME"
 
317
>/usr/include</TT
 
318
>, in that order.
 
319
      </P
 
320
></DD
 
321
><DT
 
322
><TT
 
323
CLASS="OPTION"
 
324
>-o <TT
 
325
CLASS="REPLACEABLE"
 
326
><I
 
327
>filename</I
 
328
></TT
 
329
></TT
 
330
></DT
 
331
><DD
 
332
><P
 
333
>       Specifies that <TT
 
334
CLASS="COMMAND"
 
335
>ecpg</TT
 
336
> should write all
 
337
       its output to the given <TT
 
338
CLASS="REPLACEABLE"
 
339
><I
 
340
>filename</I
 
341
></TT
 
342
>.
 
343
      </P
 
344
></DD
 
345
><DT
 
346
><TT
 
347
CLASS="OPTION"
 
348
>-r <TT
 
349
CLASS="REPLACEABLE"
 
350
><I
 
351
>option</I
 
352
></TT
 
353
></TT
 
354
></DT
 
355
><DD
 
356
><P
 
357
>       Selects run-time behavior.  <TT
 
358
CLASS="REPLACEABLE"
 
359
><I
 
360
>Option</I
 
361
></TT
 
362
> can be
 
363
       one of the following:
 
364
       <P
 
365
></P
 
366
></P><DIV
 
367
CLASS="VARIABLELIST"
 
368
><DL
 
369
><DT
 
370
><TT
 
371
CLASS="OPTION"
 
372
>no_indicator</TT
 
373
></DT
 
374
><DD
 
375
><P
 
376
>         Do not use indicators but instead use special values to represent
 
377
         NULLs. Historically there have been databases using this approach.
 
378
         </P
 
379
></DD
 
380
><DT
 
381
><TT
 
382
CLASS="OPTION"
 
383
>prepare</TT
 
384
></DT
 
385
><DD
 
386
><P
 
387
>         Prepare all statements before using them. Libecpg will keep a cache of
 
388
         prepared statments and reuse a statement if it gets executed again. If the
 
389
         cache runs full, libecpg will free the least used statement.
 
390
         </P
 
391
></DD
 
392
><DT
 
393
><TT
 
394
CLASS="OPTION"
 
395
>questionmarks</TT
 
396
></DT
 
397
><DD
 
398
><P
 
399
>         Allow questionmark as placeholder for compatibility reasons. 
 
400
         This used to be the default long ago.
 
401
         </P
 
402
></DD
 
403
></DL
 
404
></DIV
 
405
><P>
 
406
      </P
 
407
></DD
 
408
><DT
 
409
><TT
 
410
CLASS="OPTION"
 
411
>-t</TT
 
412
></DT
 
413
><DD
 
414
><P
 
415
>       Turn on autocommit of transactions. In this mode, each SQL command is
 
416
       automatically committed unless it is inside an explicit
 
417
       transaction block. In the default mode, commands are committed
 
418
       only when <TT
 
419
CLASS="COMMAND"
 
420
>EXEC SQL COMMIT</TT
 
421
> is issued.
 
422
      </P
 
423
></DD
 
424
><DT
 
425
><TT
 
426
CLASS="OPTION"
 
427
>-v</TT
 
428
></DT
 
429
><DD
 
430
><P
 
431
>       Print additional information including the version and the
 
432
       "include" path.
 
433
      </P
 
434
></DD
 
435
><DT
 
436
><TT
 
437
CLASS="OPTION"
 
438
>--version</TT
 
439
></DT
 
440
><DD
 
441
><P
 
442
>       Print the <SPAN
 
443
CLASS="APPLICATION"
 
444
>ecpg</SPAN
 
445
> version and exit.
 
446
      </P
 
447
></DD
 
448
><DT
 
449
><TT
 
450
CLASS="OPTION"
 
451
>--help</TT
 
452
></DT
 
453
><DD
 
454
><P
 
455
>       Show help about <SPAN
 
456
CLASS="APPLICATION"
 
457
>ecpg</SPAN
 
458
> command line
 
459
       arguments, and exit.
 
460
      </P
 
461
></DD
 
462
></DL
 
463
></DIV
 
464
><P>
 
465
  </P
 
466
></DIV
 
467
><DIV
 
468
CLASS="REFSECT1"
 
469
><A
 
470
NAME="AEN78004"
 
471
></A
 
472
><H2
 
473
>Notes</H2
 
474
><P
 
475
>   When compiling the preprocessed C code files, the compiler needs to
 
476
   be able to find the <SPAN
 
477
CLASS="APPLICATION"
 
478
>ECPG</SPAN
 
479
> header files in the
 
480
   <SPAN
 
481
CLASS="PRODUCTNAME"
 
482
>PostgreSQL</SPAN
 
483
> include directory.  Therefore, you might
 
484
   have to use the <TT
 
485
CLASS="OPTION"
 
486
>-I</TT
 
487
> option when invoking the compiler
 
488
   (e.g., <TT
 
489
CLASS="LITERAL"
 
490
>-I/usr/local/pgsql/include</TT
 
491
>).
 
492
  </P
 
493
><P
 
494
>   Programs using C code with embedded SQL have to be linked against
 
495
   the <TT
 
496
CLASS="FILENAME"
 
497
>libecpg</TT
 
498
> library, for example using the
 
499
   linker options <TT
 
500
CLASS="LITERAL"
 
501
>-L/usr/local/pgsql/lib -lecpg</TT
 
502
>.
 
503
  </P
 
504
><P
 
505
>   The value of either of these directories that is appropriate for
 
506
   the installation can be found out using <A
 
507
HREF="app-pgconfig.html"
 
508
>pg_config</A
 
509
>.
 
510
  </P
 
511
></DIV
 
512
><DIV
 
513
CLASS="REFSECT1"
 
514
><A
 
515
NAME="AEN78016"
 
516
></A
 
517
><H2
 
518
>Examples</H2
 
519
><P
 
520
>   If you have an embedded SQL C source file named
 
521
   <TT
 
522
CLASS="FILENAME"
 
523
>prog1.pgc</TT
 
524
>, you can create an executable
 
525
   program using the following sequence of commands:
 
526
</P><PRE
 
527
CLASS="PROGRAMLISTING"
 
528
>ecpg prog1.pgc
 
529
cc -I/usr/local/pgsql/include -c prog1.c
 
530
cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg</PRE
 
531
><P>
 
532
  </P
 
533
></DIV
 
534
><DIV
 
535
CLASS="NAVFOOTER"
 
536
><HR
 
537
ALIGN="LEFT"
 
538
WIDTH="100%"><TABLE
 
539
SUMMARY="Footer navigation table"
 
540
WIDTH="100%"
 
541
BORDER="0"
 
542
CELLPADDING="0"
 
543
CELLSPACING="0"
 
544
><TR
 
545
><TD
 
546
WIDTH="33%"
 
547
ALIGN="left"
 
548
VALIGN="top"
 
549
><A
 
550
HREF="app-dropuser.html"
 
551
ACCESSKEY="P"
 
552
>Prev</A
 
553
></TD
 
554
><TD
 
555
WIDTH="34%"
 
556
ALIGN="center"
 
557
VALIGN="top"
 
558
><A
 
559
HREF="index.html"
 
560
ACCESSKEY="H"
 
561
>Home</A
 
562
></TD
 
563
><TD
 
564
WIDTH="33%"
 
565
ALIGN="right"
 
566
VALIGN="top"
 
567
><A
 
568
HREF="app-pgbasebackup.html"
 
569
ACCESSKEY="N"
 
570
>Next</A
 
571
></TD
 
572
></TR
 
573
><TR
 
574
><TD
 
575
WIDTH="33%"
 
576
ALIGN="left"
 
577
VALIGN="top"
 
578
><SPAN
 
579
CLASS="APPLICATION"
 
580
>dropuser</SPAN
 
581
></TD
 
582
><TD
 
583
WIDTH="34%"
 
584
ALIGN="center"
 
585
VALIGN="top"
 
586
><A
 
587
HREF="reference-client.html"
 
588
ACCESSKEY="U"
 
589
>Up</A
 
590
></TD
 
591
><TD
 
592
WIDTH="33%"
 
593
ALIGN="right"
 
594
VALIGN="top"
 
595
>pg_basebackup</TD
 
596
></TR
 
597
></TABLE
 
598
></DIV
 
599
></BODY
 
600
></HTML
 
601
>
 
 
b'\\ No newline at end of file'