pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedFwd: pgsql - ODBC Config.html document
2+ messages / 2 participants
[nested] [flat]
* Fwd: pgsql - ODBC Config.html document
@ 2013-10-03 04:45 Richard Broersma <richard.broersma@gmail.com>
2013-10-03 07:13 ` Re: Fwd: pgsql - ODBC Config.html document Heikki Linnakangas <hlinnakangas@vmware.com>
0 siblings, 1 reply; 2+ messages in thread
From: Richard Broersma @ 2013-10-03 04:45 UTC (permalink / raw)
To: pgsql-odbc
I noticed that some of the ODBC documentation was in pretty poor shape from
an HTML structure perspective.
Since I'm teaching myself HTML and CSS, I thought I'd use what I learned to
freshen the config.html document.
While I'm still very much a beginner at HTML, I think you'll agree that
I've improved its structure a bit.
The commiters are welcome to incorporate these files to the repository, if
they'd would like.
The original can be found here:
http://git.postgresql.org/gitweb/?p=psqlodbc.git;a=blob_plain;f=docs/config.html;hb=HEAD
Attached is the restructured version.
--
Regards,
Richard Broersma Jr.
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Attachments:
config.html (text/html, 20.1K) download
<!DOCtype html>
<html>
<head>
<meta charset="UTF-8">
<title>psqlODBC Configuration Options</title>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<body>
<h1>psqlODBC Configuration Options</h1>
<h2 id="optionsdialog1o2">Advanced Options 1/2 Dialog Box</h2>
<h3 id="defaults" class="varname">DEFAULTS</h3>
<p>
Press this button to restore the normal defaults for the
settings described below.
</p>
<h3 id="geneticoptimizer" class="varname">Disable Genetic Optimizer</h3>
<p>
Automatically turns off the backend genetic optimizer
at connection time. This is a convenience feature rather
than having to type it in the connect settings. This
feature was added when we noticed the backend seemed
to have big problems optimizing some queries.
</p>
<h3 id="ksqo" title="Keyset Query Optimization" class="varname">
<abbr>KSQO</abbr> (Keyset Query Optimization)</h3>
<p>
<em>Deprecated for 7.1+ servers.</em> Check this
option when connecting 7.0- servers and the
application seems to be suffering from the following
kind of queries:
</p>
<figure>
<pre CLASS="programlisting">SELECT ...
FROM ...
WHERE ( a=1 AND b=1 AND c=1 )
OR ( a=1 AND b=1 AND c=2 )</pre>
<figcaption>
This code block illustrates a where condition that may benefit from
setting KSQO option.
</figcaption>
</figure>
<h3 id="recognizeuniqueindexes" class="varname">Recognize Unique Indexes</h3>
<p>
Check this option.
</p>
<h3 id="usedeclarefetch" class="varname">Use Declare/Fetch</h3>
<p>
If true, the driver automatically uses declare
cursor/fetch to handle SELECT statements and
keeps 100 rows in a cache. This is mostly a great
advantage, especially if you are only interested in
reading and not updating. It results in the driver
not sucking down lots of memory to buffer the entire
result set. If set to false, cursors will not be
used and the driver will retrieve the entire result
set. For very large tables, this is very inefficient
and may use up all the Windows memory/resources.
However, it may handle updates better since the tables
are not kept open, as they are when using cursors.
This was the style of the old podbc32 driver. However,
the behavior of the memory allocation is much improved
so even when not using cursors, performance should
at least be better than the old podbc32.
</p>
<h3 id=parsestatements class="varname">Parse Statements</h3>
<p>
Tell the driver how to gather the information about
result columns of queries. See also
<a href="config.html#disallowpremature" class="varname">
Disallow Premature</a> and
<a href="config.html#serversideprepare" class="varname">
ServerSide Prepare</a> options. The driver checks this
option first.
</p>
<p>
If disabled then it checks the <span class="varname">
Server Side Prepare</span>
option. If disabled also it checks the <span class="varname">
Disallow Premature</span> option. If neither of them is specified
the driver would execute the prepared statement
prematurely when the application inquires the result
columns' info. If this option is enabled, the driver
will parse an SQL query statement to identify the
columns and tables and gather statistics about them
such as precision, nullability, aliases, etc. It then
reports this information in <span class="varname">
SQLDescribeCol</span>, <span class="varname">
SQLColAttributes</span>, and <span class="varname">
SQLNumResultCols</span>.
</p>
<p>
If the parser can not deal with a column (because it
is a function or expression, etc.), it will fallback
to executing the statement which is the old style of
getting the info. The parser is fairly sophisticated
and can handle many things such as column and table aliases,
quoted identifiers, literals, joins, cross-products, etc.
It can correctly identify a function or expression column,
regardless of the complexity, but it does not attempt to
determine the data type or precision of these columns.
</p>
<aside>
Prior to PostgreSQL 6.4, this was the only accurate way of
getting information on precision from a query result.
</aside>
<h3 id="cancelasfreestmt" class="varname">Cancel as FreeStmt</h3>
<p><!--HOLD FOR Definition --></p>
<h3 id="commlog" class="varname">CommLog</h3>
<p>
Log communications to/from the backend to that file.
This is good for debugging problems. The file name
for the log follows the naming convention
<span class="filename">psqlodbc_xxxx.log</span>.
</p>
<h3 id="mylog" class="varname">MyLog</h3>
<p>
Log debug messages to that file. This is good
for debugging problems with the driver.
The file name for this log follows the naming
convention <span class="filename">mylog_xxx.log</span>.
</p>
<h3 id="unknownsizes" class="varname">Unknown Sizes</h3>
<p>
This controls what <span class="varname">SQLDescribeCol</span>
and <span class="varname">SQLColAttributes</span>
will return as to precision for character data types
(varchar, text, and unknown) in a result set when the
precision is unknown.
</p>
<aside>
This was more of a workaround for pre-6.4 versions of
PostgreSQL not being able to return the defined column
width of the varchar data type.
</aside>
<dl>
<dt id="unknownsize-maximum" class="literal">Maximum</dt>
<dd>
Always return the maximum precision of the data type.
</dd>
<dt id="unknownsize-dontknow" class="literal">Dont Know</dt>
<dd>
Return "Don't Know" value and let application decide.
</dd>
<dt id="unknownsize-longest" class="literal">Longest</dt>
<dd>
Return the longest string length of the column of any
row. Beware of this setting when using cursors because
the cache size may not be a good representation of the
longest column in the cache.
</dd>
</dl>
<aside>
<p>
MS Access seems to handle <span class="literal">Maximum</span>
setting ok, as well as all the others.
</p>
<p>
If sizes are large and lots of columns,
Borland may crash badly (it doesn't seem to
handle memory allocation well) if using
<span class="literal">Maximum</span> size.
</p>
</aside>
<h3 id="datatypeoptions" class="varname">Data Type Options</h3>
<p>
The following options affects how some data types are
mapped.
</p>
<dl>
<dt id="datatypeoptions-text" class="literal">Text as LongVarChar</dt>
<dd>
PostgreSQL <span class="type">TEXT</span> type is mapped to
<span class="type">SQLLongVarchar</span>,
otherwise <span class="type">SQLVarchar</span>.
</dd>
<dt id="datatypeoptions-unknown" class="literal">Unknowns as LongVarChar</dt>
<dd>
Unknown types (arrays, etc) are mapped to <span class="type">SQLLongVarChar</span>,
otherwise <span class="type">SQLVarchar</span>.
</dd>
<dt id="datatypeoptions-bools" class="literal">Bools as Char</dt>
<dd>
Booleans are mapped to <span class="type">SQL_CHAR</span>,
otherwise to <span class="type">SQL_BIT"</span>.
</dd>
</dl>
<h3 id="maxvarchar" class="varname">Max Varchar</h3>
<p>
The maximum precision of the <span class="type">Varchar</span>
and <span class="type">BPChar(char[x])</span> types. The default is
254 which actually means 255 because
of the null terminator. Note, if you set this value higher
than 254, Access will not let you index on varchar columns!
</p>
<h3 id="cachesize" class="varname">Cache Size</h3>
<p>
When using cursors, this is the row size of the tuple cache.
If not using cursors, this is how many tuples to allocate
memory for at any given time. The default is 100 rows for
either case.
</p>
<h3 id="maxlongvarchar" class="varname">Max LongVarChar</h3>
<p>
The maximum precision of the <span class="type">LongVarChar</span>
type. The default is
4094 which actually means 4095 with the null terminator. You
can even specify (-4) for this size, which is the odbc
<span class="literal">SQL_NO_TOTAL</span> value.
</p>
<h3 id="systableprefixes" class="varname">SysTable Prefixes</h3>
<p>
The additional prefixes of table names to regard as System
Tables. The driver already treats names that begin with "pg_"
as system tables. Here you can add additional ones, such as
data dictionary tables (dd_). Separate each prefix with a
semicolon (;).
</p>
<h2 id="optionsdialog2o2">Advanced Options 2/2 Dialog Box</h2>
<h3 id="readonly" class="varname">ReadOnly</h3>
<p>
Whether the datasource will allow updates.
</p>
<h3 id="showsystemtables" class="varname">Show System Tables</h3>
<p>
The driver will treat system tables as regular tables in
SQLTables. This is good for Access so you can see system
tables.
</p>
<h3 id="linefeedconversion" class="varname">LF <-> CR/LF conversion</h3>
<p>
Convert Unix style line endings to DOS style.
</p>
<h3 id="updateablecursors" class="varname">Updateable Cursors</h3>
<p>
Enable updateable cursor emulation in the driver.
</p>
<h3 id="byteaaslo" class="varname">Bytea as LO</h3>
<p>
Allow the use of bytea columns for Large Objects.
</p>
<h3 id="rowversioning" class="varname">Row Versioning</h3>
<p>
Allows applications to detect whether data has been modified
by other users while you are attempting to update a row. It
also speeds the update process since every single column does
not need to be specified in the where clause to update a row.
The driver uses the <span class="literal">xmin</span> system
field of PostgreSQL to allow for row versioning. Microsoft
products seem to use this option well. See the
<a href="http://psqlodbc.projects.postgresql.org/faq.html">faq</a>
for details on what you need to do to your database to allow
for the row versioning feature to be used.
</p>
<h3 id="disallowpremature" class="varname">Disallow Premature</h3>
<p>
Mainly for 7.1 to 7.3 servers.
<a href="config.html#serversideprepare" class="varname">
Server side prepare </a>
is a more preferable option for 7.4+ servers.
</p>
<p>
Tell the driver how to gather the information about result columns.
See also <a href="config.html#parsestatements" class="varname">
Parse Statements</a> and
<a href="config.html#serversideprepare" class="varname">
Server Side Prepare</a> options.
</p>
<p>
This is an option to compensate for the lack of a server's
<span class="command">Prepare</span> functionality. For example,
(Middleware) applications issue the following ODBC API calls.
</p>
<pre class="programlisting">SQLPrepare( hstmt, "SELECT ...", .. )</pre>
<p>
In most cases they have to know how many fields, what kind
of fields they would return and so they would issue
<span class="varname">SQLNumResultCols</span> and/or
<span class="varname">SQLDescribeCols</span>/
<span class="varname">SQLColAttribute</span> etc.
</p>
<p>
The problem is how the psqlODBC driver answers the inquiry.
PostgreSQL hadn't provided the <span class="command">Prepare</span>
functionality until 7.4 and we couldn't ask the backend about
it directly.
</p>
<p>
When using <a href="config.html#disallowpremature" class="varname">
Disallow Premature</a>, the driver will get the column info as follows:
<p>
<figure>
<pre class="programlisting">BEGIN; --(unless in a transaction)
DECLARE CURSOR ... FOR SELECT ... ;
FETCH BACKWARD IN ... ;
CLOSE ... ;</pre>
<figcaption>
This code block illustrates the SQL used by the driver to
collect column information when using the Disallow Premature
option.
</figcaption>
</figure>
<p>
The driver gets the field info using the fetch backward's result.
The fetch backward command returns no row but returns the field
info. Though the command is expected to be returned immediately
it isn't true for 7.0- servers unfortunately. The 7.1 or later
servers <em>do</em> seem to return from the fetch backward command
immediately.
</p>
<h3 id="trueis-1" class="varname">True is -1</h3>
<p>
Represent <span class="varname">TRUE as -1</span> for compatibility
with some applications.
</p>
<h3 id="serversideprepare" class="varname">Server side prepare</h3>
<p>
Applicable for 7.3+ servers and recommended for 7.4+.
</p>
<h4 id="serversideprepare7_4">Server Side Prepare - PostgreSQL Versions
7.4 and newer</h4>
<p>
For PostgreSQL versions 7.4+ and newer, this options tells the driver
how to gather the information about result columns. See also
<a href="config.html#parsestatement" class="varname">Parse Statement</a>
and
<a href="config.html#disallowpremature" class="varname">Disallow Premature</a>
options.
</p>
<p>
By using extended query protocol the driver replies to the inquiry
correctly and effectively.
</p>
<p>
By using extended query protocol the driver replies to the inquiry
for the information of parameters.
</p>
<h4 id="serversideprepare7_3">Server Side Prepare - PostgreSQL Versions
7.3 and newer</h4>
<p>
When using prepared statements, prepare them on the server rather
than in the driver. This can give a slight performance advantage
as the server doesn't need to re-parse the statement each time
it is used.
</p>
<h3 id="usegssapiforgssrequest" class="varname">Use GSSAPI for GSS request</h3>
<p>
<span class="command">GSSAPI</span> use to <span class="command">
AUTH_REQ_GSS</span> request from a server.<em>(only Windows)</em>
</p>
<h3 id="int8as" class="varname">Int8 As</h3>
<p>
Define what datatype to report int8 columns as.
</p>
<h3 id="extraopts" class="varname">Extra Opts</h3>
<p>
combination of the following bits:
</p>
<dl>
<dt class="literal">0x1</dt>
<dd>
Force the output of short-length formatted connection string.
Check this bit when you use MFC CDatabase class.
</dd>
<dt class="literal">0x2</dt>
<dd>
Fake MS SQL Server so that MS Access recognizes PostgreSQL's
serial type as AutoNumber type.
</dd>
<dt class="literal">0x4</dt>
<dd>
Reply ANSI (not Unicode) char types for the inquiries from
applications. Try to check this bit when your applications
don't seem to be good at handling Unicode data.
</dd>
</dl>
<h3 id="protocol" class="varname">Protocol</h3>
<p>
Note that when using SSL connections this setting is ignored.
</p>
<ul>
<li><span class="literal">6.2</span> - Forces driver to use
PostgreSQL 6.2(V0) protocol, which had different byte
ordering, protocol, and other semantics.
</li>
<li><span class="literal">6.3</span> - Use the 6.3(V1) protocol.
This is compatible with both V1(6.3) and V2(6.4 to 7.3)
backends.
</li>
<li><span class="literal">6.4+</span> - Use the 6.4(V2) protocol.
This is only compatible with 6.4 and higher backends.
</li>
<li><span class="literal">7.4+</span> - Use the 7.4(V3) protocol.
This is only compatible with 7.4 and higher backends.
</li>
</ul>
<h3 id="levelofrollback" class="varname">Level of rollback on errors</h3>
<p>
Specifies what to rollback should an error occur.
</p>
<ul>
<li><span class="literal">Nop(0)</span> - Don't rollback anything
and let the application handle the error.
</li>
<li><span class="literal">Transaction(1)</span> - Rollback the
entire transaction.
</li>
<li><span class="literal">Statement(2):</span> - Rollback the
statement.
</li>
</ul>
<p>
Notes in a setup: This specification is set up with a
<span class="varname">PROTOCOL</span> option parameter.
</p>
<p>
<span class="varname">PROTOCOL</span> =
[ <span class="literal">6.2</span> | <span class="literal">6.3</span>
| <span class="literal">6.4</span> | <span class="literal">7.4</span>
] [ <span class="literal">-</span> ( <span class="literal">0</span>
| <span class="literal">1</span> | <span class="literal">2</span> ) ]
</p>
<p>
Default value is a sentence unit (it is a transaction unit before 8.0).
</p>
<h3 id="oidoptions" class="varname">OID Options</h3>
<ul>
<li><span class="literal">Show Column</span> - Includes the
OID in SQLColumns. This is good for using as a unique identifier
to update records if no good key exists <em>or</em> if the key
has many parts, which blows up the backend.
</li>
<li><span class="literal">Fake Index</span> - This option
fakes a unique index on OID. This is useful when there is
not a real unique index on OID and for apps which can't
ask what the unique identifier should be (i.e, Access 2.0).
</li>
</ul>
<h3 id="connectsettings" class="varname">Connect Settings</h3>
<p>
The driver sends these commands to the backend upon a successful
connection. It sends these settings <em>AFTER</em> it sends the
driver the <span class="varname">Connect Settings</span>.
</p>
<p>
Use a semi-colon (;) to separate commands. This can now handle any
query, even if it returns results. <em>The results will be thrown away
however!</em>
</p>
<h2 id="globaldialog">Global settings Dialog Box</h2>
<p>
This dialog allows you to specify pre-connection/default logging
options
</p>
<h3 id="globalcomlog">CommLog (C:\psqlodbc_xxxx.log -
Communications log)</h3>
<p>
Log communications to/from the backend to that file. This is good
for debugging problems.
</p>
<h3 id="globalmylog">MyLog (C:\mylog_xxxx.log -
Detailed debug output)</h3>
<p>
Log debug messages to that file. This is good for debugging problems
with the driver.
</p>
<h3 id="globalmsdtclog">MSDTCLog (C:\pgdtclog\mylog_xxxx.log -
MSDTC debug output)</h3>
<p>
Log debug messages to that file. This is good for debugging problems
with the MSDTC.
</p>
<h3 id="globallogfolder">Specification of the holder for log outputs</h3>
<p>
Adjustment of write permission.
</p>
<h2 id="managedsndialog">Manage DSN Dialog Box</h2>
<p>
This dialog allows you to select which PostgreSQL ODBC driver
to use for this connection. Note that this may not work with third
party drivers.
</p>
<h2 id="specifyconnection">How to specify as a connection option</h2>
<p>
There is a method of specifying a connection option in a keyword
strings.
</p>
<figure>
<pre class="programlisting">myConn = "ODBC;DRIVER={PostgreSQL};" & serverConn & _
"A0=0;A1=6.4;A2=0;A3=0;A4=0;A5=0;A6=;A7=100;A8=4096;A9=0;" & _
"B0=254;B1=8190;B2=0;B3=0;B4=1;B5=1;B6=0;B7=1;B8=0;B9=1;" & _
"C0=0;C1=0;C2=dd_"</pre>
<figcaption>
Example: Sample connection string construction in VBA.
</figcaption>
</figure>
<p>
Please refer to a <a href="config-opt.html">keyword list</a> for details.
</p>
</body>
</html>
style.css (text/css, 2.1K) download
/* PostgreSQL.org Documentation Style */
body {
font-size: medium;
margin-left: 16.5%;
width: 66%;
}
h1, h2, h3 {
font-weight: bold;
margin-top: 2em;
margin-bottom: 0;
}
h1 {
font-size: 2.5em;
}
h2 {
font-size: 1.6em;
border-bottom-style:solid;
border-bottom: 1px thick black;
}
h3 {
font-size: 1.2em;
}
/* Text Styles */
p, ol, ul, li, {
line-height: 1.5em;
margin: 0 0 0 0;
}
.screen,
.programlisting,
.note,
.TIP {
-moz-box-shadow: 3px 3px 5px #DFDFDF;
-webkit-box-shadow: 3px 3px 5px #DFDFDF;
-khtml-box-shadow: 3px 3px 5px #DFDFDF;
-o-box-shadow: 3px 3px 5px #DFDFDF;
box-shadow: 3px 3px 5px #DFDFDF;
}
aside,
.screen,
.synopsis,
.programlisting {
border-width: 1px;
border-style: solid;
padding: 2ex;
margin: 2ex 0 2ex 2ex;
overflow: auto;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
border-color : silver;
background-color: #F7F7F7;
}
aside {
background-color: rgb(238, 238, 221);
}
dl {
border: 3px double #ccc;
padding: 1.5em;
}
dt {
float: left;
clear: left;
width: 100px;
text-align: right;
font-weight: bold;
}
dt:after {
content: ":";
}
dd {
margin: 0 0 0 110px;
padding: 0 0 0.9em 0;
}
figcaption {
font-size: 0.7em;
font-transform: uppercase;
font-family: sans-serif;
font-style: bold;
}
.command {
text-transform: uppercase;
font-family: "Courier New", Courier, monospace;
letter-spacing: 2px;
}
.varname {
text-transform: capitalize;
font-family: "Courier New", Courier, monospace;
}
.filename, .programlisting {
font-family: "Courier New", Courier, monospace;
font-size: 0.9em;
}
.literal {
font-family: "Courier New", Courier, monospace;
font-size: 0.9em;
text-transform: lowercase;
font-style:italic;
}
.type {
text-transform: uppercase;
font-family: "Courier New", Courier, monospace;
font-size: 0.8em;
font-weight: lighter;
letter-spacing: 1px;
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Fwd: pgsql - ODBC Config.html document
2013-10-03 04:45 Fwd: pgsql - ODBC Config.html document Richard Broersma <richard.broersma@gmail.com>
@ 2013-10-03 07:13 ` Heikki Linnakangas <hlinnakangas@vmware.com>
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Linnakangas @ 2013-10-03 07:13 UTC (permalink / raw)
To: Richard Broersma <richard.broersma@gmail.com>; +Cc: pgsql-odbc
On 03.10.2013 07:45, Richard Broersma wrote:
> I noticed that some of the ODBC documentation was in pretty poor shape from
> an HTML structure perspective.
>
> Since I'm teaching myself HTML and CSS, I thought I'd use what I learned to
> freshen the config.html document.
>
> While I'm still very much a beginner at HTML, I think you'll agree that
> I've improved its structure a bit.
>
> The commiters are welcome to incorporate these files to the repository, if
> they'd would like.
Thanks Richard! Looks good - that page definitely needs a make-over.
I've been thinking for some time that that page should be rewritten
using something like Jekyll, which is what the JDBC people just adopted.
That would make it easier to maintain the docs using a plain text
editor, and generate a HTML version that would match the style of the
web site.
The content of that page could do with a rewrite, too. It explains in
great detail some options that are completely obsolete by now (kqso),
while other options are missing altogether. But that's a different story...
- Heikki
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-10-03 07:13 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-10-03 04:45 Fwd: pgsql - ODBC Config.html document Richard Broersma <richard.broersma@gmail.com>
2013-10-03 07:13 ` Heikki Linnakangas <hlinnakangas@vmware.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox