Skip to content

Updated pdo_odbc, odbc_connect and odbc_pconnect #4215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions language-snippets.ent
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,33 @@ and <literal xmlns="http://docbook.org/ns/docbook">_</literal> to match a single
</entry>
</row>'>

<!ENTITY odbc.changelog.credential-params '<row xmlns="http://docbook.org/ns/docbook">
<entry>8.4.0</entry>
<entry>
<parameter>user</parameter> and <parameter>password</parameter> are now nullable,
they are now also optional and default to &null;.
</entry>
</row>
<row xmlns="http://docbook.org/ns/docbook">
<entry>8.4.0</entry>
<entry>
Previously, using an empty string for <parameter>password</parameter> would not include
<literal>pwd</literal> in the generated connection string for <parameter>dsn</parameter>.
It is now generated to include a <literal>pwd</literal> which has an empty string as its value.
To restore the previous behaviour <parameter>password</parameter> can now be set to &null;.
</entry>
</row>
<row xmlns="http://docbook.org/ns/docbook">
<entry>8.4.0</entry>
<entry>
Previously, if <parameter>dsn</parameter> contained <literal>uid</literal> or <literal>pwd</literal>
both <parameter>user</parameter> and <parameter>password</parameter> parameters were ignored.
Now <parameter>user</parameter> is only ignored if <parameter>dsn</parameter> contains
<literal>uid</literal>, and <parameter>password</parameter> is only ignored if
<parameter>dsn</parameter> contains <literal>pwd</literal>.
</entry>
</row>'>

<!ENTITY odbc.changelog.result-param '<row xmlns="http://docbook.org/ns/docbook">
<entry>8.4.0</entry>
<entry>
Expand Down
35 changes: 35 additions & 0 deletions reference/pdo_odbc/reference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,41 @@
</variablelist>
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
When passing an empty <type>string</type> to the password argument in the PDO constructor, <literal>pwd</literal>
was not included in the connection string created until now, but the behavior has been changed to include
it as an empty string. Passing &null; for the password argument in the PDO constructor results in the same
behavior as before.
</entry>
</row>
<row>
<entry>8.4.0</entry>
<entry>
Changed the behavior to ignore the user name argument and the password argument in the PDO constructor
separately when the DSN contains <literal>uid</literal> or <literal>pwd</literal>.
Previously, if included only either <literal>uid</literal> or <literal>pwd</literal> in the DSN,
both the user name argument and the password argument in the PDO constructor were ignored.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
11 changes: 9 additions & 2 deletions reference/uodbc/functions/odbc-connect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<methodsynopsis>
<type class="union"><type>Odbc\Connection</type><type>false</type></type><methodname>odbc_connect</methodname>
<methodparam><type>string</type><parameter>dsn</parameter></methodparam>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>user</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>password</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cursor_option</parameter><initializer><constant>SQL_CUR_USE_DRIVER</constant></initializer></methodparam>
</methodsynopsis>
<simpara>
Expand Down Expand Up @@ -49,6 +49,9 @@
<listitem>
<para>
The username.
This parameter is ignored if <parameter>dsn</parameter> contains <literal>uid</literal>.
To connect without specifying a <parameter>user</parameter>,
use &null;.
</para>
</listitem>
</varlistentry>
Expand All @@ -57,6 +60,9 @@
<listitem>
<para>
The password.
This parameter is ignored if <parameter>dsn</parameter> contains <literal>pwd</literal>.
To connect without specifying a <parameter>password</parameter>,
use &null;.
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -115,6 +121,7 @@
</thead>
<tbody>
&odbc.changelog.connection-return;
&odbc.changelog.credential-params;
</tbody>
</tgroup>
</informaltable>
Expand Down
5 changes: 3 additions & 2 deletions reference/uodbc/functions/odbc-pconnect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<methodsynopsis>
<type class="union"><type>Odbc\Connection</type><type>false</type></type><methodname>odbc_pconnect</methodname>
<methodparam><type>string</type><parameter>dsn</parameter></methodparam>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>user</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>password</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>cursor_option</parameter><initializer><constant>SQL_CUR_USE_DRIVER</constant></initializer></methodparam>
</methodsynopsis>
<para>
Expand Down Expand Up @@ -56,6 +56,7 @@
</thead>
<tbody>
&odbc.changelog.connection-return;
&odbc.changelog.credential-params;
</tbody>
</tgroup>
</informaltable>
Expand Down
Loading