tdbc_postgres.n 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. '\"
  2. .\" tdbc_postgres.n --
  3. .\"
  4. .\" Copyright (c) 2009 by Slawomir Cygan
  5. .\"
  6. .\" See the file "license.terms" for information on usage and redistribution of
  7. .\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
  8. .TH "tdbc::postgres" n 8.6 Tcl "Tcl Database Connectivity"
  9. .\" .so man.macros
  10. .if t .wh -1.3i ^B
  11. .nr ^l \n(.l
  12. .ad b
  13. .\" # BS - start boxed text
  14. .\" # ^y = starting y location
  15. .\" # ^b = 1
  16. .de BS
  17. .br
  18. .mk ^y
  19. .nr ^b 1u
  20. .if n .nf
  21. .if n .ti 0
  22. .if n \l'\\n(.lu\(ul'
  23. .if n .fi
  24. ..
  25. .\" # BE - end boxed text (draw box now)
  26. .de BE
  27. .nf
  28. .ti 0
  29. .mk ^t
  30. .ie n \l'\\n(^lu\(ul'
  31. .el \{\
  32. .\" Draw four-sided box normally, but don't draw top of
  33. .\" box if the box started on an earlier page.
  34. .ie !\\n(^b-1 \{\
  35. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  36. .\}
  37. .el \}\
  38. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  39. .\}
  40. .\}
  41. .fi
  42. .br
  43. .nr ^b 0
  44. ..
  45. .\" # CS - begin code excerpt
  46. .de CS
  47. .RS
  48. .nf
  49. .ta .25i .5i .75i 1i
  50. ..
  51. .\" # CE - end code excerpt
  52. .de CE
  53. .fi
  54. .RE
  55. ..
  56. .BS
  57. .SH "NAME"
  58. tdbc::postgres \- TDBC-POSTGRES bridge
  59. .SH "SYNOPSIS"
  60. package require \fBtdbc::postgres 1.0\fR
  61. .sp
  62. \fBtdbc::postgres::connection create\fR \fIdb\fR ?\fI-option value...\fR?
  63. .br
  64. \fBtdbc::postgres::connection new\fR ?\fI-option value...\fR?
  65. .BE
  66. .SH "DESCRIPTION"
  67. .PP
  68. The \fBtdbc::postgres\fR driver provides a database interface that conforms
  69. to Tcl DataBase Connectivity (TDBC) and allows a Tcl script to connect
  70. to a Postgres database.
  71. .PP
  72. Connection to a POSTGRES database is established by invoking
  73. \fBtdbc::postgres::connection create\fR, passing it the name to give the
  74. database handle and a set of \fI-option-value\fR pairs. The available
  75. options are enumerated under CONNECTION OPTIONS below.
  76. As an alternative, \fBtdbc::postgres::connection new\fR may be used to create
  77. a database connection with an automatically assigned name. The return value
  78. from \fBtdbc::postgres::connection new\fR is the name that was chosen for the
  79. connection handle.
  80. .PP
  81. The side effect of \fBtdbc::postgres::connection create\fR is to create a
  82. new database connection.. See \fBtdbc::connection(n)\fR for the
  83. details of how to use the connection to manipulate a database.
  84. .SH "CONNECTION OPTIONS"
  85. .PP
  86. The \fBtdbc::postgres::connection create\fR object command supports the
  87. \fB-encoding\fR, \fB-isolation\fR, \fB-readonly\fR and \fB-timeout\fR
  88. options common to all TDBC drivers. The \fB-timeout\fR option will
  89. only affect connection process, once connected this value will be
  90. ignored and cannot be changed after connecting.
  91. .PP
  92. In addition, the following options are recognized (these options must be
  93. set on the initial creation of the connection; they cannot be changed
  94. after connecting) :
  95. .IP "\fB-host\fR \fIhostname\fR"
  96. Connects to the host specified by \fIhostname\fR. Default is to connect using a local Unix domain socket.
  97. .IP "\fB-hostaddr\fR \fIaddress\fR"
  98. Connects to the host specified by given IP \fIaddress\fR. If both \fB-host\fR and \fB-hostaddr\fR are given, the value
  99. of \fB-host\fR is ignored. Default is to connect using a local Unix domain socket.
  100. .IP "\fB-port\fR \fInumber\fR"
  101. Connects to a Postgres server listening on the port specified by \fInumber\fR.
  102. It is used only when \fIhost\fR or \fIhostaddr\fR is specified.
  103. .IP "\fB-user\fR \fIname\fR"
  104. Presents \fIname\fR as the user name to the Postgres server. Default is the
  105. current user ID.
  106. .IP "\fB-passwd\fR \fIpassword\fR"
  107. .IP "\fB-password\fR \fIpassword\fR"
  108. These two options are synonymous. They present the given \fIpassword\fR as
  109. the user's password to the Postgres server. Default is not to present a password.
  110. .IP "\fB-database\fR \fIname\fR"
  111. .IP "\fB-db\fR \fIname\fR"
  112. These two options are synonymous. They present the given \fIname\fR as the
  113. name of the default database to use in Postgres queries. If not specified,
  114. the default database for the current user is used.
  115. .IP "\fB-options\fR \fIopts\fR"
  116. This sets \fIopts\fR as additional command line options send to the server.
  117. .IP "\fB-tty\fR \fIfile\fR"
  118. This option is ignored on never servers. Formerly this specified where to send debug
  119. output. This option is left for compatibility with older servers.
  120. .IP "\fB-sslmode\fR \fImode\fR"
  121. This option determines whether or with what priority an SSL connection will be negotiated with
  122. the server. There are four \fImodes\fR: \fBdisable\fR will attempt only an unencrypted SSL connection;
  123. \fBallow\fR will negotiate, trying first a non-SSL connection, then if that fails, trying an SSL
  124. connection; \fBprefer\fR (the default) will negotiate, trying first an SSL connection,
  125. then if that fails, trying a regular non-SSL connection; \fBrequire\fR will try only an SSL connection.
  126. If PostgreSQL is compiled without SSL support, using option \fBrequire\fR will cause an error,
  127. and options \fBallow\fR and \fBprefer\fR will be tolerated but the driver will be unable to negotiate
  128. an SSL connection.
  129. .IP \fB-requiressl\fR \fIflag\fR
  130. This option is deprecated in favor of the \fB-sslmode\fR setting.
  131. The \fIflag\fR value must be a Boolean value. If it is \fBtrue\fR (or
  132. any equivalent), driver will then refuse to connect if the server does
  133. not accept an SSL connection. The default value is \fBfalse\fR (or any
  134. equivalent), and acts the same like \fB-sslmode\fR \fBpreffered\fR
  135. .IP \fB-service\fR \fIname\fR
  136. It specifies a service \fIname\fR in pg_service.conf file that holds additional connection parameters.
  137. This allows applications to specify only a service name so connection parameters can be
  138. centrally maintained. Refer to PostgreSQL Documentation or PREFIX/share/pg_service.conf.sample file
  139. for details.
  140. .SH EXAMPLES
  141. .PP
  142. .CS
  143. tdbc::postgres::connection -user joe -passwd sesame -db joes_database
  144. .CE
  145. Connects to the Postgres server on the local host using the default
  146. connection method, presenting user ID 'joe' and password 'sesame'.
  147. Uses 'joes_database' as the default database name.
  148. .SH "SEE ALSO"
  149. tdbc(n), tdbc::connection(n), tdbc::resultset(n), tdbc::statement(n)
  150. .SH "KEYWORDS"
  151. TDBC, SQL, Postgres, database, connectivity, connection
  152. .SH "COPYRIGHT"
  153. Copyright (c) 2009 by Slawomir Cygan
  154. .\" Local Variables:
  155. .\" mode: nroff
  156. .\" End:
  157. .\"