ibm_db2-1.9.7 release

This commit is contained in:
Rahul Priyadarshi
2015-05-24 22:47:55 +05:30
parent 1410bd9890
commit 38b3f05d35
107 changed files with 3054 additions and 1784 deletions

55
LICENSE Normal file
View File

@@ -0,0 +1,55 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

1402
ibm_db2.c

File diff suppressed because it is too large Load Diff

View File

@@ -22,11 +22,11 @@ Cloudscape, and Apache Derby databases.
<email>opendev@us.ibm.com</email>
<active>yes</active>
</lead>
<date>2014-07-23</date>
<time>14:02:00</time>
<date>2015-05-24</date>
<time>22:24:00</time>
<version>
<release>1.9.6</release>
<api>1.9.6</api>
<release>1.9.7</release>
<api>1.9.7</api>
</version>
<stability>
<release>stable</release>
@@ -34,10 +34,9 @@ Cloudscape, and Apache Derby databases.
</stability>
<license>Apache License 2.0</license>
<notes>
Fixed: Fetching of mixed character data when the application code page different from database code page
Fixed: db2-bind-param with INOUT LOB parameters
Enhanced: Enable iSeries system naming mode from LUW to iSeries
Enhanced: Clear global error state at end of request
Enhanced: Code refactoring to enhance maintainability of code
Removed: IBM i V5R4 is no longer supported
Removed: unsupported test cases of V5 removed
</notes>
<contents>
<dir name="/">
@@ -57,6 +56,9 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="skipifNotRowcountPrefetch.inc" role="test" />
<file baseinstalldir="ibm_db2" name="skipifNotTrustedContext.inc" role="test" />
<file baseinstalldir="ibm_db2" name="spook.png" role="test" />
<file baseinstalldir="ibm_db2" name="xmlservice.inc" role="test" />
<file baseinstalldir="ibm_db2" name="skipifNot10_5.inc" role="test" />
<file baseinstalldir="ibm_db2" name="skipifTBD.inc" role="test" />
<file baseinstalldir="ibm_db2" name="test_001_ConnDb.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_002_ConnDbUncatalogedConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_03a_ResultNonExistCol.phpt" role="test" />
@@ -79,7 +81,6 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_021_CommitDelete.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_022_RollbackInsert.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_023_ColumnPrivileges.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_023_V5V6_ColumnPrivileges.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_024_ForeignKeys.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_025_PrimaryKeys.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_026_BindParam.phpt" role="test" />
@@ -93,10 +94,8 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_037_FetchRowIndexPos.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_038_FetchRowIndexPosNested_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_039_FetchRowIndexPosNested_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_039_V5V6_FetchRowIndexPosNested_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_040_FetchArray.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_041_FetchArrayMany_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_041_V5V6_FetchArrayMany_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_042_FetchArrayMany_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_043_FetchArrayMany_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_044_FetchArrayMany_04.phpt" role="test" />
@@ -110,35 +109,20 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_052_SetAutocommit_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_053_SetAutocommit_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_060_Tables_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_060_V5V6_Tables_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_061_Tables_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_061_V5_Tables_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_061_V6_Tables_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_062_Tables_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_062_V5_Tables_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_062_V6_Tables_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_063_Tables_04.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_064_Tables_05.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_064_V5_Tables_05.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_064_V6_Tables_05.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_065_FilterTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_065_V5_FilterTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_065_V6_FilterTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_066_TableObjects.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_066_V5_TableObjects.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_066_V6_TableObjects.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_070_Close.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_071_CloseSuccess.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_080_ConnWrongDbAlias.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_080_V5V6_ConnWrongDbAlias.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_081_ConnWrongUser.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_082_ConnWrongPwd.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_090_ConnmsgWrongDbAlias.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_090_V5V6_ConnmsgWrongDbAlias.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_091_ConnmsgWrongUser.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_091_V5V6_ConnmsgWrongUser.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_092_ConnmsgWrongPwd.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_092_V5V6_ConnmsgWrongPwd.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_100_SelectDeleteInsertFieldCount.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_101_InsertDeleteFieldCount.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_102_NumFieldsSelect_01.phpt" role="test" />
@@ -154,11 +138,9 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_125_FieldNamePos_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_130_PrepExecuteSelectStmt.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_131a_PrepExecuteDataTypeConversionsErrs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_131a_V5V6_PrepExecuteDataTypeConversionsErrs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_131_PrepareExecuteSelectStatementParams.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_132_ExecuteStatementArrayMultipleParams.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_133_ExecuteLongInputParams.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_133_V5V6_ExecuteLongInputParams.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_140_BindParamSelectStmt.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_141_BindParamSelectStmtMultipleParams_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_142_BindParamSelectStmtMultipleParams_02.phpt" role="test" />
@@ -168,9 +150,7 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_146_CallSPINAndOUTParams.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_147_CallSPINAndOUTParamsMultipleTimes.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_148_CallSPDiffBindPattern_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_148_V5V6_CallSPDiffBindPattern_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_149_CallSPDiffBindPattern_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_149_V5V6_CallSPDiffBindPattern_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_150_FetchAssocSelect_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_151_FetchAssocSelect_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_152_FetchAssocSelect_03.phpt" role="test" />
@@ -185,61 +165,41 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_159a_FetchAssocSeveralRows_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_159_FetchAssocSeveralRows_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_160_FetchBoth.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_160_V5V6_FetchBoth.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_161_FetchBothNestedSelects_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_161_V5V6_FetchBothNestedSelects_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_162_FetchBothNestedSelects_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_162_V5V6_FetchBothNestedSelects_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_163_FetchBothBinary.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_180_StmtErrMsg.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_180_V5V6_StmtErrMsg.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_190_ColumnsTable_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_191_ColumnsTable_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_191_V5_ColumnsTable_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_191_V6_ColumnsTable_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_192_ColumnsTable_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_192_V5V6_ColumnsTable_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_193_RetrieveCLOBColFwdOnly.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_194_RetrieveCLOBColScrollable.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_194_V5V6_RetrieveCLOBColScrollable.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_195_InsertRetrieveXMLData_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_196_InsertRetrieveXMLData_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_197_StatisticsIndexes.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_198_LobReadWriteFromMemory.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_198_V5V6_LobReadWriteFromMemory.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_200_MultipleRsltsetsUniformColDefs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_201_MultipleRsltsetsDiffColDefs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_201_V5V6_MultipleRsltsetsDiffColDefs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_210_FieldDisplaySize_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_210_V6_FieldDisplaySize_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_211_FieldDisplaySize_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_211_V6_FieldDisplaySize_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_212_FieldDisplaySize_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_212_V6_FieldDisplaySize_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_213_FieldDisplaySize_04.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_213_V6_FieldDisplaySize_04.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_220_PersistentConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_221_100PersistentConns.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_230_FieldTypePos.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_231_FieldTypeName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_232_FieldTypePosName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_240_FieldWidthPosName_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_240_V5_FieldWidthPosName_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_240_V6_FieldWidthPosName_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_241_FieldWidthPosName_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_241_V5_FieldWidthPosName_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_250_FreeResult_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_251_FreeResult_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_252_FreeResult_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_260_FetchObject.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_260_V5V6_FetchObject.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_261_FetchObjectAccess.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_263_XML_OUTParamsInSPs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_264_InsertRetrieveBIGINTTypeColumn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_300_ServerInfo.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_300_V5V6_ServerInfo.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_310_ClientInfo.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_310_V5V6_ClientInfo.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_320_EscapeString.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_321_ResultFetchArraysLobsXMLTypes.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_1551_FetchAssocBinary.phpt" role="test" />
@@ -247,16 +207,11 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_6561_ReturnNULLValues.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_6572_SQLStringsContNULLChar.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_6755_ExtraNULLChar_ResultCLOBCol.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_6792_FieldTypeRetStrDatetimeTimestamp.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_6792_V5V6_FieldTypeRetStrDatetimeTimestamp.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_9173_ProcedurePersistentConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_9173_V5_ProcedurePersistentConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_9173_V6_ProcedurePersistentConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_9194_FetchBothCLOBColumns.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_10353_MemLeak.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_10931_LcaseTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_10931_V5_LcaseTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_10931_V6_LcaseTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_clob_special_char.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_decfloat.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_graphic_data_type.phpt" role="test" />
@@ -274,6 +229,75 @@ Cloudscape, and Apache Derby databases.
<file baseinstalldir="ibm_db2" name="test_connect_deallocator.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_execute_many.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_bigint.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_002_ConnDbUncatalogedConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_023_ColumnPrivileges.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_039_FetchRowIndexPosNested_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_041_FetchArrayMany_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_053_SetAutocommit_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_060_Tables_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_061_Tables_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_062_Tables_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_064_Tables_05.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_065_FilterTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_066_TableObjects.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_080_ConnWrongDbAlias.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_090_ConnmsgWrongDbAlias.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_091_ConnmsgWrongUser.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_092_ConnmsgWrongPwd.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_102_NumFieldsSelect_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_10353.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_10353_MemLeak.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_10931_LcaseTableName.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_131a_PrepExecuteDataTypeConversionsErrs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_133_ExecuteLongInputParams.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_148_CallSPDiffBindPattern_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_149_CallSPDiffBindPattern_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_160_FetchBoth.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_161_FetchBothNestedSelects_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_162_FetchBothNestedSelects_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_180_StmtErrMsg.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_191_ColumnsTable_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_192_ColumnsTable_03.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_194_RetrieveCLOBColScrollable.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_195_InsertRetrieveXMLData_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_196_InsertRetrieveXMLData_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_197_StatisticsIndexes.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_197_StatisticsIndexes_with_lib_1028_issue.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_198_LobReadWriteFromMemory.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_201_MultipleRsltsetsDiffColDefs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_240_FieldWidthPosName_01.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_241_FieldWidthPosName_02.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_260_FetchObject.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_263_XML_OUTParamsInSPs.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_300_ServerInfo.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_310_ClientInfo.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_320_EscapeString.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_321_ResultFetchArraysLobsXMLTypes.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_6792_FieldTypeRetStrDatetimeTimestamp.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_9173_ProcedurePersistentConn.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_bigint.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_clob_special_char.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_connect_deallocator.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_execute_many.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_graphic_data_type.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_hebrew.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_all_pconnect.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_allow_commit.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_blank_userid.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_check_pconnect.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_guard_profile.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_ignore_userid.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_max_pconnect.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_servermode_subsystem.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_ini_i5_sys_naming.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_last_insert_id.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_timestamp.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_trusted_context_connect.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_V6_trusted_context_pconnect.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_x001_IBMi_LUW_DB2_I5_NAMING_ON.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="test_x002_IBMi_LUW_DB2_I5_TXN_NO_COMMIT.phpt" role="test" />
<file baseinstalldir="ibm_db2" name="tests\test_x010_IBMi_LUW_DB2_I5_FMT.phpt" role="test" />
</dir> <!-- //tests -->
<file baseinstalldir="ibm_db2" name="config.m4" role="src" />
<file baseinstalldir="ibm_db2" name="config.w32" role="src" />

View File

@@ -23,7 +23,7 @@
$Id$
*/
#define PHP_IBM_DB2_VERSION "1.9.6"
#define PHP_IBM_DB2_VERSION "1.9.7"
#ifndef PHP_IBM_DB2_H
#define PHP_IBM_DB2_H
@@ -118,12 +118,58 @@ extern zend_module_entry ibm_db2_module_entry;
#define APPLNAME_LEN 32
#define WRKSTNNAME_LEN 18
/* 1.9.7 - LUW DB2 Connect 10.5 missing SQL_UTF8_CHAR, set to fake/unused ordinal */
#ifndef SQL_UTF8_CHAR
#define SQL_UTF8_CHAR -334
#endif
#ifdef PASE
/* IBM i generically changed (remove ifdef PASE) */
#define SQL_IS_INTEGER 0
#define SQL_IS_UINTEGER 0
#define SQL_BEST_ROWID 0
#define SQLLEN long
#define SQLFLOAT double
#define SQLUINTEGER SQLINTEGER
#define SQLUSMALLINT SQLSMALLINT
/* IBM i long is same ordinal, set to fake/unused ordinal (remove ifdef PASE) */
#undef SQL_LONGVARCHAR
#define SQL_LONGVARCHAR -334
#undef SQL_LONGVARGRAPHIC
#define SQL_LONGVARGRAPHIC -335
#undef SQL_LONGVARBINARY
#define SQL_LONGVARBINARY -336
#undef SQL_WLONGVARCHAR
#define SQL_WLONGVARCHAR -337
/* IBM i support V6R1+, ignore V5R4- (remove ifdef PASE) */
#undef SQL_BINARY
#define SQL_BINARY -2
#undef SQL_VARBINARY
#define SQL_VARBINARY -3
#undef SQL_C_BINARY
#define SQL_C_BINARY SQL_BINARY
/* IBM i mv from ibm_db2.c to php_ibm_db2.h (correct) */
#define SQL_ATTR_INFO_USERID 10103
#define SQL_ATTR_INFO_WRKSTNNAME 10104
#define SQL_ATTR_INFO_APPLNAME 10105
#define SQL_ATTR_INFO_ACCTSTR 10106
#define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT
/* orig - IBM i SQL_ATTR_JOB_SORT_SEQUENCE (customer request DB2 PTF) */
#define SQL_ATTR_CONN_SORT_SEQUENCE 10046
#define SQL_HEX_SORT_SEQUENCE 0
#define SQL_JOB_SORT_SEQUENCE 1
#define SQL_JOBRUN_SORT_SEQUENCE 2
/* 1.9.7 - IBM i consultant request switch subsystem QSQSRVR job (customer workload issues) */
#ifndef SQL_ATTR_SERVERMODE_SUBSYSTEM
#define SQL_ATTR_SERVERMODE_SUBSYSTEM 10204
#endif
/* 1.9.7 - IBM i monitor switch user profile applications (customer security issue) */
#define DB2_IBM_I_PROFILE_UID_MAX 10
/* 1.9.7 - IBM i force UTF-8 CCSID (DBCS customer issue) */
extern int SQLOverrideCCSID400(int newCCSID);
#endif /* PASE */
#ifndef PASE
#define DB2_SCROLLABLE SQL_CURSOR_KEYSET_DRIVEN
@@ -131,43 +177,94 @@ extern zend_module_entry ibm_db2_module_entry;
#else
#define DB2_SCROLLABLE SQL_CURSOR_DYNAMIC
#define DB2_FORWARD_ONLY SQL_CURSOR_FORWARD_ONLY
#define SQL_SCROLL_FORWARD_ONLY SQL_CURSOR_FORWARD_ONLY
#endif
/*** new set options */
/* 1.9.7 - IBM i + LUW 10.5 system naming on (*libl)/file.mbr */
#define DB2_I5_NAMING_ON SQL_TRUE
#define DB2_I5_NAMING_OFF SQL_FALSE
/* 1.9.7 - IBM i + LUW 10.5 new IBM i attributes */
#ifndef SQL_ATTR_DECIMAL_SEP
#define SQL_ATTR_DATE_FMT 3025
#define SQL_ATTR_DATE_SEP 3026
#define SQL_ATTR_TIME_FMT 3027
#define SQL_ATTR_TIME_SEP 3028
#define SQL_ATTR_DECIMAL_SEP 3029
#endif
/* 1.9.7 - LUW to IBM i need isolation mode *NONE (required non journal CRTLIB) */
#ifndef SQL_TXN_NO_COMMIT
#define SQL_TXN_NO_COMMIT SQL_TXN_NOCOMMIT
#endif
#define DB2_I5_TXN_NO_COMMIT SQL_TXN_NO_COMMIT
#define DB2_I5_TXN_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED
#define DB2_I5_TXN_READ_COMMITTED SQL_TXN_READ_COMMITTED
#define DB2_I5_TXN_REPEATABLE_READ SQL_TXN_REPEATABLE_READ
#define DB2_I5_TXN_SERIALIZABLE SQL_TXN_SERIALIZABLE
/* 1.9.7 - PASE change to LUW IBMi style (reserve non-IBMi other for LUW) */
#ifdef PASE
#define SQL_IBMi_FMT_ISO SQL_FMT_ISO
#define SQL_IBMi_FMT_USA SQL_FMT_USA
#define SQL_IBMi_FMT_EUR SQL_FMT_EUR
#define SQL_IBMi_FMT_JIS SQL_FMT_JIS
#define SQL_IBMi_FMT_MDY SQL_FMT_MDY
#define SQL_IBMi_FMT_DMY SQL_FMT_DMY
#define SQL_IBMi_FMT_YMD SQL_FMT_YMD
#define SQL_IBMi_FMT_JUL SQL_FMT_JUL
#define SQL_IBMi_FMT_HMS SQL_FMT_HMS
#define SQL_IBMi_FMT_JOB SQL_FMT_JOB
#endif /* PASE */
/* 1.9.7 - LUW to IBM i needed for backward compatibility (not defined prior to DB2 10.5) */
#ifndef SQL_IBMi_FMT_ISO
#define SQL_IBMi_FMT_ISO 1
#define SQL_IBMi_FMT_USA 2
#define SQL_IBMi_FMT_EUR 3
#define SQL_IBMi_FMT_JIS 4
#define SQL_IBMi_FMT_MDY 5
#define SQL_IBMi_FMT_DMY 6
#define SQL_IBMi_FMT_YMD 7
#define SQL_IBMi_FMT_JUL 8
#define SQL_IBMi_FMT_HMS 9
#define SQL_IBMi_FMT_JOB 10
#define SQL_SEP_SLASH 1
#define SQL_SEP_DASH 2
#define SQL_SEP_PERIOD 3
#define SQL_SEP_COMMA 4
#define SQL_SEP_BLANK 5
#define SQL_SEP_COLON 6
#define SQL_SEP_JOB 7
#endif
/* 1.9.7 - LUW to IBM i new option attributes using IBMi_ (not defined prior to DB2 10.5) */
#define DB2_I5_FMT_ISO SQL_IBMi_FMT_ISO
#define DB2_I5_FMT_USA SQL_IBMi_FMT_USA
#define DB2_I5_FMT_EUR SQL_IBMi_FMT_EUR
#define DB2_I5_FMT_JIS SQL_IBMi_FMT_JIS
#define DB2_I5_FMT_MDY SQL_IBMi_FMT_MDY
#define DB2_I5_FMT_DMY SQL_IBMi_FMT_DMY
#define DB2_I5_FMT_YMD SQL_IBMi_FMT_YMD
#define DB2_I5_FMT_JUL SQL_IBMi_FMT_JUL
#define DB2_I5_FMT_JOB SQL_IBMi_FMT_JOB
#define DB2_I5_FMT_HMS SQL_IBMi_FMT_HMS
/* 1.9.7 - LUW to IBM i new option attributes match (not defined prior to DB2 10.5) */
#define DB2_I5_SEP_SLASH SQL_SEP_SLASH
#define DB2_I5_SEP_DASH SQL_SEP_DASH
#define DB2_I5_SEP_PERIOD SQL_SEP_PERIOD
#define DB2_I5_SEP_COMMA SQL_SEP_COMMA
#define DB2_I5_SEP_BLANK SQL_SEP_BLANK
#define DB2_I5_SEP_COLON SQL_SEP_COLON
#define DB2_I5_SEP_JOB SQL_SEP_JOB
#ifdef PASE
#define SQL_BINARY_V6 -2
#define SQL_VARBINARY_V6 -3
#define SQL_C_BINARY_V6 SQL_BINARY_V6
#define DB2_I5_FETCH_ON SQL_TRUE
#define DB2_I5_FETCH_OFF SQL_FALSE
#define DB2_I5_JOB_SORT_ON SQL_TRUE
#define DB2_I5_JOB_SORT_OFF SQL_FALSE
#define DB2_I5_DBCS_ALLOC_ON SQL_TRUE
#define DB2_I5_DBCS_ALLOC_OFF SQL_FALSE
#define DB2_I5_TXN_NO_COMMIT SQL_TXN_NO_COMMIT
#define DB2_I5_TXN_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED
#define DB2_I5_TXN_READ_COMMITTED SQL_TXN_READ_COMMITTED
#define DB2_I5_TXN_REPEATABLE_READ SQL_TXN_REPEATABLE_READ
#define DB2_I5_TXN_SERIALIZABLE SQL_TXN_SERIALIZABLE
#define DB2_I5_FMT_ISO SQL_FMT_ISO
#define DB2_I5_FMT_USA SQL_FMT_USA
#define DB2_I5_FMT_EUR SQL_FMT_EUR
#define DB2_I5_FMT_JIS SQL_FMT_JIS
#define DB2_I5_FMT_DMY SQL_FMT_DMY
#define DB2_I5_FMT_MDY SQL_FMT_MDY
#define DB2_I5_FMT_YMD SQL_FMT_YMD
#define DB2_I5_FMT_JUL SQL_FMT_JUL
#define DB2_I5_FMT_JOB SQL_FMT_JOB
#define DB2_I5_FMT_HMS SQL_FMT_HMS
#define DB2_I5_SEP_SLASH SQL_SEP_SLASH
#define DB2_I5_SEP_DASH SQL_SEP_DASH
#define DB2_I5_SEP_PERIOD SQL_SEP_PERIOD
#define DB2_I5_SEP_COMMA SQL_SEP_COMMA
#define DB2_I5_SEP_BLANK SQL_SEP_BLANK
#define DB2_I5_SEP_JOB SQL_SEP_JOB
#define DB2_I5_SEP_COLON SQL_SEP_COLON
#define DB2_FIRST_IO SQL_FIRST_IO
#define DB2_ALL_IO SQL_ALL_IO
#endif
@@ -235,7 +332,9 @@ PHP_FUNCTION(db2_commit);
PHP_FUNCTION(db2_exec);
PHP_FUNCTION(db2_prepare);
PHP_FUNCTION(db2_execute);
#ifndef PASE /* i5/OS unsupported */
PHP_FUNCTION(db2_execute_many);
#endif /* PASE */
PHP_FUNCTION(db2_conn_errormsg);
PHP_FUNCTION(db2_stmt_errormsg);
PHP_FUNCTION(db2_conn_error);
@@ -281,12 +380,20 @@ ZEND_BEGIN_MODULE_GLOBALS(ibm_db2)
char __php_conn_err_state[SQL_SQLSTATE_SIZE + 1];
char __php_stmt_err_msg[DB2_MAX_ERR_MSG_LEN];
char __php_stmt_err_state[SQL_SQLSTATE_SIZE + 1];
#ifdef PASE /* i5/OS ease of use turn off/on */
long i5_allow_commit;
long i5_dbcs_alloc;
long i5_all_pconnect;
long i5_ignore_userid;
long i5_job_sort; /* SQL_ATTR_JOB_SORT_SEQUENCE (new PTF) */
long i5_allow_commit; /* orig - IBM i legacy CRTLIB containers fail under commit control (isolation *NONE) */
long i5_sys_naming; /* 1.9.7 - IBM i + LUW DB2 Connect 10.5 system naming (customer *LIBL issues) */
#ifdef PASE /* IBM i ibm_db2.ini options */
long i5_dbcs_alloc; /* orig - IBM i 6x space for CCSID<>UTF-8 convert (DBCS customer issue) */
long i5_all_pconnect; /* orig - IBM i force all connect to pconnect (operator issue) */
long i5_ignore_userid; /* orig - IBM i ignore user id enables no-QSQSRVR job (custom site request) */
long i5_job_sort; /* orig - IBM i SQL_ATTR_JOB_SORT_SEQUENCE (customer request DB2 PTF) */
long i5_override_ccsid; /* 1.9.7 - IBM i force UTF-8 CCSID (DBCS customer issue) */
long i5_blank_userid; /* 1.9.7 - IBM i security restrict blank db,uid,pwd (unless customer allow flag) */
long i5_log_verbose; /* 1.9.7 - IBM i consultant request log additional information into php.log */
long i5_max_pconnect; /* 1.9.7 - IBM i count max usage connection recycle (customer issue months live connection) */
long i5_check_pconnect; /* 1.9.7 - IBM i remote persistent connection or long lived local (customer issue dead connection) */
char *i5_servermode_subsystem; /* 1.9.7 - IBM i consultant request switch subsystem QSQSRVR job (customer workload issues) */
long i5_guard_profile; /* 1.9.7 - IBM i monitor switch user profile applications (customer security issue) */
#endif /* PASE */
ZEND_END_MODULE_GLOBALS(ibm_db2)

View File

@@ -6,42 +6,39 @@ $password = 'password';
$hostname = 'localhost';
$port = 60000;
$url = 'no url';
$switch_user = '';
$switch_password = '';
$db = $database;
$username = $user;
// test connection ok
$prepconn = db2_connect($database, $user, $password);
if (!$prepconn) die('skip');
// control skipif.inc
$server = db2_server_info($prepconn);
if ($server->DBMS_NAME == "QSQ" || $server->DBMS_NAME == "AS") {
if ($server->DBMS_VER > "06000") $rel = "V6";
else $rel = "/V5/";
// PASE test_xxx_V5V6.phpt
if (preg_match("/V6|V5/", $_SERVER["PHP_SELF"])) {
if (!preg_match($rel, $_SERVER["PHP_SELF"])) {
die('skip');
}
}
// check the skipif.PASE
else {
$result=file_get_contents("skipif.PASE");
for ($line = strtok($result, "\n"); $line; $line = strtok("\n")) {
$pos=strpos($line,"PASE");
if ($pos && strpos($line, "|$rel|")){
$check = substr($line, 1, $pos-6);
if (strpos($_SERVER["PHP_SELF"], $check)) {
die('skip');
}
// IBM i (PASE)
$myos = PHP_OS;
if (strpos($myos,'400') > 0) {
if (strpos($_SERVER["PHP_SELF"],"V6") === false) {
require_once('skipif.PASE');
for ($entry = strtok($PASE_ALT_TEST,"\n"); $entry; $entry = strtok("\n")) {
$check = str_replace(array("test_V6",".phpt",".php"),"",$entry);
if (strpos($_SERVER["PHP_SELF"],$check) > 0) {
die('skip');
}
}
}
}
// LUW (not PASE)
else {
if (preg_match("/V5|V6/", $_SERVER["PHP_SELF"])) die('skip');
if (strpos($_SERVER["PHP_SELF"],"V6") > 0) {
die('skip');
}
}
date_default_timezone_set('UTC');
// test connection ok
$prepconn = db2_connect($database, $user, $password);
if (!$prepconn) die('skip');
db2_close($prepconn);
?>

View File

@@ -1,49 +1,67 @@
test_002_ConnDbUncatalogedConn.phpt|PASE|V5|V6|test specific protocol not valid|
test_023_ColumnPrivileges.phpt|PASE|V5|V6|i5 column priv (bug?) vs LUW column priv|
test_039_FetchRowIndexPosNested_02.phpt|PASE|V5|V6|i5 .10 vs LUW 0.10|
test_041_FetchArrayMany_01.phpt|PASE|V5|V6|i5 .10 vs LUW 0.10|
test_053_SetAutocommit_02.phpt|PASE|V5|V6|i5 no support (V6R1?) vs LUW client attributes|
test_060_Tables_01.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
test_061_Tables_02.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
test_062_Tables_03.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
test_064_Tables_05.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
test_065_FilterTableName.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
test_066_TableObjects.phpt|PASE|V5|V6|i5 BASE TABLE + journal tables vs LUW TABLE|
test_080_ConnWrongDbAlias.phpt|PASE|V5|V6|i5 SQLSTATE=42705 vs LUW SQLSTATE=800xxx|
test_090_ConnmsgWrongDbAlias.phpt|PASE|V5|V6|i5 different error msg vs LUW|
test_091_ConnmsgWrongUser.phpt|PASE|V5|V6|i5 different error msg vs LUW|
test_092_ConnmsgWrongPwd.phpt|PASE|V5|V6|i5 different error msg vs LUW|
test_102_NumFieldsSelect_01.phpt|PASE|V5|V6|i5 no support vs LUW SQL VALUES(1)|
test_131a_PrepExecuteDataTypeConversionsErrs.phpt|PASE|V5|V6|i5 db2_num_rows error vs LUW -1|
test_133_ExecuteLongInputParams.phpt|PASE|V5|V6|i5 different error msg vs LUW|
test_149_CallSPDiffBindPattern_02.phpt|PASE|V5|V6|i5 varchar len 10 vs LUW data len|
test_160_FetchBoth.phpt|PASE|V5|V6|i5 .50 vs LUW 0.50|
test_161_FetchBothNestedSelects_01.phpt|PASE|V5|V6|i5 .50 vs LUW 0.50|
test_162_FetchBothNestedSelects_02.phpt|PASE|V5|V6|i5 .50 vs LUW 0.50|
test_180_StmtErrMsg.phpt|PASE|V5|V6|i5 different error msg vs LUW|
test_191_ColumnsTable_02.phpt|PASE|V5|V6|i5 IS_NULLABLE (na v5r4) and need schema (v6r1)|
test_192_ColumnsTable_03.phpt|PASE|V5|i5 IS_NULLABLE (na v5r4)|
test_194_RetrieveCLOBColScrollable.phpt|PASE|V5|V6|i5 data ok vs LUW error (LUW bug)|
test_195_InsertRetrieveXMLData_01.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
test_196_InsertRetrieveXMLData_02.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
test_198_LobReadWriteFromMemory.phpt|PASE|V5|V6|i5 blob data ASCII vs LUW blob data hex|
test_201_MultipleRsltsetsDiffColDefs.phpt|PASE|V5|V6|i5 .20 vs LUW 0.20|
test_210_FieldDisplaySize_01.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
test_211_FieldDisplaySize_02.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
test_212_FieldDisplaySize_03.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
test_213_FieldDisplaySize_04.phpt|PASE|V6|i5 display size (v5r4 match LUW) vs LUW display size|
test_240_FieldWidthPosName_01.phpt|PASE|V5|V6|i5 field widths (bug?) vs LUW field widths|
test_241_FieldWidthPosName_02.phpt|PASE|V5|V6|i5 field widths (bug?) vs LUW field widths|
test_260_FetchObject.phpt|PASE|V5|V6|stdClass)#2 vs LUW stdClass)#1 (bug?)|
test_263_XML_OUTParamsInSPs.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
test_300_ServerInfo.phpt|PASE|V5|V6|i5 server info (V6R1?) vs LUW server info|
test_310_ClientInfo.phpt|PASE|V5|V6|i5 client info (V6R1?) vs LUW client info|
test_321_ResultFetchArraysLobsXMLTypes.phpt|PASE|V5|V6|i5 no XML VIPER vs LUW XML VIPER|
test_6792_FieldTypeRetStrDatetimeTimestamp.phpt|PASE|V5|V6|i5 time seperator vs LUW time seperator|
test_9173_ProcedurePersistentConn.phpt|PASE|V5|V6|i5 store proc info vs LUW store proc info|
test_10931_LcaseTableName.phpt|PASE|V5|V6|i5 default schema is DB2 not TEST|
test_clob_special_char.phpt|PASE|V5|V6|insert:3030802e expect:3030802e actual:30301a2e |
test_trusted_context_connect.phpt|PASE|V5|V6|i5 no trust?|
test_trusted_context_pconnect.phpt|PASE|V5|V6|i5 no trust?|
test_10353.phpt|PASE|V5|V6|i5 PHP no compiled debug mode|
test_last_insert_id.phpt|PASE|V5|V6|i5 sql IDENTITY_VAL_LOCAL()|
<?php
$PASE_ALT_TEST = <<< SKIPPASE
test_V6_002_ConnDbUncatalogedConn.phpt
test_V6_023_ColumnPrivileges.phpt
test_V6_039_FetchRowIndexPosNested_02.phpt
test_V6_041_FetchArrayMany_01.phpt
test_V6_053_SetAutocommit_02.phpt
test_V6_060_Tables_01.phpt
test_V6_061_Tables_02.phpt
test_V6_062_Tables_03.phpt
test_V6_064_Tables_05.phpt
test_V6_065_FilterTableName.phpt
test_V6_066_TableObjects.phpt
test_V6_080_ConnWrongDbAlias.phpt
test_V6_090_ConnmsgWrongDbAlias.phpt
test_V6_091_ConnmsgWrongUser.phpt
test_V6_092_ConnmsgWrongPwd.phpt
test_V6_102_NumFieldsSelect_01.phpt
test_V6_10353_MemLeak.phpt
test_V6_10353.phpt
test_V6_10931_LcaseTableName.phpt
test_V6_131a_PrepExecuteDataTypeConversionsErrs.phpt
test_V6_133_ExecuteLongInputParams.phpt
test_V6_148_CallSPDiffBindPattern_01.phpt
test_V6_149_CallSPDiffBindPattern_02.phpt
test_V6_160_FetchBoth.phpt
test_V6_161_FetchBothNestedSelects_01.phpt
test_V6_162_FetchBothNestedSelects_02.phpt
test_V6_180_StmtErrMsg.phpt
test_V6_191_ColumnsTable_02.phpt
test_V6_192_ColumnsTable_03.phpt
test_V6_194_RetrieveCLOBColScrollable.phpt
test_V6_195_InsertRetrieveXMLData_01.phpt
test_V6_196_InsertRetrieveXMLData_02.phpt
test_V6_197_StatisticsIndexes.phpt
test_V6_198_LobReadWriteFromMemory.phpt
test_V6_201_MultipleRsltsetsDiffColDefs.phpt
test_V6_240_FieldWidthPosName_01.phpt
test_V6_241_FieldWidthPosName_02.phpt
test_V6_260_FetchObject.phpt
test_V6_263_XML_OUTParamsInSPs.phpt
test_V6_300_ServerInfo.phpt
test_V6_310_ClientInfo.phpt
test_V6_320_EscapeString.phpt
test_V6_321_ResultFetchArraysLobsXMLTypes.phpt
test_V6_6792_FieldTypeRetStrDatetimeTimestamp.phpt
test_V6_9173_ProcedurePersistentConn.phpt
test_V6_bigint.phpt
test_V6_clob_special_char.phpt
test_V6_connect_deallocator.phpt
test_V6_execute_many.phpt
test_V6_graphic_data_type.phpt
test_V6_ini_i5_allow_commit.phpt
test_V6_ini_i5_all_pconnect.phpt
test_V6_ini_i5_blank_userid.phpt
test_V6_ini_i5_check_pconnect.phpt
test_V6_ini_i5_guard_profile.phpt
test_V6_ini_i5_ignore_userid.phpt
test_V6_ini_i5_max_pconnect.phpt
test_V6_ini_i5_servermode_subsystem.phpt
test_V6_ini_i5_sys_naming.phpt
test_V6_last_insert_id.phpt
test_V6_timestamp.phpt
test_V6_trusted_context_connect.phpt
test_V6_trusted_context_pconnect.phpt
SKIPPASE;
?>

18
tests/skipifNot10_5.inc Normal file
View File

@@ -0,0 +1,18 @@
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
$server = db2_server_info( $conn );
if ($server->DBMS_NAME != 'AS') {
die('skip');
}
$client = db2_client_info( $conn );
$minversion = "10.05.0000";
if ( ($client->DRIVER_VER < $minversion ) ) {
die('skip');
}
?>

3
tests/skipifTBD.inc Normal file
View File

@@ -0,0 +1,3 @@
<?php
die('skip');
?>

View File

@@ -1,31 +0,0 @@
--TEST--
IBM-DB2: db2_column_privileges -- tests the db2_column_privileges functionality
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
if ($conn != 0)
{
$stmt = db2_column_privileges($conn, NULL, NULL, 'ANIMALS');
$row = db2_fetch_array($stmt);
print $row[2] . "\n";
print $row[3] . "\n";
print $row[7];
db2_close($conn);
}
else
{
echo db2_conn_errormsg();
printf("Connection failed\n\n");
}
?>
--EXPECTF--
ANIMALS
ID
YES

View File

@@ -1,58 +0,0 @@
--TEST--
IBM-DB2: db2_tables() - 2
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
$schema = 'CREATE SCHEMA t';
$result = @db2_exec($conn, $schema);
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
if ($conn)
{
$result = db2_tables($conn,NULL,strtoupper('t'));
$i = 0;
while ($row = db2_fetch_both($result))
{
if (eregi("T1|T2|T3|T4",$row['TABLE_NAME'])) {
$str = $row['TABLE_SCHEM'] . $row['TABLE_NAME'] . $row['TABLE_TYPE'];
if ($i < 4) print $str . "\n";
$i++;
}
}
@db2_exec($conn, 'DROP TABLE t.t1');
@db2_exec($conn, 'DROP TABLE t.t2');
@db2_exec($conn, 'DROP TABLE t.t3');
@db2_exec($conn, 'DROP TABLE t.t4');
print "done!";
}
else
{
echo 'no connection: ' . db2_conn_errormsg();
}
?>
--EXPECT--
TT1BASE TABLE
TT2BASE TABLE
TT3BASE TABLE
TT4BASE TABLE
done!

View File

@@ -1,60 +0,0 @@
--TEST--
IBM-DB2: db2_tables() - 3
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
$schema = 'CREATE SCHEMA t';
$result = @db2_exec($conn, $schema);
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
if ($conn)
{
$schema = strtoupper('t');
$result = db2_tables($conn,NULL,$schema);
$i = 0;
while ($row = db2_fetch_both($result))
{
if (eregi("T1|T2|T3|T4",$row[2])) {
$str = $row[1] ."/". $row[2] ."/". $row[3];
if ($i < 4) print $str . "\n";
$i++;
}
}
@db2_exec($conn, 'DROP TABLE t.t1');
@db2_exec($conn, 'DROP TABLE t.t2');
@db2_exec($conn, 'DROP TABLE t.t3');
@db2_exec($conn, 'DROP TABLE t.t4');
print "done!";
}
else
{
echo 'no connection: ' . db2_conn_errormsg();
}
?>
--EXPECT--
T/T1/BASE TABLE
T/T2/BASE TABLE
T/T3/BASE TABLE
T/T4/BASE TABLE
done!

View File

@@ -1,59 +0,0 @@
--TEST--
IBM-DB2: db2_tables() - 5
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$schema = 'CREATE SCHEMA t';
$result = @db2_exec($conn, $schema);
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$result = db2_tables($conn, NULL, "T");
for ($i=0; $i<db2_num_fields($result); $i++)
{
print db2_field_name($result, $i) . ", ";
}
print "\n\n";
$i = 0;
while ($row=db2_fetch_array($result))
{
if (eregi("T1|T2|T3|T4",$row[2])) {
db2_num_fields($result);
if ($i < 4) print ", " . $row[1] . ", " . $row[2] . ", " . $row[3] . ", , \n";
$i++;
}
}
db2_free_result($result);
@db2_exec($conn, 'DROP TABLE t.t1');
@db2_exec($conn, 'DROP TABLE t.t2');
@db2_exec($conn, 'DROP TABLE t.t3');
@db2_exec($conn, 'DROP TABLE t.t4');
?>
--EXPECT--
TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
, T, T1, BASE TABLE, ,
, T, T2, BASE TABLE, ,
, T, T3, BASE TABLE, ,
, T, T4, BASE TABLE, ,

View File

@@ -1,54 +0,0 @@
--TEST--
IBM-DB2: db2_tables() - Filter by table name
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$schema = 'CREATE SCHEMA t';
$result = @db2_exec($conn, $schema);
$create = 'CREATE TABLE t.t1( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t2( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t3( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$create = 'CREATE TABLE t.t4( c1 integer, c2 varchar(40))';
$result = @db2_exec($conn, $create);
$result = db2_tables($conn, NULL, '%', "T3");
$columns = db2_num_fields($result);
for ($i=0; $i < $columns; $i++) {
print db2_field_name($result, $i) . ", ";
}
print "\n\n";
while ($row = db2_fetch_array($result)) {
$final = ", " . $row[1] . ", " . $row[2] . ", " . $row[3] . ", " . $row[4] . ", ";
if ($row[2][0]=='T' && $row[3][0]=='T' && $row[3][1]=='3') break;
}
print $final . "\n";
db2_free_result($result);
@db2_exec($conn, 'DROP TABLE t.t1');
@db2_exec($conn, 'DROP TABLE t.t2');
@db2_exec($conn, 'DROP TABLE t.t3');
@db2_exec($conn, 'DROP TABLE t.t4');
?>
--EXPECT--
TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
, T, T3, BASE TABLE, ,

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: db2_tables() - Play with table objects
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php
@@ -9,13 +9,39 @@ require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
$server = db2_server_info( $conn );
$result = db2_tables($conn, NULL, strtoupper($user), 'ANIM%');
$t[0]=""; $t[1]=""; $t[2]=""; $t[3]="";
while ($row = db2_fetch_object($result)) {
echo 'Schema: ' . $row->TABLE_SCHEM . "\n";
echo 'Name: ' . $row->TABLE_NAME . "\n";
echo 'Type: ' . $row->TABLE_TYPE . "\n";
echo 'Remarks: ' . $row->REMARKS . "\n\n";
$output =
'Schema: ' . $row->TABLE_SCHEM . "\n"
. 'Name: ' . $row->TABLE_NAME . "\n"
. 'Type: ' . $row->TABLE_TYPE . "\n"
. 'Remarks: ' . $row->REMARKS . "\n\n";
if ($server->DBMS_NAME == 'AS') {
switch ($row->TABLE_NAME) {
case 'ANIMALS':
$t[0].=$output;
break;
case 'ANIMAL_PICS':
$t[1].=$output;
break;
case 'ANIME_CAT':
$t[2].=$output;
break;
default:
$t[3].=$output;
break;
}
} else {
echo $output;
}
}
if ($server->DBMS_NAME == 'AS') {
foreach ($t as $item) echo $item;
}
db2_free_result($result);

View File

@@ -1,37 +0,0 @@
--TEST--
IBM-DB2: db2_tables() - Play with table objects
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
$result = db2_tables($conn, NULL, strtoupper($user), 'ANIM%');
while ($row = db2_fetch_object($result)) {
if (eregi("ANIME_CAT|ANIMALS",$row->TABLE_NAME)) {
echo 'Schema: ' . $row->TABLE_SCHEM . "\n";
echo 'Name: ' . $row->TABLE_NAME . "\n";
echo 'Type: ' . $row->TABLE_TYPE . "\n";
echo 'Remarks: ' . $row->REMARKS . "\n\n";
}
}
db2_free_result($result);
db2_close($conn);
?>
--EXPECTF--
Schema: %s
Name: ANIMALS
Type: BASE TABLE
Remarks:
Schema: %s
Name: ANIME_CAT
Type: VIEW
Remarks:

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: db2_conn_error() - wrong database alias
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php

View File

@@ -1,25 +0,0 @@
--TEST--
IBM-DB2: db2_conn_errormsg() - wrong username
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipif3.inc');
?>
--FILE--
<?php
require_once('connection.inc');
$conn = @db2_connect($database, "y", $password);
if ($conn) {
echo "??? No way.\n";
}
else {
$err = db2_conn_errormsg();
echo $err."\n";
}
?>
--EXPECTF--
Authorization failure on distributed database connection attempt. SQLCODE=-30082

View File

@@ -1,26 +0,0 @@
--TEST--
IBM-DB2: db2_conn_errormsg() - wrong password
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipif3.inc');
?>
--FILE--
<?php
require_once('connection.inc');
$conn = @db2_connect($database, $user, "z");
if ($conn) {
echo "??? No way.\n";
}
else {
$err = db2_conn_errormsg();
echo $err."\n";
}
?>
--EXPECTF--
Authorization failure on distributed database connection attempt. SQLCODE=-30082

View File

@@ -2,7 +2,7 @@
IBM-DB2: PECL bug 10931 -- no result for db2_columns with lowercase table name
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipif3.inc');
?>
--FILE--
<?php

View File

@@ -1,137 +0,0 @@
--TEST--
IBM-DB2: PECL bug 10931 -- no result for db2_columns with lowercase table name
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
if ($conn) {
$sql = "DROP TABLE \"DB2\".\"test_10931\"";
@db2_exec($conn, $sql);
$sql = "create table \"DB2\".\"test_10931\" ( \"id\" INTEGER not null generated BY DEFAULT AS identity (NOCACHE, INCREMENT BY 1), \"title\" VARCHAR(50), \"created\" TIMESTAMP DEFAULT CURRENT TIMESTAMP, constraint P_USERS_U1 primary key (\"id\"))";
db2_exec($conn, $sql);
$stmt = db2_columns ($conn ,null , 'DB2' , 'test_10931' , '%' );
if ( $stmt )
{
while ($rowC = db2_fetch_assoc($stmt))
{
var_dump( $rowC );
}
}
}
else {
echo "Connection failed.\n";
}
?>
--EXPECTF--
array(16) {
["TABLE_CAT"]=>
string(%d) "%s"
["TABLE_SCHEM"]=>
string(3) "DB2"
["TABLE_NAME"]=>
string(10) "test_10931"
["COLUMN_NAME"]=>
string(2) "id"
["DATA_TYPE"]=>
int(4)
["TYPE_NAME"]=>
string(8) "INTEGER "
["LENGTH_PRECISION"]=>
int(9)
["BUFFER_LENGTH"]=>
int(4)
["NUM_SCALE"]=>
int(0)
["NUM_PREC_RADIX"]=>
int(10)
["NULLABLE"]=>
int(0)
["REMARKS"]=>
NULL
["COLUMN_DEF"]=>
NULL
["DATETIME_CODE"]=>
NULL
["CHAR_OCTET_LENGTH"]=>
NULL
["ORDINAL_POSITION"]=>
int(1)
}
array(16) {
["TABLE_CAT"]=>
string(%d) "%s"
["TABLE_SCHEM"]=>
string(3) "DB2"
["TABLE_NAME"]=>
string(10) "test_10931"
["COLUMN_NAME"]=>
string(5) "title"
["DATA_TYPE"]=>
int(12)
["TYPE_NAME"]=>
string(8) "VARCHAR "
["LENGTH_PRECISION"]=>
NULL
["BUFFER_LENGTH"]=>
int(52)
["NUM_SCALE"]=>
NULL
["NUM_PREC_RADIX"]=>
NULL
["NULLABLE"]=>
int(1)
["REMARKS"]=>
NULL
["COLUMN_DEF"]=>
NULL
["DATETIME_CODE"]=>
NULL
["CHAR_OCTET_LENGTH"]=>
int(50)
["ORDINAL_POSITION"]=>
int(2)
}
array(16) {
["TABLE_CAT"]=>
string(%d) "%s"
["TABLE_SCHEM"]=>
string(3) "DB2"
["TABLE_NAME"]=>
string(10) "test_10931"
["COLUMN_NAME"]=>
string(7) "created"
["DATA_TYPE"]=>
int(9)
["TYPE_NAME"]=>
string(8) "TIMESTMP"
["LENGTH_PRECISION"]=>
NULL
["BUFFER_LENGTH"]=>
int(10)
["NUM_SCALE"]=>
NULL
["NUM_PREC_RADIX"]=>
NULL
["NULLABLE"]=>
int(1)
["REMARKS"]=>
NULL
["COLUMN_DEF"]=>
string(17) "CURRENT_TIMESTAMP"
["DATETIME_CODE"]=>
int(93)
["CHAR_OCTET_LENGTH"]=>
NULL
["ORDINAL_POSITION"]=>
int(3)
}

View File

@@ -1,5 +1,7 @@
--TEST--
IBM-DB2: Call a stored procedure in a different binding pattern
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');

View File

@@ -1,34 +0,0 @@
--TEST--
IBM-DB2: db2_columns() - 2 - table
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
if ($conn) {
$result = db2_columns($conn,NULL,NULL,"EMP_PHOTO");
$i = 0;
while ($row = db2_fetch_both($result)) {
// IS_NULLABLE is NULLABLE
if ($row['COLUMN_NAME'] != 'EMP_ROWID' && $i < 3) {
printf ("%s,%s,%s,%s\n", $row['TABLE_SCHEM'],
$row['TABLE_NAME'], $row['COLUMN_NAME'], $row['NULLABLE']);
}
$i++;
}
print "done!";
} else {
echo 'no connection: ' . db2_conn_errormsg();
}
?>
--EXPECTF--
%s,EMP_PHOTO,EMPNO,0
%s,EMP_PHOTO,PHOTO_FORMAT,0
%s,EMP_PHOTO,PICTURE,1
done!

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: db2_statistics(): testing indexes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php

View File

@@ -1,75 +0,0 @@
--TEST--
IBM-DB2: db2_lob_read() -- Reading and writing lobs from memory
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
if ($conn) {
$drop = 'DROP TABLE clob_stream';
$result = @db2_exec( $conn, $drop );
$create = 'CREATE TABLE clob_stream (id INTEGER, my_clob CLOB)';
$result = db2_exec( $conn, $create );
$variable = "";
$stmt = db2_prepare($conn, "INSERT INTO clob_stream (id,my_clob) VALUES (1, ?)");
$variable = "THIS IS A CLOB TEST. THIS IS A CLOB TEST.";
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
db2_execute($stmt);
$sql = "SELECT id,my_clob FROM clob_stream";
$result = db2_prepare($conn, $sql);
db2_execute($result);
db2_fetch_row($result);
$i = 0;
while ($data = db2_lob_read($result, 2, 6)) {
echo "Loop $i: $data\n";
$i = $i + 1;
}
$drop = 'DROP TABLE blob_stream';
$result = @db2_exec( $conn, $drop );
$create = 'CREATE TABLE blob_stream (id INTEGER, my_blob BLOB)';
$result = db2_exec( $conn, $create );
$variable = "";
$stmt = db2_prepare($conn, "INSERT INTO blob_stream (id,my_blob) VALUES (1, ?)");
$variable = "THIS IS A BLOB TEST. THIS IS A BLOB TEST.";
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
db2_execute($stmt);
$sql = "SELECT id,my_blob FROM blob_stream";
$result = db2_prepare($conn, $sql);
db2_execute($result);
db2_fetch_row($result);
$i = 0;
while ($data = db2_lob_read($result, 2, 6)) {
echo "Loop $i: $data\n";
$i = $i + 1;
}
} else {
echo 'no connection: ' . db2_conn_errormsg();
}
?>
--EXPECTF--
Loop 0: THIS I
Loop 1: S A CL
Loop 2: OB TES
Loop 3: T. THI
Loop 4: S IS A
Loop 5: CLOB
Loop 6: TEST.
Loop 0: THIS I
Loop 1: S A BL
Loop 2: OB TES
Loop 3: T. THI
Loop 4: S IS A
Loop 5: BLOB
Loop 6: TEST.

View File

@@ -1,31 +0,0 @@
--TEST--
IBM-DB2: db2_field_display_size() - 1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$result = db2_exec($conn, "select * from staff");
$cols = db2_num_fields($result);
for ($i=0; $i<$cols; $i++)
{
$size = db2_field_display_size($result,$i);
print "col:$i and size: $size\n";
}
db2_close($conn);
?>
--EXPECT--
col:0 and size: 7
col:1 and size: 10
col:2 and size: 7
col:3 and size: 6
col:4 and size: 7
col:5 and size: 10
col:6 and size: 10

View File

@@ -1,29 +0,0 @@
--TEST--
IBM-DB2: db2_field_display_size() - 2
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$result = db2_exec($conn, "select * from sales");
$i=1;
while ($i <= db2_num_fields($result))
{
printf ("%d size %d\n",$i, db2_field_display_size($result,$i));
$i++;
}
db2_close($conn);
?>
--EXPECT--
1 size 16
2 size 16
3 size 12
4 size 0

View File

@@ -1,24 +0,0 @@
--TEST--
IBM-DB2: db2_field_display_size() - 3
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$result = db2_exec($conn, "select * from sales");
$i = "SALES_PERSON";
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
$i=2;
printf ("%d size %d\n",$i, db2_field_display_size($result,$i));
?>
--EXPECT--
SALES_PERSON size 16
2 size 16

View File

@@ -1,55 +0,0 @@
--TEST--
IBM-DB2: db2_field_display_size() - 4
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$result = db2_exec($conn, "select * from sales");
$i = "sales_person";
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
$i = "REGION";
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
$i = "REgion";
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
$i = "HELMUT";
printf ("%s size %d\n",$i, db2_field_display_size($result,$i));
$t = db2_field_display_size($result,"");
var_dump( $t );
$t = db2_field_display_size($result,"HELMUT");
var_dump( $t );
$t = db2_field_display_size($result,"Region");
var_dump( $t );
$t = db2_field_display_size($result,"SALES_DATE");
var_dump( $t );
?>
--EXPECT--
sales_person size 0
REGION size 16
REgion size 0
HELMUT size 0
bool(false)
bool(false)
bool(false)
int(11)

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: db2_field_width() - by position and name
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php

View File

@@ -1,59 +0,0 @@
--TEST--
IBM-DB2: db2_field_width() - by position and name
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$user,$password);
$result = db2_exec($conn, "select * from sales");
$result2 = db2_exec($conn, "select * from staff");
$result3 = db2_exec($conn, "select * from emp_photo");
for ($i=0; $i < db2_num_fields($result); $i++)
{
print $i . ":" . db2_field_width($result,$i) . "\n";
}
print "\n-----\n";
for ($i=0; $i < db2_num_fields($result2); $i++)
{
print $i . ":" . db2_field_width($result2,db2_field_name($result2,$i)) . "\n";
}
print "\n-----\n";
for ($i=0; $i < 3; $i++)
{
print $i . ":" . db2_field_width($result3,$i) . "," . db2_field_display_size($result3,$i)."\n";
}
print "\n-----\n";
print "region:" . db2_field_type($result,'region') . "\n";
print "5:" . db2_field_type($result2,5) . "\n";
?>
--EXPECT--
0:10
1:15
2:15
3:4
-----
0:2
1:9
2:2
3:5
4:2
5:1794
6:1794
-----
0:6,7
1:10,11
2:102400,102400
-----
region:
5:real

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: Test for XML OUT parameters in stored procedures.
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: db2_escape_string function
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
@@ -80,4 +80,4 @@ The files are the same...good.
array(1) {
[0]=>
string(7) "o'grady"
}
}

View File

@@ -1,41 +0,0 @@
--TEST--
IBM-DB2: PECL bug 9173 -- db2_procedures & db2_ procedure_columns doesn't work on persistent connections
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_pconnect($database, $user, $password);
if ($conn) {
$stmt = db2_procedures($conn, NULL, 'SYS%', '%%');
$row = db2_fetch_assoc($stmt);
var_dump($row);
}
else {
echo "Connection failed.\n";
}
?>
--EXPECTF--
array(7) {
["PROCEDURE_CAT"]=>
%s
["PROCEDURE_SCHEM"]=>
string(%d) "%s"
["PROCEDURE_NAME"]=>
string(%d) "%s"
["NUM_INPUT_PARAMS"]=>
int(%d)
["NUM_OUTPUT_PARAMS"]=>
int(%d)
["NUM_RESULT_SETS"]=>
int(%d)
["REMARKS"]=>
%s
}

View File

@@ -0,0 +1,22 @@
--TEST--
IBM-DB2: connect to a database (uncataloged connection)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect("DSN=$database;UID=$user;PWD=$password;", '', '');
if ($conn) {
echo "Connection succeeded.";
db2_close($conn);
}
else {
echo "Connection failed.";
}
?>
--EXPECT--
Connection succeeded.

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

12
tests/test_V6_10353.phpt Normal file
View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -488,60 +488,41 @@ else {
?>
--EXPECTF--
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
%s
1
1
0
0
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
%s
1
1
0
0
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
%s
1
1
0
0
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
%s
1
1
0
0
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
%s
1
1
1
1
%s
1
1
1
1
%s
1
1
1
1
1
1
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
1
1
1
1
Warning: db2_execute(): Statement Execute Failed in %s
Warning: db2_num_rows(): SQLRowCount failed in %s
1
1
1
1
1
1

View File

@@ -30,8 +30,6 @@ print_r($row);
db2_rollback($conn);
?>
--EXPECTREGEX--
(PHP )?Warning:\s+db2_execute\(\): Statement Execute Failed in .*?test_133_V5V6_ExecuteLongInputParams.php on line \d+
bool\(false\)
SQLSTATE: 22001
Message: Value for column or variable BREED too long.
--EXPECTF--
%s(false)
%sMessage: Value for column or variable NAME too long.

View File

@@ -35,7 +35,7 @@ IBM-DB2: Call a stored procedure in a different binding pattern
db2_bind_param( $stmt , 2 , "out2" , DB2_PARAM_OUT );
db2_bind_param( $stmt , 3 , "out3" , DB2_PARAM_OUT );
db2_bind_param( $stmt , 4 , "out4" , DB2_PARAM_OUT );
db2_bind_param( $stmt , 5 , "out5" , DB2_PARAM_OUT , DB2_CLOB );
db2_bind_param( $stmt , 5 , "out5" , DB2_PARAM_OUT );
$result = db2_execute( $stmt );

View File

@@ -56,7 +56,7 @@ out 1:
out 2:
5.01
out 3:
varchar
varchar
out 4:
3271982
out 5:

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,73 @@
--TEST--
IBM-DB2: db2_statistics(): testing indexes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
/*
Bug CLI, requires lib argument to SQLStatistics, but only on 1208 amd 1200 path.
*/
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_override_ccsid=819");
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
if ($conn) {
$rc = @db2_exec($conn, "DROP TABLE index1");
$rc = @db2_exec($conn, "DROP TABLE index_test");
$rc = db2_exec($conn, "CREATE TABLE index_test (id INTEGER, data VARCHAR(50))");
$rc = db2_exec($conn, "CREATE INDEX index1 ON index_test (id)");
echo "Test first index table:\n";
$result = db2_statistics($conn,NULL,NULL,"INDEX_TEST",1);
$row = db2_fetch_array($result);
echo $row[2] . "\n"; // TABLE_NAME
echo $row[3] . "\n"; // NON_UNIQUE
echo $row[5] . "\n"; // INDEX_NAME
echo $row[8] . "\n"; // COLUMN_NAME
$rc = @db2_exec($conn, "DROP TABLE index_test2");
$rc = db2_exec($conn, "CREATE TABLE index_test2 (id INTEGER, data VARCHAR(50))");
$rc = db2_exec($conn, "CREATE INDEX index2 ON index_test2 (data)");
echo "Test second index table:\n";
$result = db2_statistics($conn,NULL,NULL,"INDEX_TEST2",1);
$row = db2_fetch_array($result);
echo $row[2] . "\n"; // TABLE_NAME
echo $row[3] . "\n"; // NON_UNIQUE
echo $row[5] . "\n"; // INDEX_NAME
echo $row[8] . "\n"; // COLUMN_NAME
echo "Test non-existent table:\n";
$result = db2_statistics($conn,NULL,NULL,"NON_EXISTENT_TABLE",1);
$row = db2_fetch_array($result);
if ($row) {
echo "Non-Empty\n";
} else {
echo "Empty\n";
}
} else {
echo 'no connection: ' . db2_conn_errormsg();
}
?>
--EXPECTF--
Test first index table:
INDEX_TEST
1
INDEX1
ID
Test second index table:
INDEX_TEST2
1
INDEX2
DATA
Test non-existent table:
Empty

View File

@@ -0,0 +1,67 @@
--TEST--
IBM-DB2: db2_statistics(): testing indexes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
if ($conn) {
$rc = @db2_exec($conn, "DROP TABLE index1");
$rc = @db2_exec($conn, "DROP TABLE index_test");
$rc = db2_exec($conn, "CREATE TABLE index_test (id INTEGER, data VARCHAR(50))");
$rc = db2_exec($conn, "CREATE INDEX index1 ON index_test (id)");
echo "Test first index table:\n";
$result = db2_statistics($conn,NULL,$username,"INDEX_TEST",1);
$row = db2_fetch_array($result);
echo $row[2] . "\n"; // TABLE_NAME
echo $row[3] . "\n"; // NON_UNIQUE
echo $row[5] . "\n"; // INDEX_NAME
echo $row[8] . "\n"; // COLUMN_NAME
$rc = @db2_exec($conn, "DROP TABLE index_test2");
$rc = db2_exec($conn, "CREATE TABLE index_test2 (id INTEGER, data VARCHAR(50))");
$rc = db2_exec($conn, "CREATE INDEX index2 ON index_test2 (data)");
echo "Test second index table:\n";
$result = db2_statistics($conn,NULL,$username,"INDEX_TEST2",1);
$row = db2_fetch_array($result);
echo $row[2] . "\n"; // TABLE_NAME
echo $row[3] . "\n"; // NON_UNIQUE
echo $row[5] . "\n"; // INDEX_NAME
echo $row[8] . "\n"; // COLUMN_NAME
echo "Test non-existent table:\n";
$result = db2_statistics($conn,NULL,$username,"NON_EXISTENT_TABLE",1);
$row = db2_fetch_array($result);
if ($row) {
echo "Non-Empty\n";
} else {
echo "Empty\n";
}
} else {
echo 'no connection: ' . db2_conn_errormsg();
}
?>
--EXPECTF--
Test first index table:
INDEX_TEST
1
INDEX1
ID
Test second index table:
INDEX_TEST2
1
INDEX2
DATA
Test non-existent table:
Empty

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -23,8 +23,8 @@ else {
}
?>
--EXPECT--
object(stdClass)#2 (4) {
--EXPECTF--
%s{
["ID"]=>
int(0)
["BREED"]=>

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,82 @@
--TEST--
IBM-DB2: db2_escape_string function
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
if ($conn) {
$drop = 'DROP TABLE escapeit';
$result = @db2_exec($conn, $drop);
$create = 'CREATE TABLE escapeit(id INTEGER, info VARCHAR(200))';
$result = @db2_exec($conn, $create);
$orig = fopen("escape.dat", "rb");
$new = fopen("escape_out.dat", "wb");
$str[0] = "Some random special characters: \n , \r , \ , ' , \" .";
$str[1] = "Backslash (\). Single quote ('). Double quote (\")";
$str[2] = "The NULL character \\0 must be escaped manually";
$str[3] = "Intersting characters must be escaped manually: \\x1a , \\x00 .";
$str[4] = "Nothing to quote";
$str[5] = 200676;
$str[6] = "";
$count = 0;
foreach( $str as $string ) {
$escaped = db2_escape_string($string);
$insert = "INSERT INTO escapeit VALUES($count, '$escaped')";
db2_exec($conn, $insert);
$sql = "SELECT info FROM escapeit WHERE id = ?";
$stmt = db2_prepare($conn, $sql);
$currow = array($count);
db2_execute($stmt, $currow);
$result = db2_fetch_array($stmt);
$escapedFromDb = $result[0];
$strhex = bin2hex($string);
$db2hex = bin2hex($escapedFromDb);
if ($strhex == $db2hex) echo "$count...good.\n";
else {
echo "$count...bad\n";
echo "org...$strhex\n";
echo "db2...$db2hex\n";
}
$count++;
}
$name = "o'grady";
$esc_name = db2_escape_string($name);
$sql = "INSERT INTO escapeit(id, info) VALUES(100, 'o''grady')";
db2_exec($conn, $sql);
$select = "SELECT info FROM escapeit where info='$esc_name'";
$stmt = db2_exec($conn, $select);
while ($row = db2_fetch_array($stmt))
{
var_dump($row);
if ($row[0] != $name) {
"FAILED! " . $row[0] . " should equal $name";
}
}
}
?>
--EXPECT--
0...good.
1...good.
2...good.
3...good.
4...good.
5...good.
6...good.
array(1) {
[0]=>
string(7) "o'grady"
}

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

88
tests/test_V6_bigint.phpt Normal file
View File

@@ -0,0 +1,88 @@
--TEST--
IBM-DB2: bigint datatype
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
if ($conn) {
$drop_table_sql = 'drop table table0';
$stmt = @db2_exec($conn, $drop_table_sql);
//Create table table0 with 2 columns of type bigint
$create_table_sql = 'create table table0( id1 bigint , id2 bigint)';
$stmt = @db2_exec($conn, $create_table_sql);
#Insert into table table0 big values
$sql = 'insert into table0 values(?,?)';
$param1 = "922337203685477580"; // avoid 922337203685477580 = 9.2233720368548E+17
$param2 = "922337203685477581"; // avoid 922337203685477581 = 9.2233720368548E+17
$param3 = "922337203685477589"; // avoid 922337203685477589 = 9.2233720368548E+17
//Prepare statement
$prepared_stmt = db2_prepare($conn, $sql);
db2_bind_param($prepared_stmt, 1, 'param1'); //Bind Parameter 1
db2_bind_param($prepared_stmt, 2, 'param2'); //Bind parameter 2
//Execute statement
db2_execute($prepared_stmt) ;
//Retreive the inserted values
$result = @db2_exec($conn,'select * from table0');
if ($result) {
while($row = db2_fetch_array($result)) {
var_dump($row);
print "\n";
}
}
$drop_proc_sql = 'drop procedure update_bigint_col';
$stmt = @db2_exec(conn,drop_proc_sql);
//Create procedure with 2 IN parameters of type bigint
$create_proc_sql = "CREATE PROCEDURE update_bigint_col (IN param1 bigint, IN param2 bigint)
BEGIN
UPDATE table0 SET (id1) = (param1) WHERE id2 = param2;
END";
$stmt = @db2_exec($conn, $create_proc_sql);
$call_sql = 'call update_bigint_col(?, ?)';
//Prepare statement
$prepared_stmt = db2_prepare($conn, $call_sql);
db2_bind_param($prepared_stmt, 1, 'param3'); //Bind Parameter 1
print db2_stmt_errormsg();
db2_bind_param($prepared_stmt, 2, 'param2'); //Bind Parameter 2
//Execute statement
db2_execute($prepared_stmt);
//Retreive the values updated through the Stored Proc
$result = @db2_exec($conn, 'select * from table0');
if ($result) {
while($row = db2_fetch_array($result)) {
var_dump($row);
print "\n";
}
}
}
?>
--EXPECT--
array(2) {
[0]=>
string(18) "922337203685477580"
[1]=>
string(18) "922337203685477581"
}
array(2) {
[0]=>
string(18) "922337203685477589"
[1]=>
string(18) "922337203685477581"
}

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,254 @@
--TEST--
IBM-DB2: check for connect deallocator functioning to rollback and disconnect if there is any active transaction
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
// This test case will insert a unique row into the table (primary key column id). and then depending on the case (Autocommit ON/OFF)
// will try to insert the same row (with same id value) ane expect it to fail or pass accordingly.
// One cannot use a select statement to retrieve the row with respective id and verify that txn was successful
// because no rows does not gaurantee that the txn was rolled back.
// IN some case db2_exec is prepended with @. This is done to avoid the warnings that will be generated by driver when sql fails, as expected
//Case1: Check for transaction with Autocommit ON. Autocommit setting triggered from db2_autocommit.
function case1 () {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
db2_autocommit($conn,DB2_AUTOCOMMIT_ON);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (1, 'case1')");
if( !$stmt ) {
echo "case 1 insertion failed\n";
}
}
function verifycase1() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = @db2_exec($conn,"insert into dealloctab(id, name) values (1, 'case1')");
if( !$stmt ) {
echo "Test case 1 is successful\n";
} else {
echo "Test case 1 failed\n";
}
}
//Case2: Check for transaction with Autocommit OFF. Autocommit setting triggered from db2_autocommit.
function case2 () {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
db2_autocommit($conn,DB2_AUTOCOMMIT_OFF);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (2, 'case2')");
if( !$stmt ) {
echo "case 2 insertion failed\n";
}
}
function verifycase2() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (2, 'case2')");
// The insert should have been rolled back hence the above statement should have executed successfully.
if( $stmt ) {
echo "Test case 2 is successful\n";
} else {
echo "Test case 2 failed\n";
}
}
//Check for transaction with Autocommit ON. Autocommit setting triggered from db2_set_option.
function case3 () {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$options = array('autocommit' => DB2_AUTOCOMMIT_ON );
db2_set_option($conn, $options, 1);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (3, 'case3')");
if( !$stmt ) {
echo "case 3 insertion failed\n";
}
}
function verifycase3() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = @db2_exec($conn,"insert into dealloctab(id, name) values (3, 'case3')");
// The insert should have been committed hence the above sql should fail.
if( !$stmt ) {
echo "Test case 3 is successful\n";
} else {
echo "Test case 3 failed\n";
}
}
//Check for transaction with Autocommit OFF. Autocommit setting triggered from db2_set_option.
function case4 () {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$options = array('autocommit' => DB2_AUTOCOMMIT_OFF );
db2_set_option($conn, $options, 1);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (4, 'case4')");
if( !$stmt ) {
echo "case 4 insertion failed\n";
}
}
function verifycase4() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (4, 'case4')");
// The insert should have been rolled back hence the above statement should execute successfully.
if( $stmt ) {
echo "Test case 4 is successful\n";
} else {
echo "Test case 4 failed\n";
}
}
//Check for clean transaction with Autocommit OFF. Autocommit setting triggered from db2_set_option.
function case5 () {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$options = array('autocommit' => DB2_AUTOCOMMIT_OFF );
db2_set_option($conn, $options, 1);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (5, 'case5')");
$options1 = array('autocommit' => DB2_AUTOCOMMIT_ON );
db2_set_option($conn, $options1, 1);
if( !$stmt ) {
echo "case 5 insertion failed\n";
}
}
function verifycase5() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = @db2_exec($conn,"insert into dealloctab(id, name) values (5, 'case5')");
// The insert should have been committed hence the above sql should fail.
if( !$stmt ) {
echo "Test case 5 is successful\n";
} else {
echo "Test case 5 failed\n";
}
}
//Check for clean transaction with Autocommit OFF. Autocommit setting triggered from db2_autocommit.
function case6 () {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
db2_autocommit($conn,DB2_AUTOCOMMIT_OFF);
$stmt = db2_exec($conn,"insert into dealloctab(id, name) values (6, 'case6')");
db2_autocommit($conn,DB2_AUTOCOMMIT_ON);
if( !$stmt ) {
echo "case 6 insertion failed\n";
}
}
function verifycase6() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = @db2_exec($conn,"insert into dealloctab(id, name) values (6, 'case6')");
// The insert should have been committed hence the above sql should fail.
if( !$stmt ) {
echo "Test case 6 is successful\n";
} else {
echo "Test case 6 failed\n";
}
}
function prepare() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = db2_exec($conn,"create table dealloctab(id integer primary key not null, name varchar(5))");
if(!$stmt) {
echo "Creation of table dealloctab failed \n";
}
}
function cleanup() {
global $database, $user, $password;
$conn = db2_connect($database, $user, $password);
$stmt = db2_exec($conn,"drop table dealloctab");
if(!$stmt) {
echo "Dropping of table dealloctab failed \n";
}
}
function main() {
prepare();
case1();
verifycase1();
case2();
verifycase2();
case3();
verifycase3();
case4();
verifycase4();
/*
case5();
verifycase5();
case6();
verifycase6();
*/
cleanup();
}
main();
?>
--EXPECT--
Test case 1 is successful
Test case 2 is successful
Test case 3 is successful
Test case 4 is successful

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

43
tests/test_V6_hebrew.phpt Normal file
View File

@@ -0,0 +1,43 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i Hebrew (zend support issue)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
$input = 'IBM i data string "123Eאבג"';
$drop = 'DROP TABLE HEBREW';
$res = @db2_exec($conn, $drop);
$create = 'CREATE TABLE HEBREW (TEXTME VARCHAR(1024) CCSID 62211)'; // not use 424
$res = db2_exec($conn, $create);
$insert = 'INSERT INTO HEBREW (TEXTME) VALUES (?)';
$sth = db2_prepare($conn, $insert);
$res = db2_execute($sth, array($input));
$look = 'select TEXTME from HEBREW';
$res = db2_exec($conn, $look);
$row = db2_fetch_array($res);
echo $row[0];
echo "\n";
echo $input;
echo "\n";
if (bin2hex($row[0]) == bin2hex($input)) {
echo "success\n";
} else {
echo "Failure]n";
}
/*
http://www-01.ibm.com/support/docview.wss?uid=nas8N1010892
To resolve this, you should use the CCSID 62211 in place of 424. CCSID 62211 is ST 5.
The conversion from 62211 to 1200 or 1208 (ST 5 to ST 10) results in no reordering.
*/
?>
--EXPECTF--
%s
success

View File

@@ -0,0 +1,64 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i force all connect to pconnect (operator issue)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
require_once('xmlservice.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_all_pconnect=1");
$conn1 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn1);
$key1 = xmlservice_diag_jobinfo($xml);
echo "$key1\n";
putenv("IBM_DB_i5_all_pconnect=1");
$conn2 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn2);
$key2 = xmlservice_diag_jobinfo($xml);
echo "$key2\n";
if ($key1 == $key2) {
echo "success\n";
} else {
echo "failed ($key1 == $key2)\n";
}
putenv("IBM_DB_i5_all_pconnect=0");
$conn3 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn3);
$key3 = xmlservice_diag_jobinfo($xml);
echo "$key3\n";
putenv("IBM_DB_i5_all_pconnect=0");
$conn4 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn4);
$key4 = xmlservice_diag_jobinfo($xml);
echo "$key4\n";
if ($key1 != $key3) {
echo "success\n";
} else {
echo "failed ($key1 == $key3)\n";
}
if ($key3 != $key4) {
echo "success\n";
} else {
echo "failed ($key3 == $key4)\n";
}
?>
--EXPECTF--
%s
success
%s
success
success

View File

@@ -0,0 +1,36 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i test ini isolation modes (operator issue)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_allow_commit=4");
$conn1 = db2_connect($database, $user, $password);
db2_autocommit( $conn1, DB2_AUTOCOMMIT_OFF );
$sql = 'UPDATE animals SET id = 9';
$res = db2_exec($conn1, $sql);
print "Number of affected rows: " . db2_num_rows($res). "\n";
putenv("IBM_DB_i5_allow_commit=0"); // 0,1-read uncommit; 2+ will hang
$conn2 = db2_connect($database, $user, $password);
$sql = 'select * from animals where id = 1';
$res = db2_exec($conn2, $sql);
$row = db2_fetch_array($res);
if ($row === false) {
echo "success\n";
} else {
echo "failure ($row)\n";
}
db2_close($conn2);
db2_rollback($conn1);
db2_close($conn1);
?>
--EXPECT--
Number of affected rows: 7
success

View File

@@ -0,0 +1,33 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i security restrict blank db,uid,pwd (unless customer allow flag)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_blank_userid=0");
$conn = db2_connect('', '', '');
if ($conn)
{
echo "success\n";
}
else {
echo "failed\n";
}
putenv("IBM_DB_i5_blank_userid=1");
$conn = db2_connect('', '', '');
if ($conn)
{
echo "success\n";
}
else {
echo "failed\n";
}
?>
--EXPECT--
failed
success

View File

@@ -0,0 +1,55 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i check pconnect (alternative LUW ping)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
require_once('xmlservice.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_check_pconnect=-42");
echo "\n(IBM_DB_i5_check_pconnect=-42)\n";
$conn1 = db2_pconnect($database, $user, $password);
$xml = xmlservice_diag($conn1);
$key1 = xmlservice_diag_jobinfo($xml);
echo "$key1\n";
$conn2 = db2_pconnect($database, $user, $password);
$xml = xmlservice_diag($conn2);
$key2 = xmlservice_diag_jobinfo($xml);
echo "$key2\n";
if ($key1 == $key2) {
echo "success\n";
} else {
echo "failed ($key1 == $key2)\n";
}
// kill the job (pconnect still active)
$xml = xmlservice_kill($conn1);
putenv("IBM_DB_i5_check_pconnect=4");
echo "(IBM_DB_i5_check_pconnect=4)\n";
$conn3 = db2_pconnect($database, $user, $password);
if (!$conn3) die("bad connect $conn3 (IBM_DB_i5_check_pconnect=4)");
$xml = xmlservice_diag($conn3);
$key3 = xmlservice_diag_jobinfo($xml);
echo "$key3\n";
if ($key3 == $key2) {
echo "failed ($key3 == $key2)\n";
} else {
echo "success\n";
}
// echo $xml;
?>
--EXPECTF--
%s
success
%s
success

View File

@@ -0,0 +1,56 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i security guard profile (customer application issue)
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
require_once('connection.inc');
require_once('xmlservice.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_guard_profile=1"); /* before include this test */
$conn1 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn1);
$key1 = xmlservice_diag_jobinfo($xml);
echo "key1 $key1\n";
xmlservice_switch_profile($conn1, $switch_user, $switch_password);
$xml = xmlservice_diag($conn1);
$key2 = xmlservice_diag_jobinfo($xml);
echo "key2 $key2\n";
db2_close($conn1);
putenv("IBM_DB_i5_guard_profile=1");
$conn2 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn2);
$key3 = xmlservice_diag_jobinfo($xml);
echo "key3 $key3\n";
db2_close($conn2);
if (strpos($key1,$user) === false) {
echo "failed key1 ($key1) missing ".$user."\n";
} else {
echo "success\n";
}
if (strpos($key2,$switch_user) === false) {
echo "failed key2 ($key2) missing ".$switch_user."\n";
} else {
echo "success\n";
}
if (strpos($key3,$switch_user) === false) {
echo "success\n";
} else {
echo "failed key 3 ($key3) missing ".$user."\n";
}
?>
--EXPECTF--
%s
success
success
success

View File

@@ -0,0 +1,100 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i ignore user profile (operator no QSQSRVR jobs)
--SKIPIF--
<?php
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_ignore_userid=1"); /* before include this test */
require_once('skipif.inc');
?>
--FILE--
<?php
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_ignore_userid=1"); /* before include this test */
require_once('connection.inc');
require_once('xmlservice.inc');
putenv("IBM_DB_i5_ignore_userid=1");
$conn1 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn1);
$key1 = xmlservice_diag_jobinfo($xml);
echo "$key1\n";
db2_close($conn1);
putenv("IBM_DB_i5_ignore_userid=1");
$conn2 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn2);
$key2 = xmlservice_diag_jobinfo($xml);
echo "$key2\n";
db2_close($conn2);
if (strpos($key1,"QSQSRVR") === false) {
echo "success\n";
} else {
echo "failed ($key1 is QSQSRVR)\n";
}
if (strpos($key2,"QSQSRVR") === false) {
echo "success\n";
} else {
echo "failed ($key2 is QSQSRVR)\n";
}
if ($key1 == $key2) {
echo "success\n";
} else {
echo "failed ($key1 == $key2)\n";
}
putenv("IBM_DB_i5_ignore_userid=0");
$conn3 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn3);
$key3 = xmlservice_diag_jobinfo($xml);
echo "$key3\n";
putenv("IBM_DB_i5_ignore_userid=0");
$conn4 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn4);
$key4 = xmlservice_diag_jobinfo($xml);
echo "$key4\n";
if (strpos($key3,"QSQSRVR") === false) {
echo "failed ($key3 not QSQSRVR)\n";
} else {
echo "success\n";
}
if (strpos($key4,"QSQSRVR") === false) {
echo "failed ($key4 not QSQSRVR)\n";
} else {
echo "success\n";
}
if ($key1 != $key3) {
echo "success\n";
} else {
echo "failed ($key1 == $key3)\n";
}
if ($key3 != $key4) {
echo "success\n";
} else {
echo "failed ($key3 == $key4)\n";
}
?>
--EXPECTF--
%s
success
success
success
%s
success
success
success
success

View File

@@ -0,0 +1,47 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i max use pconnect (operator issue)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
require_once('xmlservice.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_max_pconnect=2");
$conn1 = db2_pconnect($database, $user, $password);
$xml = xmlservice_diag($conn1);
$key1 = xmlservice_diag_jobinfo($xml);
echo "$key1\n";
$conn2 = db2_pconnect($database, $user, $password);
$xml = xmlservice_diag($conn2);
$key2 = xmlservice_diag_jobinfo($xml);
echo "$key2\n";
if ($key1 == $key2) {
echo "success\n";
} else {
echo "failed ($key1 == $key2)\n";
}
$conn3 = db2_pconnect($database, $user, $password);
$xml = xmlservice_diag($conn3);
$key3 = xmlservice_diag_jobinfo($xml);
echo "$key3\n";
if ($key3 == $key2) {
echo "failed ($key3 == $key2)\n";
} else {
echo "success\n";
}
?>
--EXPECTF--
%s
success
%s
success

View File

@@ -0,0 +1,40 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i change QSQSRVR subsystem ccsid 1208 (operator issue)
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php
require_once('connection.inc');
require_once('xmlservice.inc');
/*
> crtlib adc
> CRTSBSD SBSD(ADC/ADC) POOLS((1 *BASE)) TEXT('tony subsystem descr')
> CRTJOBD JOBD(ADC/ADC) TEXT('tony job descr')
> CRTCLS CLS(ADC/ADC) TEXT('tony class')
> ADDPJE SBSD(ADC/ADC) PGM(QSYS/QSQSRVR) MAXJOBS(*NOMAX)
> strsbs adc/adc
*/
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_override_ccsid=1208");
putenv("IBM_DB_i5_servermode_subsystem=ADC"); /* before include this test */
$conn1 = db2_connect($database, $user, $password);
$xml = xmlservice_diag($conn1);
$key1 = xmlservice_diag_jobinfo($xml);
echo "key1 $key1\n";
db2_close($conn1);
if (strpos($key1,"ADC") === false) {
echo "failed key1 ($key1) missing ADC\n";
} else {
echo "success\n";
}
?>
--EXPECTF--
%s
success

View File

@@ -0,0 +1,56 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i system naming (operator override)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
require_once('xmlservice.inc');
putenv("IBM_DB_I5_TEST=1");
putenv("IBM_DB_i5_sys_naming=0");
echo("IBM_DB_i5_sys_naming=0\n");
$conn1 = db2_connect($database, $user, $password);
$stmt = db2_exec( $conn1, "SELECT * FROM $user/animals ORDER BY breed" );
if ($stmt) {
echo "failed ($stmt)\n";
} else {
echo "success\n";
}
$conn2 = db2_connect($database, $user, $password);
$stmt = db2_exec($conn2, "SELECT * FROM $user.animals ORDER BY breed" );
if ($stmt) {
echo "success\n";
} else {
echo "failed ($stmt)\n";
}
putenv("IBM_DB_i5_sys_naming=1");
echo("IBM_DB_i5_sys_naming=1\n");
$conn1 = db2_connect($database, $user, $password);
$stmt = db2_exec( $conn1, "SELECT * FROM $user/animals ORDER BY breed" );
if ($stmt) {
echo "success\n";
} else {
echo "failed ($stmt)\n";
}
$conn2 = db2_connect($database, $user, $password);
$stmt = db2_exec($conn2, "SELECT * FROM $user.animals ORDER BY breed" );
if ($stmt) {
echo "success\n";
} else {
echo "failed ($stmt)\n";
}
?>
--EXPECTF--
%s
success
success
%s
success
success

View File

@@ -0,0 +1,107 @@
--TEST--
IBM-DB2: Last Insert ID test
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
if ($conn) {
echo "Connection succeeded.\n";
$dropTable = 'DROP TABLE lastInsertID';
$createTable = 'CREATE TABLE lastInsertID (id integer GENERATED BY DEFAULT AS IDENTITY, name varchar(20))';
$insertTable = 'INSERT INTO lastInsertID (name) VALUES (\'Temp Name\')';
$insertMany = 'INSERT INTO lastInsertID (name) VALUES (\'Temp Name\'), (\'Temp Name\')';
$stmt = @db2_exec($conn, $dropTable);
$stmt = @db2_exec($conn, $createTable);
/* Checking when no insert has been executed. */
$ret = db2_last_insert_id($conn);
if($ret) {
echo "Last Insert ID is : " . $ret . "\n";
} else {
echo "No Last insert ID.\n";
}
/* Inserting many rows from VALUES clause */
$stmt = db2_exec($conn, $insertMany);
$ret = db2_last_insert_id($conn);
if($ret) {
echo "Last Insert ID is : " . $ret . "\n";
} else {
echo "No Last insert ID.\n";
}
/* Checking for single row inserted. */
$stmt = db2_exec($conn, $insertTable);
$ret = db2_last_insert_id($conn);
if($ret) {
echo "Last Insert ID is : " . $ret . "\n";
} else {
echo "No Last insert ID.\n";
}
/* Checking when multiple rows has been inserted separately. */
for ($i = 0;$i < 5;$i++) {
$stmt = db2_exec($conn, $insertTable);
$ret = db2_last_insert_id($conn);
if($ret) {
echo "Last Insert ID is : " . $ret . "\n";
} else {
echo "No Last insert ID.\n";
}
}
db2_close($conn);
}
else {
echo "Connection failed.";
}
//Testing when there is no serial column in table.
$conn = db2_connect($database, $user, $password);
if ($conn) {
echo "Connection succeeded.\n";
$dropTable = 'DROP TABLE lastInsertID';
$createTable = 'CREATE TABLE lastInsertID (id integer, name varchar(20))';
$insertTable = 'INSERT INTO lastInsertID (id, name) VALUES (1, \'Temp Name\')';
$stmt = @db2_exec($conn, $dropTable);
$stmt = @db2_exec($conn, $createTable);
$stmt = db2_exec($conn, $insertTable);
$ret = db2_last_insert_id($conn);
if($ret) {
echo "Last Insert ID is : " . $ret . "\n";
} else {
echo "No Last insert ID.\n";
}
$stmt = @db2_exec($conn, $dropTable);
db2_close($conn);
}
else {
echo "Connection failed.";
}
?>
--EXPECT--
Connection succeeded.
No Last insert ID.
Last Insert ID is : 2
Last Insert ID is : 3
Last Insert ID is : 4
Last Insert ID is : 5
Last Insert ID is : 6
Last Insert ID is : 7
Last Insert ID is : 8
Connection succeeded.
No Last insert ID.

View File

@@ -0,0 +1,97 @@
--TEST--
IBM-DB2: Timestamp data type test.
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($database, $user, $password);
if (!$conn) {
echo "Error connecting to database " . db2_conn_errormsg() ."\n";
exit;
}
// Drop/Create source and target tables
@db2_exec($conn, "DROP TABLE src");
@db2_exec($conn, "DROP TABLE targ");
db2_exec($conn, "CREATE TABLE src (c1 INT, c2 TIMESTAMP)");
db2_exec($conn, "CREATE TABLE targ (c1 INT, c2 TIMESTAMP)");
// If you insert NULL as the timestamp into the src table, the later insert
// will NOT work.
db2_exec($conn, "INSERT INTO src VALUES (NULL, '1981-05-13 12:56:46.000000')");
db2_exec($conn, "INSERT INTO src VALUES (1, NULL)");
db2_exec($conn, "INSERT INTO src VALUES (1, '1981-05-13 12:56:46.000000')");
$rs = db2_exec($conn, "SELECT c1, c2 FROM src ORDER BY c2");
$prep = db2_prepare ($conn, "INSERT INTO targ VALUES (?, ?)");
echo "Transfering data from src table to targ table:\n";
while($valuesOut = db2_fetch_array($rs)) {
$rs1 = db2_execute($prep, $valuesOut);
if (!$rs1) {
echo "Error inserting into targ \n";
var_dump($valuesOut);
exit;
}
}
echo "Values from src table:\n";
$rs = db2_exec($conn, "SELECT c1, c2 FROM src ORDER BY c2");
while($valuesOut = db2_fetch_array($rs)) {
var_dump($valuesOut);
}
echo "Values from targ table:\n";
$rs = db2_exec($conn, "SELECT c1, c2 FROM targ ORDER BY c2");
while($valuesOut = db2_fetch_array($rs)) {
var_dump($valuesOut);
}
db2_close($conn);
?>
--EXPECTF--
Transfering data from src table to targ table:
Values from src table:
array(2) {
[0]=>
NULL
[1]=>
string(26) "1981-05-13-12.56.46.000000"
}
array(2) {
[0]=>
int(1)
[1]=>
string(26) "1981-05-13-12.56.46.000000"
}
array(2) {
[0]=>
int(1)
[1]=>
NULL
}
Values from targ table:
array(2) {
[0]=>
NULL
[1]=>
string(26) "1981-05-13-12.56.46.000000"
}
array(2) {
[0]=>
int(1)
[1]=>
string(26) "1981-05-13-12.56.46.000000"
}
array(2) {
[0]=>
int(1)
[1]=>
NULL
}

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -0,0 +1,12 @@
--TEST--
IBM-DB2: 1.9.7 - IBM i
--SKIPIF--
<?php require_once('skipifTBD.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
echo 'TBD';
?>
--EXPECTF--
TBD

View File

@@ -1,7 +1,7 @@
--TEST--
IBM-DB2: CLOB, special character test.
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipif3.inc'); ?>
--FILE--
<?php

View File

@@ -1,5 +1,7 @@
--TEST--
IBM-DB2: check for connect deallocator functioning to rollback and disconnect if there is any active transaction
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');

Some files were not shown because too many files have changed in this diff Show More