From: Chris Jaekl Date: Sat, 11 Jun 2016 14:18:10 +0000 (+0900) Subject: Add DbDriver, with support for a few popular JDBC drivers. X-Git-Url: https://jaekl.net/gitweb/?a=commitdiff_plain;h=63163502c2d86fad43c38ae4041c8bf4b2e4b387;p=squelch.git Add DbDriver, with support for a few popular JDBC drivers. --- diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..217e069 --- /dev/null +++ b/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..4e22322 --- /dev/null +++ b/.project @@ -0,0 +1,14 @@ + + + squelch + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b9c7142 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +#Sat Jun 11 21:03:12 JST 2016 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 diff --git a/README b/README index a6ab058..2a4b641 100644 --- a/README +++ b/README @@ -1,7 +1,11 @@ SQueLch This is a simple console-based SQL client. -It is database-agnostic, and should work with any database for which you have a JDBC driver. + +It is database-agnostic. Support for PostgreSQL is built-in, and +MS SQL Server, MySQL and Oracle should work so long as you have the +relevant JDBC driver .jar in your CLASSPATH. If you want to add +support for a different database, see net.jaekl.db.DbDriver for details. To build it: @@ -16,17 +20,23 @@ For example: $ java -jar squelch.jar -u chris -p passwordGoesHere -r postgresql:localhost/cfb -Note that it's more secure to put your password in a config file instead, for example: +Note that it's more secure to put your password in a config file instead, +for example: $ cat >config.properties db.user=chris db.password=passwordGoesHere db.url=postgresql:localhost/cfb ^D - $ java -jar squelch.jar --config config.properties + $ java -jar squelch.jar --config ./config.properties + +The code is available under the GNU General Public Licence (GPL) version 3, +or (at your option) any later version. See the file COPYING for details. + +Note that this code, like Isaac Newton, stands on the shoulders of giants; +it uses libraries from several other projects. Their licence terms are +reproduced in the file THIRD_PARTY. -The code is available under the GNU General Public Licence (GPL) version 3, or (at your option) any later version. -See the file COPYING for details. *> Chris Jaekl https://www.jaekl.net/chris/ diff --git a/THIRD_PARTY b/THIRD_PARTY new file mode 100644 index 0000000..7c37b02 --- /dev/null +++ b/THIRD_PARTY @@ -0,0 +1,575 @@ +=========================================================================== +Other terms and conditions +=========================================================================== + +Portions of this software (libraries) were developed by other people, +and are subject to the licence terms that those people chose. + +--------------------------------------------------------------------------- +PostgreSQL JDBC Driver + +Copyright (c) 1997-2011, PostgreSQL Global Development Group +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +3. Neither the name of the PostgreSQL Global Development Group nor the names + of its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +--------------------------------------------------------------------------- +JLine2 + +Copyright (c) 2016, JLine2 Members and Contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +--------------------------------------------------------------------------- +JaCoco + + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. +JaCoCo 0.7.8.201606060656 Copyright © 2009, 2016 Mountainminds GmbH & Co. KG and Contributors + +Trademarks + +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both. Eclipse and all Eclipse related trademarks and logos are trademarks of the Eclipse Foundation, Inc. OSGi is a trademark, registered trademark, or service mark of The OSGi Alliance in the US and other countries. Apache Ant and Apache Maven are trademarks of the Apache Software Foundation. Android and Dalvik are trademarks of Google Inc. All other trademarks are the property of their respective owners. +Third Party Content + +The Content includes items that have been sourced from third parties as set out below. +ASM + +ASM is subject to the terms and conditions of the following license: + +Copyright (c) 2012 France Télécom +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + +Google Code Prettify + +Google Code Prettify is subject to the terms and conditions of the following license: + + 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) 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. + +-------------------------------------------------------------------------- +Apache Commons (cli and collections) + + 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/pom.xml b/pom.xml index bd89ae1..9f797a4 100644 --- a/pom.xml +++ b/pom.xml @@ -130,5 +130,11 @@ 4.0 test + + + org.postgresql + postgresql + 9.4.1208.jre7 + diff --git a/src/main/java/net/jaekl/squelch/Args.java b/src/main/java/net/jaekl/squelch/Args.java index 9052734..f48012a 100644 --- a/src/main/java/net/jaekl/squelch/Args.java +++ b/src/main/java/net/jaekl/squelch/Args.java @@ -19,6 +19,7 @@ public class Args { private static final String DB_PASSWORD = "db.password"; private static final String DB_USER = "db.user"; private static final String DEFAULT_CONFIG_FILENAME = "config.properties"; + public static final String DEFAULT_JDBC_URL = "jdbc:postgresql:postgres"; // default PostgreSQL database private String m_className; // name of the main class that launches this program private boolean m_help; @@ -29,7 +30,7 @@ public class Args { public Args(String className) { m_className = className; m_help = false; - m_url = ""; + m_url = DEFAULT_JDBC_URL; m_pass = ""; m_user = ""; } @@ -60,7 +61,7 @@ public class Args { String configFilename = (line.hasOption("c")) ? (line.getOptionValue("c")) : (DEFAULT_CONFIG_FILENAME); File configFile = FileUtil.getInst().newFile(configFilename); - if (configFile.canRead()) { + if (line.hasOption("c") || configFile.canRead()) { readConfigFile(configFile); } diff --git a/src/main/java/net/jaekl/squelch/Squelch.java b/src/main/java/net/jaekl/squelch/Squelch.java index 5985338..383b541 100644 --- a/src/main/java/net/jaekl/squelch/Squelch.java +++ b/src/main/java/net/jaekl/squelch/Squelch.java @@ -2,8 +2,15 @@ package net.jaekl.squelch; import java.io.IOException; import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.SQLException; import java.util.Locale; +import net.jaekl.squelch.db.DbDriver; +import net.jaekl.squelch.db.MsSqlDriver; +import net.jaekl.squelch.db.MySqlDriver; +import net.jaekl.squelch.db.OracleDriver; +import net.jaekl.squelch.db.PostgresqlDriver; import net.jaekl.squelch.stmt.Select; import net.jaekl.squelch.stmt.Stmt; import net.jaekl.squelch.util.ConsoleInput; @@ -12,24 +19,35 @@ import net.jaekl.squelch.util.ConsoleUtil; public class Squelch { static final String PROMPT = "> "; + private static final DbDriver[] DB_DRIVERS = { + new MsSqlDriver(), + new MySqlDriver(), + new OracleDriver(), + new PostgresqlDriver() + }; private static final Stmt[] READ_ONLY_STATEMENTS = { new Select() }; + private Args m_args; private Stmt[] m_statements; public Squelch() { + m_args = new Args(this.getClass().getName()); m_statements = READ_ONLY_STATEMENTS; } - public void doMain(String[] args) + public void doMain(String[] params) { - ConsoleInputImpl ci; try (PrintWriter pw = new PrintWriter(System.out)) { - ci = ConsoleUtil.getInst().getInput(); + if (!m_args.parseArgs(pw, params)) { + return; + } + + ConsoleInputImpl ci = ConsoleUtil.getInst().getInput(); pumpLines(pw, ci); - } catch (IOException e) { + } catch (IOException | ClassNotFoundException | SQLException | SquelchException e) { e.printStackTrace(); } } @@ -38,31 +56,8 @@ public class Squelch { new Squelch().doMain(args); } - void pumpLines(PrintWriter pw, ConsoleInput ci) throws IOException { - String line = null; - while (true) { - boolean processed = false; - line = ci.readLine(PROMPT); - - for (Stmt statement : m_statements) { - if (statement.handles(line)) { - //statement.exec(conn, pw, line); - processed = true; - break; - } - } - - if ((!processed)) { - if (isQuit(line)) { - break; - } - // Unrecognized command - pw.println("??? \"" + line + "\""); - } - } - } - - boolean isQuit(String line) { + boolean isQuit(String line) + { if ((null == line)) { return true; } @@ -80,4 +75,50 @@ public class Squelch { } return false; } + + Connection getConnection() throws ClassNotFoundException, SQLException, SquelchException + { + String jdbcUrl = m_args.getUrl(); + DbDriver driver = getDriverFor(jdbcUrl); + + return driver.connect(jdbcUrl, m_args.getUser(), m_args.getPass()); + } + + DbDriver getDriverFor(String jdbcUrl) throws SquelchException + { + for (DbDriver driver : DB_DRIVERS) { + if (driver.handles(jdbcUrl)) { + return driver; + } + } + throw new SquelchException("Cannot determine DB Driver for JDBC URL: \"" + jdbcUrl + "\"."); + } + + void pumpLines(PrintWriter pw, ConsoleInput ci) throws IOException, ClassNotFoundException, SQLException, SquelchException + { + String line = null; + try (Connection conn = getConnection()) + { + while (true) { + boolean processed = false; + line = ci.readLine(PROMPT); + + for (Stmt statement : m_statements) { + if (statement.handles(line)) { + statement.exec(conn, pw, line); + processed = true; + break; + } + } + + if ((!processed)) { + if (isQuit(line)) { + break; + } + // Unrecognized command + pw.println("??? \"" + line + "\""); + } + } + } + } } diff --git a/src/main/java/net/jaekl/squelch/SquelchException.java b/src/main/java/net/jaekl/squelch/SquelchException.java new file mode 100644 index 0000000..e23150e --- /dev/null +++ b/src/main/java/net/jaekl/squelch/SquelchException.java @@ -0,0 +1,9 @@ +package net.jaekl.squelch; + +public class SquelchException extends Exception { + private static final long serialVersionUID = 1L; + + public SquelchException(String msg) { + super(msg); + } +} diff --git a/src/main/java/net/jaekl/squelch/db/DbDriver.java b/src/main/java/net/jaekl/squelch/db/DbDriver.java new file mode 100644 index 0000000..5e73885 --- /dev/null +++ b/src/main/java/net/jaekl/squelch/db/DbDriver.java @@ -0,0 +1,20 @@ +package net.jaekl.squelch.db; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public abstract class DbDriver { + // Returns true iff. this DbDriver knows how to connect to the given JDBC URL + abstract public boolean handles(String jdbcUrl); + + // Execute line as a statement of this type + abstract String getJdbcDriverClassName(); + + // Open a new Connection to the database. Note that the caller must close() this at some point. + public Connection connect(String jdbcUrl, String userName, String password) throws ClassNotFoundException, SQLException + { + Class.forName(getJdbcDriverClassName()); + return DriverManager.getConnection(jdbcUrl, userName, password); + } +} diff --git a/src/main/java/net/jaekl/squelch/db/MsSqlDriver.java b/src/main/java/net/jaekl/squelch/db/MsSqlDriver.java new file mode 100644 index 0000000..6d604bf --- /dev/null +++ b/src/main/java/net/jaekl/squelch/db/MsSqlDriver.java @@ -0,0 +1,18 @@ +package net.jaekl.squelch.db; + +public class MsSqlDriver extends DbDriver { + + @Override + public boolean handles(String jdbcUrl) { + if (null == jdbcUrl) { + return false; + } + return jdbcUrl.trim().startsWith("jdbc:sqlserver:"); + } + + @Override + String getJdbcDriverClassName() { + return "com.microsoft.sqlserver.jdbc.sqlserverdriver"; + } + +} diff --git a/src/main/java/net/jaekl/squelch/db/MySqlDriver.java b/src/main/java/net/jaekl/squelch/db/MySqlDriver.java new file mode 100644 index 0000000..e1bff1c --- /dev/null +++ b/src/main/java/net/jaekl/squelch/db/MySqlDriver.java @@ -0,0 +1,18 @@ +package net.jaekl.squelch.db; + +public class MySqlDriver extends DbDriver { + + @Override + public boolean handles(String jdbcUrl) { + if (null == jdbcUrl) { + return false; + } + return jdbcUrl.trim().startsWith("jdbc:mysql:"); + } + + @Override + String getJdbcDriverClassName() { + return "com.mysql.jdbc.Driver"; + } + +} diff --git a/src/main/java/net/jaekl/squelch/db/OracleDriver.java b/src/main/java/net/jaekl/squelch/db/OracleDriver.java new file mode 100644 index 0000000..ab82051 --- /dev/null +++ b/src/main/java/net/jaekl/squelch/db/OracleDriver.java @@ -0,0 +1,19 @@ +package net.jaekl.squelch.db; + +public class OracleDriver extends DbDriver { + + @Override + public boolean handles(String jdbcUrl) { + if (null == jdbcUrl) { + return false; + } + String trimmed = jdbcUrl.trim(); + + return trimmed.startsWith("jdbc:oracle:thin:@") || trimmed.startsWith("jdbc:oracle:oci:@"); + } + + @Override + String getJdbcDriverClassName() { + return "oracle.jdbc.driver.OracleDriver"; + } +} diff --git a/src/main/java/net/jaekl/squelch/db/PostgresqlDriver.java b/src/main/java/net/jaekl/squelch/db/PostgresqlDriver.java new file mode 100644 index 0000000..9020064 --- /dev/null +++ b/src/main/java/net/jaekl/squelch/db/PostgresqlDriver.java @@ -0,0 +1,17 @@ +package net.jaekl.squelch.db; + +public class PostgresqlDriver extends DbDriver { + + @Override + public boolean handles(String jdbcUrl) { + if (null == jdbcUrl) { + return false; + } + return jdbcUrl.trim().startsWith("jdbc:postgresql:"); + } + + @Override + public String getJdbcDriverClassName() { + return "org.postgresql.Driver"; + } +} diff --git a/src/main/java/net/jaekl/squelch/stmt/Select.java b/src/main/java/net/jaekl/squelch/stmt/Select.java index 6d89af5..088181a 100644 --- a/src/main/java/net/jaekl/squelch/stmt/Select.java +++ b/src/main/java/net/jaekl/squelch/stmt/Select.java @@ -61,20 +61,28 @@ public class Select extends Query { ResultSetMetaData metaData = rs.getMetaData(); int rowCount = 0; Column[] cols = getColumns(metaData); - - pw.println("----------------------------------"); + StringBuilder sb = new StringBuilder(); + sb.append("----------------------------------\n"); for (int idx = 1; idx <= cols.length; ++idx) { - pw.print("|" + cols[idx - 1].getLabel()); + sb.append("|" + cols[idx - 1].getLabel()); } - pw.println("|"); + sb.append("|\n"); + String header = sb.toString(); while (rs.next()) { + if (null != header) { + pw.print(header); + header = null; + } + for (int idx = 1; idx <= cols.length; ++idx) { pw.print("|" + rs.getObject(idx)); } pw.println("|"); } - pw.println("----------------------------------"); + if (rowCount > 0) { + pw.println("----------------------------------"); + } pw.println("" + rowCount + " row(s) returned."); return rowCount; diff --git a/src/test/java/net/jaekl/squelch/ArgsTest.java b/src/test/java/net/jaekl/squelch/ArgsTest.java index 1b312c1..68128d2 100644 --- a/src/test/java/net/jaekl/squelch/ArgsTest.java +++ b/src/test/java/net/jaekl/squelch/ArgsTest.java @@ -40,7 +40,7 @@ public class ArgsTest result = runWithParams(noParams); assertTrue(result.getRetVal()); assertEquals(false, result.getArgs().isHelp()); - assertEquals("", result.getArgs().getUrl()); + assertEquals(Args.DEFAULT_JDBC_URL, result.getArgs().getUrl()); assertEquals("", result.getArgs().getUser()); assertEquals("", result.getArgs().getPass()); assertEquals("", result.getStdout()); @@ -49,7 +49,7 @@ public class ArgsTest result = runWithParams(helpOnly); assertTrue(result.getRetVal()); assertEquals(true, result.getArgs().isHelp()); - assertEquals("", result.getArgs().getUrl()); + assertEquals(Args.DEFAULT_JDBC_URL, result.getArgs().getUrl()); assertEquals("", result.getArgs().getUser()); assertEquals("", result.getArgs().getPass()); validateUsageMessage(result.getStdout()); @@ -67,14 +67,14 @@ public class ArgsTest result = runWithParams(invalid); assertFalse(result.getRetVal()); assertEquals(false, result.getArgs().isHelp()); - assertEquals("", result.getArgs().getUrl()); + assertEquals(Args.DEFAULT_JDBC_URL, result.getArgs().getUrl()); assertEquals("", result.getArgs().getUser()); assertEquals("", result.getArgs().getPass()); validateUsageMessage(result.getStdout()); } @Test - public void test_configFile() throws IOException + public void test_configFile_success() throws IOException { final String CONFIG_FILE_NAME = "configFileName"; final String SIMPLE_CONTENT = "db.user=fred\n" @@ -96,7 +96,25 @@ public class ArgsTest assertEquals("fred", result.getArgs().getUser()); assertEquals("p455w0rd", result.getArgs().getPass()); assertEquals("", result.getStdout()); + } + + @Test + public void test_configFile_notReadable() + { + final String CONFIG_FILE_NAME = "configFileName"; + FileUtilMock.mock_setInst(); + FileMock configFileMock = FileUtilMock.mock_getInst().mock_newFile(CONFIG_FILE_NAME); + FileUtilMock.mock_getInst().mock_setReadable(configFileMock, false); + + String[] params = { "-c", CONFIG_FILE_NAME }; + try { + runWithParams(params); + fail("Should have thrown an IOException"); + } + catch (IOException exc) { + // This is the success path + } } // We expect the stdout string to contain a usage message. diff --git a/src/test/java/net/jaekl/squelch/SquelchTest.java b/src/test/java/net/jaekl/squelch/SquelchTest.java index 5a5c470..fc12402 100644 --- a/src/test/java/net/jaekl/squelch/SquelchTest.java +++ b/src/test/java/net/jaekl/squelch/SquelchTest.java @@ -3,18 +3,90 @@ package net.jaekl.squelch; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; +import java.sql.Connection; +import java.sql.SQLException; +import net.jaekl.squelch.db.ConnectionMock; +import net.jaekl.squelch.db.DbDriver; +import net.jaekl.squelch.db.MsSqlDriver; +import net.jaekl.squelch.db.MySqlDriver; +import net.jaekl.squelch.db.OracleDriver; +import net.jaekl.squelch.db.PostgresqlDriver; import net.jaekl.squelch.util.ConsoleInputMock; import org.junit.Test; public class SquelchTest { + private class NoDbMock extends Squelch { + private ConnectionMock m_conn; + + public NoDbMock() { + m_conn = new ConnectionMock(); + } + + @Override + Connection getConnection() throws ClassNotFoundException, SQLException, SquelchException + { + return m_conn; + } + + public ConnectionMock mock_getConnectionMock() + { + return m_conn; + } + } + + @Test + public void test_getDriverFor_success() throws SquelchException { + Squelch squelch = new Squelch(); + + Object[][] data = { + { "jdbc:sqlserver://HOST:1433;DatabaseName=DATABASE", MsSqlDriver.class }, + { "jdbc:mysql://HOST/DATABASE", MySqlDriver.class }, + { "jdbc:mysql://HOST:5150/DATABASE", MySqlDriver.class }, + { "jdbc:oracle:thin:@//localhost:1521/XE", OracleDriver.class }, + { "jdbc:oracle:thin:@neptune.acme.com:1521:T10A", OracleDriver.class }, + { "jdbc:oracle:thin:@127.0.0.1:1521:T10A", OracleDriver.class }, + { "jdbc:oracle:oci:@TEST", OracleDriver.class }, + { "jdbc:oracle:oci:@192.168.1.1:1521/XE", OracleDriver.class }, + { "jdbc:postgresql://HOST/DATABASE", PostgresqlDriver.class } + }; + + for (Object[] datum : data) { + String jdbcUrl = (String)datum[0]; + + @SuppressWarnings("unchecked") + Class expected = (Class)datum[1]; + + DbDriver actual = squelch.getDriverFor(jdbcUrl); + + assertEquals(expected, actual.getClass()); + } + } + + @Test + public void test_getDriverFor_notFound() + { + String[] data = { null, "bogus:host/user/pass", "The quick brown fox jumps over the lazy dog" }; + Squelch squelch = new Squelch(); + + for (String datum : data) { + try { + squelch.getDriverFor(datum); + fail("Should have thrown a SquelchException"); + } + catch (SquelchException exc) { + ; // This is the success path. + } + } + } @Test public void test_isQuit() { @@ -38,8 +110,9 @@ public class SquelchTest { } @Test - public void test_pumpLines() throws IOException { - Squelch squelch = new Squelch(); + public void test_pumpLines() throws IOException, ClassNotFoundException, SQLException, SquelchException + { + Squelch squelch = new NoDbMock(); String consoleOutput; String[] noLines = {}; @@ -58,7 +131,23 @@ public class SquelchTest { consoleOutput); } - private String runPump(Squelch squelch, String[] lines) throws IOException + @Test + public void test_pumpLines_withSelect() throws ClassNotFoundException, IOException, SQLException, SquelchException + { + NoDbMock squelch = new NoDbMock(); + String consoleOutput; + + String[] simpleSelect = { "SELECT * FROM Fred WHERE wife='Wilma';", "QUIT" }; + consoleOutput = runPump(squelch, simpleSelect); + assertEquals( Squelch.PROMPT + simpleSelect[0] + "\n" + + "0 row(s) returned.\n" + + Squelch.PROMPT + simpleSelect[1] + "\n", consoleOutput); + + ConnectionMock cm = squelch.mock_getConnectionMock(); + assertTrue(cm.mock_queryWasExecuted(simpleSelect[0])); + } + + private String runPump(Squelch squelch, String[] lines) throws IOException, ClassNotFoundException, SQLException, SquelchException { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/src/test/java/net/jaekl/squelch/db/ConnectionMock.java b/src/test/java/net/jaekl/squelch/db/ConnectionMock.java new file mode 100644 index 0000000..e242e00 --- /dev/null +++ b/src/test/java/net/jaekl/squelch/db/ConnectionMock.java @@ -0,0 +1,383 @@ +package net.jaekl.squelch.db; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.ArrayList; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +public class ConnectionMock implements Connection { + private ArrayList m_executedQueries; + + public ConnectionMock() { + m_executedQueries = new ArrayList(); + } + + public ResultSetMock mock_executeQuery(PreparedStatementMock psm) + { + m_executedQueries.add(psm.toString()); + return new ResultSetMock(); + } + + public boolean mock_queryWasExecuted(String sql) { + // There's an assumption here that we don't try a large number of queries in a single test. + // If that assumption is false, then we should change this to be more efficient. + return m_executedQueries.contains(sql); + } + + @Override + public boolean isWrapperFor(Class arg0) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public T unwrap(Class arg0) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void abort(Executor executor) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void clearWarnings() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void close() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void commit() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public Array createArrayOf(String typeName, Object[] elements) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Blob createBlob() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Clob createClob() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public NClob createNClob() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public SQLXML createSQLXML() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Statement createStatement() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Statement createStatement(int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Struct createStruct(String typeName, Object[] attributes) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean getAutoCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getCatalog() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Properties getClientInfo() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getClientInfo(String name) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getHoldability() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public DatabaseMetaData getMetaData() throws SQLException { + DatabaseMetaData result = new DatabaseMetaDataMock(); + return result; + } + + @Override + public int getNetworkTimeout() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getSchema() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getTransactionIsolation() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Map> getTypeMap() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public SQLWarning getWarnings() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isClosed() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isReadOnly() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isValid(int timeout) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public String nativeSQL(String sql) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallableStatement prepareCall(String sql) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql) throws SQLException { + return new PreparedStatementMock(this, sql); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void rollback() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setCatalog(String catalog) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setClientInfo(Properties properties) + throws SQLClientInfoException { + // TODO Auto-generated method stub + + } + + @Override + public void setClientInfo(String name, String value) + throws SQLClientInfoException { + // TODO Auto-generated method stub + + } + + @Override + public void setHoldability(int holdability) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public Savepoint setSavepoint() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Savepoint setSavepoint(String name) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setSchema(String schema) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + // TODO Auto-generated method stub + + } + +} + diff --git a/src/test/java/net/jaekl/squelch/db/DatabaseMetaDataMock.java b/src/test/java/net/jaekl/squelch/db/DatabaseMetaDataMock.java new file mode 100644 index 0000000..8f9abcd --- /dev/null +++ b/src/test/java/net/jaekl/squelch/db/DatabaseMetaDataMock.java @@ -0,0 +1,1103 @@ +package net.jaekl.squelch.db; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.RowIdLifetime; +import java.sql.SQLException; + +import net.jaekl.squelch.db.ResultSetMock; + +public class DatabaseMetaDataMock implements DatabaseMetaData { + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public T unwrap(Class iface) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean allProceduresAreCallable() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean allTablesAreSelectable() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean autoCommitFailureClosesAllResultSets() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean dataDefinitionCausesTransactionCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean dataDefinitionIgnoredInTransactions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deletesAreDetected(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean generatedKeyAlwaysReturned() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public ResultSet getAttributes(String catalog, String schemaPattern, + String typeNamePattern, String attributeNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getBestRowIdentifier(String catalog, String schema, + String table, int scope, boolean nullable) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCatalogSeparator() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCatalogTerm() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getCatalogs() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getClientInfoProperties() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getColumnPrivileges(String catalog, String schema, + String table, String columnNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getColumns(String catalog, String schemaPattern, + String tableNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Connection getConnection() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getCrossReference(String parentCatalog, + String parentSchema, String parentTable, String foreignCatalog, + String foreignSchema, String foreignTable) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getDatabaseMajorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDatabaseMinorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getDatabaseProductName() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDatabaseProductVersion() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getDefaultTransactionIsolation() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDriverMajorVersion() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDriverMinorVersion() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getDriverName() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDriverVersion() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getExportedKeys(String catalog, String schema, String table) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getExtraNameCharacters() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getFunctionColumns(String catalog, String schemaPattern, + String functionNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getFunctions(String catalog, String schemaPattern, + String functionNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getIdentifierQuoteString() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getImportedKeys(String catalog, String schema, String table) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getIndexInfo(String catalog, String schema, String table, + boolean unique, boolean approximate) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getJDBCMajorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getJDBCMinorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxBinaryLiteralLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxCatalogNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxCharLiteralLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInGroupBy() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInIndex() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInOrderBy() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInSelect() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInTable() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxConnections() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxCursorNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxIndexLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxProcedureNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxRowSize() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxSchemaNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxStatementLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxStatements() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxTableNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxTablesInSelect() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxUserNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getNumericFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getPrimaryKeys(String catalog, String schema, String table) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getProcedureColumns(String catalog, String schemaPattern, + String procedureNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getProcedureTerm() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getProcedures(String catalog, String schemaPattern, + String procedureNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getPseudoColumns(String catalog, String schemaPattern, + String tableNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getResultSetHoldability() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public RowIdLifetime getRowIdLifetime() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getSQLKeywords() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getSQLStateType() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getSchemaTerm() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSchemas() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSchemas(String catalog, String schemaPattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getSearchStringEscape() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getStringFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSuperTables(String catalog, String schemaPattern, + String tableNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSuperTypes(String catalog, String schemaPattern, + String typeNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getSystemFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTablePrivileges(String catalog, String schemaPattern, + String tableNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTableTypes() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) + throws SQLException + { + ResultSetMock result = new ResultSetMock(); + return result; + } + + @Override + public String getTimeDateFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTypeInfo() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getUDTs(String catalog, String schemaPattern, + String typeNamePattern, int[] types) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getURL() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getUserName() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getVersionColumns(String catalog, String schema, + String table) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean insertsAreDetected(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isCatalogAtStart() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isReadOnly() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean locatorsUpdateCopy() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullPlusNonNullIsNull() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedAtEnd() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedAtStart() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedHigh() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedLow() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean othersDeletesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean othersInsertsAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean othersUpdatesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean ownDeletesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean ownInsertsAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean ownUpdatesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesLowerCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesMixedCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesUpperCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsANSI92EntryLevelSQL() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsANSI92FullSQL() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsANSI92IntermediateSQL() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsAlterTableWithAddColumn() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsAlterTableWithDropColumn() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsBatchUpdates() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInDataManipulation() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInIndexDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInProcedureCalls() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInTableDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsColumnAliasing() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsConvert() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsConvert(int fromType, int toType) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCoreSQLGrammar() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCorrelatedSubqueries() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsDataDefinitionAndDataManipulationTransactions() + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsDataManipulationTransactionsOnly() + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsDifferentTableCorrelationNames() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsExpressionsInOrderBy() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsExtendedSQLGrammar() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsFullOuterJoins() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGetGeneratedKeys() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGroupBy() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGroupByBeyondSelect() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGroupByUnrelated() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsIntegrityEnhancementFacility() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsLikeEscapeClause() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsLimitedOuterJoins() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMinimumSQLGrammar() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMixedCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMultipleOpenResults() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMultipleResultSets() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMultipleTransactions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsNamedParameters() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsNonNullableColumns() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenCursorsAcrossCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenCursorsAcrossRollback() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenStatementsAcrossCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenStatementsAcrossRollback() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOrderByUnrelated() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOuterJoins() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsPositionedDelete() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsPositionedUpdate() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsResultSetConcurrency(int type, int concurrency) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsResultSetHoldability(int holdability) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsResultSetType(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSavepoints() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInDataManipulation() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInIndexDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInProcedureCalls() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInTableDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSelectForUpdate() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsStatementPooling() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsStoredProcedures() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInComparisons() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInExists() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInIns() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInQuantifieds() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsTableCorrelationNames() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsTransactionIsolationLevel(int level) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsTransactions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsUnion() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsUnionAll() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updatesAreDetected(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean usesLocalFilePerTable() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean usesLocalFiles() throws SQLException { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/test/java/net/jaekl/squelch/db/PreparedStatementMock.java b/src/test/java/net/jaekl/squelch/db/PreparedStatementMock.java new file mode 100644 index 0000000..9967728 --- /dev/null +++ b/src/test/java/net/jaekl/squelch/db/PreparedStatementMock.java @@ -0,0 +1,656 @@ +package net.jaekl.squelch.db; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.Date; +import java.sql.NClob; +import java.sql.ParameterMetaData; +import java.sql.PreparedStatement; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; + +public class PreparedStatementMock implements PreparedStatement { + private ArrayList m_args; + private boolean m_closed; + private ConnectionMock m_conn; + private String m_sql; + + public PreparedStatementMock(ConnectionMock conn, String sql) + { + m_args = new ArrayList(); + m_closed = false; + m_conn = conn; + m_sql = sql; + } + + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(m_sql); + + for (Object arg : m_args) { + sb.append("[" + arg + "]"); + } + + return sb.toString(); + } + + @Override + public void addBatch(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void cancel() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void clearBatch() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void close() throws SQLException { + m_closed = true; + } + + @Override + public void closeOnCompletion() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public boolean execute(String arg0) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public boolean execute(String arg0, int arg1) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public boolean execute(String arg0, int[] arg1) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public boolean execute(String arg0, String[] arg1) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public int[] executeBatch() throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public ResultSet executeQuery(String arg0) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public int executeUpdate(String arg0) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public int executeUpdate(String arg0, int arg1) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public int executeUpdate(String arg0, int[] arg1) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public int executeUpdate(String arg0, String[] arg1) throws SQLException { + assert(! m_closed); + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public Connection getConnection() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public ResultSet getGeneratedKeys() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getMaxRows() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean getMoreResults() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean getMoreResults(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public ResultSet getResultSet() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getResultSetConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getResultSetHoldability() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getResultSetType() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public int getUpdateCount() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean isCloseOnCompletion() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean isPoolable() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setCursorName(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setEscapeProcessing(boolean arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setFetchDirection(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setFetchSize(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setMaxFieldSize(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setMaxRows(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setPoolable(boolean arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setQueryTimeout(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean isWrapperFor(Class arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public T unwrap(Class arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void addBatch() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void clearParameters() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public boolean execute() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public ResultSet executeQuery() throws SQLException { + assert(! m_closed); + return m_conn.mock_executeQuery(this); + } + + @Override + public int executeUpdate() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public ParameterMetaData getParameterMetaData() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setArray(int arg0, Array arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setAsciiStream(int arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setAsciiStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setAsciiStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBigDecimal(int arg0, BigDecimal arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBinaryStream(int arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBinaryStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBinaryStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBlob(int arg0, Blob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBlob(int arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBlob(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBoolean(int arg0, boolean arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setByte(int arg0, byte arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setBytes(int arg0, byte[] arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setCharacterStream(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setCharacterStream(int arg0, Reader arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setClob(int arg0, Clob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setClob(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setClob(int arg0, Reader arg1, long arg2) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setDate(int arg0, Date arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setDate(int arg0, Date arg1, Calendar arg2) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setDouble(int arg0, double arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setFloat(int arg0, float arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setInt(int arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setLong(int arg0, long arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNCharacterStream(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNClob(int arg0, NClob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNClob(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNClob(int arg0, Reader arg1, long arg2) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNString(int arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNull(int arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setNull(int arg0, int arg1, String arg2) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setObject(int arg0, Object arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setObject(int arg0, Object arg1, int arg2) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setObject(int arg0, Object arg1, int arg2, int arg3) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setRef(int arg0, Ref arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setRowId(int arg0, RowId arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setSQLXML(int arg0, SQLXML arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setShort(int arg0, short arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setString(int arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setTime(int arg0, Time arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setTime(int arg0, Time arg1, Calendar arg2) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setTimestamp(int arg0, Timestamp arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setTimestamp(int arg0, Timestamp arg1, Calendar arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setURL(int arg0, URL arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + + @Override + public void setUnicodeStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented"); + + } + +} diff --git a/src/test/java/net/jaekl/squelch/db/ResultSetMetaDataMock.java b/src/test/java/net/jaekl/squelch/db/ResultSetMetaDataMock.java new file mode 100644 index 0000000..f1969ec --- /dev/null +++ b/src/test/java/net/jaekl/squelch/db/ResultSetMetaDataMock.java @@ -0,0 +1,153 @@ +package net.jaekl.squelch.db; + +import java.sql.ResultSetMetaData; +import java.sql.SQLException; + +import net.jaekl.squelch.sql.Column; + +public class ResultSetMetaDataMock implements ResultSetMetaData { + private Column[] m_cols; + + public ResultSetMetaDataMock() + { + m_cols = new Column[0]; + } + + @Override + public boolean isWrapperFor(Class arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T unwrap(Class arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getCatalogName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnClassName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getColumnCount() throws SQLException { + return m_cols.length; + } + + @Override + public int getColumnDisplaySize(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnLabel(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getColumnType(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnTypeName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getPrecision(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getScale(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getSchemaName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getTableName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isAutoIncrement(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isCaseSensitive(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isCurrency(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isDefinitelyWritable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int isNullable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isReadOnly(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isSearchable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isSigned(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isWritable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + +} diff --git a/src/test/java/net/jaekl/squelch/db/ResultSetMock.java b/src/test/java/net/jaekl/squelch/db/ResultSetMock.java new file mode 100644 index 0000000..5c7be5d --- /dev/null +++ b/src/test/java/net/jaekl/squelch/db/ResultSetMock.java @@ -0,0 +1,1214 @@ +package net.jaekl.squelch.db; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Map; + +public class ResultSetMock implements ResultSet { + private ResultSetMetaDataMock m_metaDataMock; + + public ResultSetMock() { + m_metaDataMock = new ResultSetMetaDataMock(); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean absolute(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void close() throws SQLException { + // no-op + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int findColumn(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Array getArray(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Array getArray(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getAsciiStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getAsciiStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public BigDecimal getBigDecimal(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public BigDecimal getBigDecimal(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public BigDecimal getBigDecimal(int arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public BigDecimal getBigDecimal(String arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getBinaryStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getBinaryStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Blob getBlob(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Blob getBlob(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean getBoolean(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean getBoolean(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte getByte(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte getByte(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte[] getBytes(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte[] getBytes(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Reader getCharacterStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Reader getCharacterStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Clob getClob(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Clob getClob(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(int arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(String arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public double getDouble(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public double getDouble(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getFetchDirection() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getFetchSize() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public float getFloat(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public float getFloat(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getInt(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getInt(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public long getLong(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public long getLong(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + return m_metaDataMock; + } + + @Override + public Reader getNCharacterStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Reader getNCharacterStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public NClob getNClob(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public NClob getNClob(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getNString(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getNString(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(int arg0, Map> arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(String arg0, Map> arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T getObject(int arg0, Class arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T getObject(String arg0, Class arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Ref getRef(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Ref getRef(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public RowId getRowId(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public RowId getRowId(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public SQLXML getSQLXML(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public SQLXML getSQLXML(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public short getShort(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public short getShort(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getString(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getString(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(int arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(String arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(int arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(String arg0, Calendar arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public URL getURL(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public URL getURL(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public InputStream getUnicodeStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public InputStream getUnicodeStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean next() throws SQLException { + return false; + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean relative(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void setFetchDirection(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void setFetchSize(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateArray(int arg0, Array arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateArray(String arg0, Array arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(int arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(String arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(String arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(String arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBigDecimal(int arg0, BigDecimal arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBigDecimal(String arg0, BigDecimal arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(int arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(String arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(String arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(String arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(int arg0, Blob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(String arg0, Blob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(int arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(String arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(String arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBoolean(int arg0, boolean arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBoolean(String arg0, boolean arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateByte(int arg0, byte arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateByte(String arg0, byte arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBytes(int arg0, byte[] arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBytes(String arg0, byte[] arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(int arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(String arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(int arg0, Reader arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(String arg0, Reader arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(int arg0, Clob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(String arg0, Clob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(String arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDate(int arg0, Date arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDate(String arg0, Date arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDouble(int arg0, double arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDouble(String arg0, double arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateFloat(int arg0, float arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateFloat(String arg0, float arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateInt(int arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateInt(String arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateLong(int arg0, long arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateLong(String arg0, long arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(int arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(String arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(int arg0, NClob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(String arg0, NClob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(String arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNString(int arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNString(String arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNull(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNull(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(int arg0, Object arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(String arg0, Object arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(int arg0, Object arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(String arg0, Object arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRef(int arg0, Ref arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRef(String arg0, Ref arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRowId(int arg0, RowId arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRowId(String arg0, RowId arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateShort(int arg0, short arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateShort(String arg0, short arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateString(int arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateString(String arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTime(int arg0, Time arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTime(String arg0, Time arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTimestamp(int arg0, Timestamp arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTimestamp(String arg0, Timestamp arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + +}