From: Václav Slavík Date: Wed, 13 Feb 2008 15:37:15 +0000 (+0000) Subject: removed no longer used src/iodbc directory X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/815399d5bb73387364936a85a61e33cdbfb81193 removed no longer used src/iodbc directory git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 883f6c76ba..730767ce72 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -144,19 +144,6 @@ src/regex/tests src/regex/regex.3 src/regex/regex.7 -src/iodbc/AUTHORS -src/iodbc/COPYING -src/iodbc/autoconfig -src/iodbc/Changes.log -src/iodbc/IAFA-PACKAGE -src/iodbc/INSTALL -src/iodbc/NEWS -src/iodbc/README -src/iodbc/*.c -src/iodbc/*.h -src/iodbc/*.ci -src/iodbc/*.exp - include/wx/*.h include/wx/*.inl include/wx/*.cpp diff --git a/distrib/scripts/manifests/generic.rsp b/distrib/scripts/manifests/generic.rsp index 11b68c5e5b..12ba3495ec 100644 --- a/distrib/scripts/manifests/generic.rsp +++ b/distrib/scripts/manifests/generic.rsp @@ -96,19 +96,6 @@ src/png/scripts/makefile* src/png/scripts/*.com src/png/scripts/*.def -src/iodbc/AUTHORS -src/iodbc/COPYING -src/iodbc/autoconfig -src/iodbc/Changes.log -src/iodbc/IAFA-PACKAGE -src/iodbc/INSTALL -src/iodbc/NEWS -src/iodbc/README -src/iodbc/*.c -src/iodbc/*.h -src/iodbc/*.ci -src/iodbc/*.exp - include/wx/wx_setup.vms include/wx/common/*.h include/wx/generic/*.h diff --git a/src/iodbc/AUTHORS b/src/iodbc/AUTHORS deleted file mode 100644 index 4168f05912..0000000000 --- a/src/iodbc/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Written by Ke Jin - -Additions by OpenLink Software Inc. http://www.openlinksw.com/ -Contact: Patrick van Kleef diff --git a/src/iodbc/COPYING b/src/iodbc/COPYING deleted file mode 100644 index 79d009a2fb..0000000000 --- a/src/iodbc/COPYING +++ /dev/null @@ -1,482 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - diff --git a/src/iodbc/Changes.log b/src/iodbc/Changes.log deleted file mode 100644 index e7c359f2b3..0000000000 --- a/src/iodbc/Changes.log +++ /dev/null @@ -1,67 +0,0 @@ -January 18, 1999, V2.50: - * Added autoconf/automake/libtool support - * Licensing moved to LGPL - * Added OpenLink code enhancements and bug fixes - ------------------------------------------------------------------------- -Original Changelog from Ke Jin ------------------------------------------------------------------------- -July 30, 1995, v2.00.beta: - 0. the first release and beta version. - -Sep. 11, 1995, v2.10: - 1. Porting to AIX 3.x and 4.x, by writing dlopen(), - dlsym(), dlclose() interface. - 2. Tested on SCO OpenServer 5.x - 3. Awared of that, unlike s700/s800, exported function - symbols on HP9000 s300/s400 will be prepended with - a '_' prefix by compiler(and this '_' prefix is not - automatically handled by shl_findsym()). Now, it works - fine on s300/s400. - 4. Support driver ODBC call tracing. - -Oct. 12, 1995, v2.11: - 5. Driver's SQLNumResultCols() will automatically be - invoked in driver manager's SQLExecute(), - SQLExecDirect() and SQLParamData() after successfully - (i.e. return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO ) - calling of their correspondent driver functions. This - simplifies the state tracing/checking of the driver - manager a lot and allows store procedures to return - result set and also make iODBC driver manager work - properly with SELECT INTO statements which actually - don't return result sets. - 6. Memory leaks are cleared. - 7. Two bugs in dld.c for AIX are fixed - 8. A bug of setting tracing option is fixed. - 9. The driver will not be unloaded by SQLDisconnect() - but by SQLFreeConnect() or next SQLConnect()/ - SQLDriverConnect()/SQLBrowsConnect() on a different - driver. This will save driver's loading time if it - has been used by a previous connection(even there - is no active connection on this driver). - 10.Another three platforms are supported: - FreeBSD 2.x - Concurrent Max/OS SVR4 1.x - DG/UX 5.x - 11.autoconfig and build -- shell scripts to help modifying - Config.mk and building iodbc driver manager - -Nov. 12, 1995, v2.12 - 12.I realized that a driver manager doesn't aware of - difference between a C5 (i.e. hstmt) and a C6 - (i.e. transaction) states. - 13.The link flags "-lc" has been droped from Linux ELF - section of Config.mk to fix a segment fault problem. - Now, it works fine on Slackware 2.3 and Red Hat 2.0 - (kernel version are 1.2.xx and 1.3.xx respectively). - 14.On FreeBSD 2.x, dlsym() doesn't handle the '_' prefix - prepended to an exportting function symbol by compiler. - So, CLI_NAME_PREFIX needs to be defined as "_SQL" for - FreeBSD 2.x. - 15.Some files are renamed - dld.c -> dlf.c - dld.h -> dlf.h - confg.h -> config.h - 16. Fix a bug on setting tracing options. - diff --git a/src/iodbc/IAFA-PACKAGE b/src/iodbc/IAFA-PACKAGE deleted file mode 100644 index a53af75fec..0000000000 --- a/src/iodbc/IAFA-PACKAGE +++ /dev/null @@ -1,40 +0,0 @@ -Title: iODBC Driver Manager - -Version: 2.50 - -Description: iODBC (intrinsic Open Database Connectivity) driver manager - is compatible with ODBC 2.x specification and performs exactly - same jobs of ODBC 2.x driver manager(i.e. driver loading, - Parameters and function sequence checking, driver's function - Invoking, etc.). Any ODBC driver works with ODBC 2.0 driver - Manager will also work with iODBC driver manager and vice versa. - Applications (using ODBC function calls) linked with - iODBC driver manager will be able to simultaneously access - different type of data sources within one process through - suitable iODBC drivers. - -Original Author: Jin, Ke -Source Code Enhancement Contributors: OpenLink Software -Maintainers: OpenLink Software -Web Site: http://www.openlinksw.com - -Platforms: SunOS (Sparc) 4.1.x - HP/UX (s700/s800) 9.x, 10.x - HP/UX (s300/s400) 9.x - IBM AIX 3.x, 4.x - Solaris (Sparc) 2.x - Solaris (PCx86) 2.x - SGI Irix 5.x, 6.x - NCR SVR4 3.x - UnixWare SVR4.2 1.x, 2.x - DEC Unix (OSF/1) 3.x, 4.x - FreeBSD 2.x - BSDI BSD/OS 2.x - Linux ELF 1.2.x - SCO OpenServer 5.x - Concurrent MAX/OS 1.x - DG/UX 5.x - -License Policy: Freely Redistributable under GNU Library General Public License (LGPL) - -Keywords: ODBC, database, SQL, OpenLink diff --git a/src/iodbc/INSTALL b/src/iodbc/INSTALL deleted file mode 100644 index b42a17ac46..0000000000 --- a/src/iodbc/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/src/iodbc/NEWS b/src/iodbc/NEWS deleted file mode 100644 index 27eb6d4202..0000000000 --- a/src/iodbc/NEWS +++ /dev/null @@ -1,8 +0,0 @@ -Version: 2.5 -------------- -Added OpenLink enhancements - - -Version: 2.12 -------------- -Original version of Ke Jin diff --git a/src/iodbc/README b/src/iodbc/README deleted file mode 100644 index 23cb2a5e82..0000000000 --- a/src/iodbc/README +++ /dev/null @@ -1,187 +0,0 @@ -0. Changes - a. I realized that a driver manager doesn't aware of - difference between a C5 (i.e. hstmt) and a C6 - (i.e. transaction) states. - - b. The link flags "-lc" has been removed from Linux ELF - section of Config.mk to fix a segment fault problem. - Now, it works fine on Slackware 2.3 and Red Hat 2.0 - (kernel version are 1.2.xx and 1.3.xx respectively). - - c. On FreeBSD 2.x, dlsym() doesn't handle the '_' - prepended before a exporting function symbol. So, - CLI_NAME_PREFIX needs to be defined as "_SQL" for - FreeBSD. - - d. Some files are renamed - dld.c -> dlf.c - dld.h -> dlf.h - confg.h -> config.h - -1. iODBC driver manager platform availability - - iODBC driver manager has been ported to following Unix platforms: - - SunOS 4.1.x Sun Sparc - HP/UX 9.x, 10.x HP9000 s700/s800 - HP/UX 9.x HP9000 s300/s400 - IBM AIX 3.x, 4.x IBM RS6000, PowerPC - Sun Solaris 2.x Sun Sparc, PCx86 - SGI Irix SVR4 5.x, 6.x IP12 MIPS, IP22 MIPS - NCR SVR4 3.x NCR 3435 - UnixWare SVR4.2 1.x, 2.x x86 - DEC Unix(OSF/1) 3.x, 4.x DEC Alpha - FreeBSD 2.x x86 - BSDI BSD/OS 2.x ? - Linux ELF 1.2.x, 1.3.x x86 - SCO OpenServer 5.x x86 - Max/OS SVR4 1.x Concurrent Maxion 9200 MP - DG/UX 5.x Aviion - - Porting of iODBC driver manager to some non-unix operating systems - such as Windows family(3.x, 95, NT), OS/2 and Mac is supported but - has never compiled and tested yet :). Of cause, you need to supply - a make/build file and a short LibMain for creating the iodbc.dll. - -2. How to build iODBC driver manager: - - step 1. Identify your system - step 2. Run build with a suitable option - - Here is an example: - - %[1]: sh iodbc-2.12.shar - .... - %[2]: cd iodbc-2.12 - %[3]: uname -s -v -r -m - HP-UX B.10.01 A 9000/710 - %[4]: ./build hp700 - autoconfig hp700 - make - .... - Generating iODBC driver manager --> /home/kejin/iodbc-2.12.sl - -3. odbc.ini( ~/.odbc.ini ) - - Driver manager and drivers use odbc.ini(or ~/.odbc.ini on Unix) file - or connection string when establishing a data source connection. On - Windows, odbc.ini is located in Windows directory. On unix, iODBC driver - manager(and all other ODBC drivers and driver managers I awared) looks - .odbc.ini file in real user's home directory (it could be a softlink to - the file located somewhere else). Make sure your driver will look into - the same file (or a file which is a symbolic link to the same file). - The format of odbc.ini( or ~/.odbc.ini ) is defined as: - - odbc.ini(or .odbc.ini) ::= data_source_list - - data_source_list ::= /* empty */ - | data_source '\n' data_source_list - - data_source ::= '[' data_source_name ']' '\n' data_source_desc - - data_source_name ::= 'default' | [A-Za-z]*[A-Za-z0-9_]* - - data_source_desc ::= /* empty */ - | attrib_desc '\n' data_source_desc - - addrib_desc ::= Attrib '=' attrib_value - - Attrib ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib - - driver_def_attrib ::= [A-Za-z]*[A-Za-z0-9_]* - - An example of .odbc.ini file: - - [toronto_yp] - # yellow page of metro Toronto - Driver = /usr/lib/odbc/oracle.so - <....> - - [toronto_wp] - # white page of metro Toronto - Driver = /usr/lib/odbc/oracle.so - <....> - - [contract] - # all contract documents - Driver = /usr/lib/odbc/informix.so - <....> - - [netnews] - # NNTP netnews group - Driver = /usr/lib/odbc/nnodbc.so - Server = news.empress.com - - [rnd_test] - # data source for R&D test - Driver = /home/r_d/odbc/empodbc.so - URL = empodbc://rnd.empress.com:6322/rnd_test/testdb - - [default] - # default to odbc gateway - Driver = /usr/lib/odbc/gateway.so - -4. Tracing - - iODBC driver manager traces driver's ODBC call invoked by the driver - manager. Default tracing file is ./odbc.log. Tracing option (i.e. - on/off or optional tracing file name) can be set in ~/.odbc.ini - file (under a data source section) as: - - TraceFile = - Trace = ON | On | on | 1 | OFF | Off | off | 0 - - If is stderr or stdout, i.e. - - TraceFile = stderr - - or - - TraceFile = stdout - - the tracing message will go to the terminal screen(if it is available). - - iODBC driver manager allows one to tune on/off tracing on selected - connection(s). Different connections can share one or use different - tracing file(s). ODBC calls on connections without tuning tracing on - will not be traced. - -5. File list: - - README This file - IAFA-PACKAGE Version and copyright information - Changes.log Source changes log - Version.mk Version make include file - Config.mk Config make include file - Makefile make file - config.h system config include file - isql.h ODBC 1.0 macro - isqlext.h ODBC 2.0 macro - dlf.h general dynamic loader module interface - dlf.c general dynamic loader module (mapping to svr4) - dlproc.h simple dynamic loader module interface - dlproc.c simple dynamic loader on top of dlf module - herr.h error handling module interface - herr.c error handling module - herr.ci error handling source include - henv.h environment handle interface - henv.c environment handle module - henv.ci environment handle source include - hdbc.h connection handle interface - hdbc.c connection handle module - hstmt.h statement handle interface - hstmt.c statement handle module - connect.c connect functions - prepare.c query prepare functions - execute.c query executing functions - result.c query result property functions - fetch.c query result fetch functions - info.c driver information functions - catalog.c catalog functions - misc.c miscellaneous functions - itrace.h macro - itrace.c trace function - main.c entry function used to build a share library on AIX - shrsub.exp export symbol list used on AIX - autoconfig shell script for creating Config.mk - build shell script for building iodbc driver manager diff --git a/src/iodbc/autoconfig b/src/iodbc/autoconfig deleted file mode 100755 index ac6de96f2d..0000000000 --- a/src/iodbc/autoconfig +++ /dev/null @@ -1,230 +0,0 @@ -#! /usr/bin/sh - -cat > Config.tmp << '@END' -# -# Copyright (C) 1995 by Ke Jin -# - -#============ Default for all system ============== -SHELL = -SHELL = /bin/sh -DLDAPI = DLDAPI_SVR4_DLFCN -DLSUFFIX= so -OUTFILE = iodbc -OBJX = -@END - -\rm -f Makefile.tmp -cat > Makefile.tmp <<'@END' -include Version.mk -include Config.mk -@END - -case $1 in - sun4) - cat >> Config.tmp << '@END' - -#============ SunOS 4.1.x ========================= -PIC = -pic -CC = acc -LIBS = -ldl -@END - ;; - - aix) - cat >> Config.tmp << '@END' - -#=========== AIX 3.x 4.x ========================== -DLDAPI = DLDAPI_AIX_LOAD -ANSI = -langlvl=ansi -LDFLAGS = -H512 -T512 -bE:shrsub.exp -bM:SRE -LIBS = -lc -OBJX = main.o -DLSUFFIX= s.o -CFLAGSX = -DCLI_NAME_PREFIX=\".SQL\" -@END - ;; - - hp300 | hp400) - cat >> Config.tmp << '@END' - -#============ HP/UX (s300/s400) 9.x 10.x ========== -DLDAPI = DLDAPI_HP_SHL -ANSI = -Aa -PIC = +z -LDFLAGS = -b -DLSUFFIX= sl -CFLAGSX = -D_INCLUDE_POSIX_SOURCE -DCLI_NAME_PREFIX=\"_SQL\" -@END - ;; - - hp700 | hp800) - cat >> Config.tmp << '@END' - -#============ HP/UX 9000(s700/s800) 9.x 10.x ====== -DLDAPI = DLDAPI_HP_SHL -ANSI = -Aa -PIC = +z -LDFLAGS = -b -LIBS = -lc -ldld -DLSUFFIX= sl -CFLAGSX = -D_INCLUDE_POSIX_SOURCE -@END - ;; - - solaris) - cat >> Config.tmp << '@END' - -#======= Solaris 2.x, SunOS 5.x (Sparc/x86) ======= -LDFLAGS = -G -z defs -LIBS = -lc -ldl -lnsl -@END - ;; - - ncr |gis) - cat >> Config.tmp << '@END' - -#============= NCR SVR4 3.x ======================= -PIC = -KPIC -LDFLAGS = -G -z defs -LIBS = -lc -ldl -@END - ;; - - unixware) - cat >> Config.tmp << '@END' - -#========= UnixWare SVR4 1.x, 2.x ================= -PIC = -KPIC -LDFLAGS = -G -z defs -LIBS = -lc -ldl -@END - ;; - - maxos) - cat >> Config.tmp << '@END' - -#============ Concurrent Maxion MAX/OS 1.x ======== -PIC = -KPIC -LDFLAGS = -G -z defs -LIBS = -lc -ldl -@END - ;; - - sco-opensrv | sco-osr5 ) - cat >> Config.tmp << '@END' - -#============ SCO OpenServer 5.x ================== -PIC = -K PIC -b elf -LDFLAGS = -G -z defs -LIBS = -lc -ldl -@END - ;; - - dgux) - cat >> Config.tmp << '@END' - -#============ DG/UX 5.x =========================== -PIC = -K PIC -LDFLAGS = -G -z defs -LIBS = -lc -ldl -@END - ;; - - freebsd) - cat >> Config.tmp << '@END' - -#============= FreeBSD 2.x ======================== -PIC = -fPIC -CFLAGSX = -DCLI_NAME_PREFIX=\"_SQL\" -LDFLAGS = -Bshareable -LIBS = -lc -@END - - \rm -f Makefile.tmp - cat > Makefile.tmp <<'@END' -.include "Version.mk" -.include "Config.mk" -@END - ;; - - bsd-os) - cat >> Config.tmp << '@END' - -#============ BSDI BSD/OS 2.x ===================== -# -# ported by: Stuart Hayton -# -CC = gcc -LDFLAGS = -r -LDSUFFIX= o -LIBS = -lc_s.2.0 -ldl -@END - ;; - - linux-elf) - cat >> Config.tmp << '@END' - -#============= Linux ELF ========================= -# Slackware 2.x,(kernel 1.3.x) on i386 -# Red Hat 2.x (kernel 1.2.x) on i486 -# -ANSI = -ansi -CC = gcc -PIC = -fPIC -LDFLAGS = -shared -LIBS = -ldl -@END - ;; - - irix5| irix6) - cat >> Config.tmp << '@END' - -#============= SGI IRIX 5.x, 6.x ================= -LDFLAGS = -shared -LIBS = -lc -@END - ;; - - dec-osf1 | dec-unix) - cat >> Config.tmp << '@END' - -#============= DEC Unix(OSF/1) 3.x, 4.x ========== -LDFLAGS = -shared -LIBS = -lc -@END - ;; - *) - cat << '@END' - - Usage: autoconfig or - build - - platform_opt: - - sun4 -- SunOS 4.1.x - aix -- IBM AIX 3.x, 4.x - hp300, hp400 -- HP/UX 9.x, 10.x on 9000 s300/s400 - hp700, hp800 -- HP/UX 9.x, 10.x on 9000 s700/s800 - solaris -- Sun Solaris 2.x, SunOS 5.x - ncr, gis -- NCR(GIS) SVR4 3.x - unixware -- Novell UnixWare 1.x, 2.x - maxos -- Concurrent MAX/OS SVR4 1.x - sco-osr5 -- SCO Open Server 5.x - dgux -- DG/UX 5.x - freebsd -- FreeBSD 2.x - bsd-os -- BSDI BSD/OS 2.x - linux-elf -- Linux ELF 1.2.x and up - irix5, irix6 -- SGI Irix 5.x, 6.x - dec-osf1 -- DEC Unix(OSF/1) 3.x, 4.x - -@END - \rm -f Config.tmp - \rm -f Makefile.tmp - exit 1 - ;; -esac - \mv -f Config.tmp Config.mk - sed -e 's/.include.*//' -e 's/include.*//' Makefile >> Makefile.tmp - \mv -f Makefile.tmp Makefile - exit 0 diff --git a/src/iodbc/catalog.c b/src/iodbc/catalog.c deleted file mode 100644 index 37b134df47..0000000000 --- a/src/iodbc/catalog.c +++ /dev/null @@ -1,987 +0,0 @@ -/* - * catalog.c - * - * $Id$ - * - * Catalog functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -#ifndef NULL -#define NULL 0 -#endif - -static RETCODE -_iodbcdm_cata_state_ok ( - HSTMT hstmt, - int fidx) -/* check state for executing catalog functions */ -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - int sqlstat = en_00000; - - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - case en_stmt_fetched: - case en_stmt_xfetched: - sqlstat = en_24000; - break; - - default: - break; - } - } - else if (pstmt->asyn_on != fidx) - { - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - return SQL_SUCCESS; -} - - -static RETCODE -_iodbcdm_cata_state_tr ( - HSTMT hstmt, - int fidx, - RETCODE result) -/* state transition for catalog function */ -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - DBC_t FAR *pdbc; - - pdbc = (DBC_t FAR *) (pstmt->hdbc); - - if (pstmt->asyn_on == fidx) - { - switch (result) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return result; - } - } - - if (pstmt->state <= en_stmt_executed) - { - switch (result) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - pstmt->state = en_stmt_cursoropen; - break; - - case SQL_ERROR: - pstmt->state = en_stmt_allocated; - pstmt->prep_state = 0; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = fidx; - break; - - default: - break; - } - } - - return result; -} - - -RETCODE SQL_API -SQLGetTypeInfo ( - HSTMT hstmt, - SWORD fSqlType) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - int sqlstat = en_00000; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if (fSqlType > SQL_TYPE_MAX) - { - sqlstat = en_S1004; - break; - } - - /* Note: SQL_TYPE_DRIVER_START is a negative number So, we use ">" */ - if (fSqlType < SQL_TYPE_MIN && fSqlType > SQL_TYPE_DRIVER_START) - { - sqlstat = en_S1004; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_GetTypeInfo); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetTypeInfo); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetTypeInfo, - (pstmt->dhstmt, fSqlType)) - - return _iodbcdm_cata_state_tr (hstmt, en_GetTypeInfo, retcode); -} - - -RETCODE SQL_API -SQLSpecialColumns ( - HSTMT hstmt, - UWORD fColType, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName, - UWORD fScope, - UWORD fNullable) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - if (fColType != SQL_BEST_ROWID && fColType != SQL_ROWVER) - { - sqlstat = en_S1097; - break; - } - - if (fScope != SQL_SCOPE_CURROW - && fScope != SQL_SCOPE_TRANSACTION - && fScope != SQL_SCOPE_SESSION) - { - sqlstat = en_S1098; - break; - } - - if (fNullable != SQL_NO_NULLS && fNullable != SQL_NULLABLE) - { - sqlstat = en_S1099; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_SpecialColumns); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_SpecialColumns); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SpecialColumns, ( - pstmt->dhstmt, - fColType, - szTableQualifier, - cbTableQualifier, - szTableOwner, - cbTableOwner, - szTableName, - cbTableName, - fScope, - fNullable)) - - return _iodbcdm_cata_state_tr (hstmt, en_SpecialColumns, retcode); -} - - -RETCODE SQL_API -SQLStatistics ( - HSTMT hstmt, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName, - UWORD fUnique, - UWORD fAccuracy) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - if (fUnique != SQL_INDEX_UNIQUE && fUnique != SQL_INDEX_ALL) - { - sqlstat = en_S1100; - break; - } - - if (fAccuracy != SQL_ENSURE && fAccuracy != SQL_QUICK) - { - sqlstat = en_S1101; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_Statistics); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Statistics); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Statistics, ( - pstmt->dhstmt, - szTableQualifier, - cbTableQualifier, - szTableOwner, - cbTableOwner, - szTableName, - cbTableName, - fUnique, - fAccuracy)) - - return _iodbcdm_cata_state_tr (hstmt, en_Statistics, retcode); -} - - -RETCODE SQL_API -SQLTables ( - HSTMT hstmt, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName, - UCHAR FAR * szTableType, - SWORD cbTableType) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS) - || (cbTableType < 0 && cbTableType != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_Tables); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Tables); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Tables, ( - pstmt->dhstmt, - szTableQualifier, - cbTableQualifier, - szTableOwner, - cbTableOwner, - szTableName, - cbTableName, - szTableType, - cbTableType)) - - return _iodbcdm_cata_state_tr (hstmt, en_Tables, retcode); -} - - -RETCODE SQL_API -SQLColumnPrivileges ( - HSTMT hstmt, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName, - UCHAR FAR * szColumnName, - SWORD cbColumnName) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS) - || (cbColumnName < 0 && cbColumnName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_ColumnPrivileges); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ColumnPrivileges); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ColumnPrivileges, ( - pstmt->dhstmt, - szTableQualifier, - cbTableQualifier, - szTableOwner, - cbTableOwner, - szTableName, - cbTableName, - szColumnName, - cbColumnName)) - - return _iodbcdm_cata_state_tr (hstmt, en_ColumnPrivileges, retcode); -} - - -RETCODE SQL_API -SQLColumns ( - HSTMT hstmt, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName, - UCHAR FAR * szColumnName, - SWORD cbColumnName) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS) - || (cbColumnName < 0 && cbColumnName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_Columns); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Columns); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Columns, ( - pstmt->dhstmt, - szTableQualifier, - cbTableQualifier, - szTableOwner, - cbTableOwner, - szTableName, - cbTableName, - szColumnName, - cbColumnName)) - - return _iodbcdm_cata_state_tr (hstmt, en_Columns, retcode); -} - - -RETCODE SQL_API -SQLForeignKeys ( - HSTMT hstmt, - UCHAR FAR * szPkTableQualifier, - SWORD cbPkTableQualifier, - UCHAR FAR * szPkTableOwner, - SWORD cbPkTableOwner, - UCHAR FAR * szPkTableName, - SWORD cbPkTableName, - UCHAR FAR * szFkTableQualifier, - SWORD cbFkTableQualifier, - UCHAR FAR * szFkTableOwner, - SWORD cbFkTableOwner, - UCHAR FAR * szFkTableName, - SWORD cbFkTableName) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbPkTableQualifier < 0 && cbPkTableQualifier != SQL_NTS) - || (cbPkTableOwner < 0 && cbPkTableOwner != SQL_NTS) - || (cbPkTableName < 0 && cbPkTableName != SQL_NTS) - || (cbFkTableQualifier < 0 && cbFkTableQualifier != SQL_NTS) - || (cbFkTableOwner < 0 && cbFkTableOwner != SQL_NTS) - || (cbFkTableName < 0 && cbFkTableName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_ForeignKeys); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ForeignKeys); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ForeignKeys, ( - pstmt->dhstmt, - szPkTableQualifier, - cbPkTableQualifier, - szPkTableOwner, - cbPkTableOwner, - szPkTableName, - cbPkTableName, - szFkTableQualifier, - cbFkTableQualifier, - szFkTableOwner, - cbFkTableOwner, - szFkTableName, - cbFkTableName)) - - return _iodbcdm_cata_state_tr (hstmt, en_ForeignKeys, retcode); -} - - -RETCODE SQL_API -SQLPrimaryKeys ( - HSTMT hstmt, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_PrimaryKeys); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_PrimaryKeys); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_PrimaryKeys, ( - pstmt->dhstmt, - szTableQualifier, - cbTableQualifier, - szTableOwner, - cbTableOwner, - szTableName, - cbTableName)) - - return _iodbcdm_cata_state_tr (hstmt, en_PrimaryKeys, retcode); -} - - -RETCODE SQL_API -SQLProcedureColumns ( - HSTMT hstmt, - UCHAR FAR * szProcQualifier, - SWORD cbProcQualifier, - UCHAR FAR * szProcOwner, - SWORD cbProcOwner, - UCHAR FAR * szProcName, - SWORD cbProcName, - UCHAR FAR * szColumnName, - SWORD cbColumnName) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbProcQualifier < 0 && cbProcQualifier != SQL_NTS) - || (cbProcOwner < 0 && cbProcOwner != SQL_NTS) - || (cbProcName < 0 && cbProcName != SQL_NTS) - || (cbColumnName < 0 && cbColumnName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_ProcedureColumns); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ProcedureColumns); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ProcedureColumns, ( - pstmt->dhstmt, - szProcQualifier, - cbProcQualifier, - szProcOwner, - cbProcOwner, - szProcName, - cbProcName, - szColumnName, - cbColumnName)) - - return _iodbcdm_cata_state_tr (hstmt, en_ProcedureColumns, retcode); -} - - -RETCODE SQL_API -SQLProcedures ( - HSTMT hstmt, - UCHAR FAR * szProcQualifier, - SWORD cbProcQualifier, - UCHAR FAR * szProcOwner, - SWORD cbProcOwner, - UCHAR FAR * szProcName, - SWORD cbProcName) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbProcQualifier < 0 && cbProcQualifier != SQL_NTS) - || (cbProcOwner < 0 && cbProcOwner != SQL_NTS) - || (cbProcName < 0 && cbProcName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_Procedures); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Procedures); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Procedures, ( - pstmt->dhstmt, - szProcQualifier, - cbProcQualifier, - szProcOwner, - cbProcOwner, - szProcName, - cbProcName)) - - return _iodbcdm_cata_state_tr (hstmt, en_Procedures, retcode); -} - - -RETCODE SQL_API -SQLTablePrivileges ( - HSTMT hstmt, - UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, - SWORD cbTableOwner, - UCHAR FAR * szTableName, - SWORD cbTableName) -{ - - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS) - || (cbTableOwner < 0 && cbTableOwner != SQL_NTS) - || (cbTableName < 0 && cbTableName != SQL_NTS)) - { - sqlstat = en_S1090; - break; - } - - retcode = _iodbcdm_cata_state_ok (hstmt, en_TablePrivileges); - - if (retcode != SQL_SUCCESS) - { - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_TablePrivileges); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_TablePrivileges, - (pstmt->dhstmt, szTableQualifier, cbTableQualifier, szTableOwner, - cbTableOwner, szTableName, cbTableName)) - - return _iodbcdm_cata_state_tr (hstmt, en_TablePrivileges, retcode); -} diff --git a/src/iodbc/config.h b/src/iodbc/config.h deleted file mode 100644 index c42ea64e59..0000000000 --- a/src/iodbc/config.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * - * config.h - * - * $Id$ - * - * Configuration - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _CONFIG_H -#define _CONFIG_H - -#if !defined(WINDOWS) && !defined(WIN32_SYSTEM) -#define _UNIX_ - -#include "wx/setup.h" - -/* we have these definitions from configure */ -#if defined(HAVE_DLOPEN) - #define DLDAPI_SVR4_DLFCN -#elif defined(HAVE_SHL_LOAD) - #define DLDAPI_HP_SHL -#endif - -#include -#include -#include -#include - -#define MEM_ALLOC(size) (malloc((size_t)(size))) -#define MEM_FREE(ptr) {if(ptr) free(ptr);} - -#define STRCPY(t, s) (strcpy((char*)(t), (char*)(s))) -#define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n))) -#define STRCAT(t, s) (strcat((char*)(t), (char*)(s))) -#define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n))) -#define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0) -#define STRLEN(str) ((str)? strlen((char*)(str)):0) - -#define EXPORT -#define CALLBACK -#define FAR - -typedef signed short SSHOR; -typedef short WORD; -typedef long DWORD; - -typedef WORD WPARAM; -typedef DWORD LPARAM; -typedef int BOOL; -#endif /* _UNIX_ */ - -#if defined(WINDOWS) || defined(WIN32_SYSTEM) -#include -#include - -#ifdef _MSVC_ -#define MEM_ALLOC(size) (fmalloc((size_t)(size))) -#define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0)) -#define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s))) -#define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) -#define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0) -#define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) -#endif - -#ifdef _BORLAND_ -#define MEM_ALLOC(size) (farmalloc((unsigned long)(size)) -#define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0) -#define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s))) -#define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) -#define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0) -#define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) -#endif - -#endif /* WINDOWS */ - -#define SYSERR (-1) - -#ifndef NULL -#define NULL ((void FAR*)0UL) -#endif - -#endif diff --git a/src/iodbc/connect.c b/src/iodbc/connect.c deleted file mode 100644 index 2bd934f6a2..0000000000 --- a/src/iodbc/connect.c +++ /dev/null @@ -1,1241 +0,0 @@ -/* - * connect.c - * - * $Id$ - * - * Connect (load) driver - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -extern char* _iodbcdm_getkeyvalbydsn(); -extern char* _iodbcdm_getkeyvalinstr(); -extern RETCODE _iodbcdm_driverunload(); - -/* - * Following id string is a copyright mark. Removing(i.e. use - * souce code of this package without it or make it not appear - * in the final object file) or modifing it without permission - * from original author(kejin@empress.com) are copyright - * violation. - */ -static char sccsid[] - = "@(#)iODBC driver manager 2.5, Copyright(c) 1995 by Ke Jin"; - -/* - Load driver share library( or increase its reference count - * if it has already been loaded by another active connection) - * - Call driver's SQLAllocEnv() (for the first reference only) - * - Call driver's SQLAllocConnect() - * - Call driver's SQLSetConnectOption() (set login time out) - * - Increase the bookkeeping reference count - */ -static RETCODE -_iodbcdm_driverload ( - char FAR * path, - HDBC hdbc) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - GENV_t FAR *genv; - ENV_t FAR *penv = NULL; - HDLL hdll; - HPROC hproc; - RETCODE retcode = SQL_SUCCESS; - int sqlstat = en_00000; - - if (path == NULL || path[0] == '\0') - { - PUSHSQLERR (pdbc->herr, en_IM002); - - return SQL_ERROR; - } - - if (hdbc == SQL_NULL_HDBC || pdbc->genv == SQL_NULL_HENV) - { - return SQL_INVALID_HANDLE; - } - - genv = (GENV_t FAR *) pdbc->genv; - - /* This will either load the driver dll or increase its reference count */ - hdll = _iodbcdm_dllopen ((char FAR *) path); - - if (hdll == SQL_NULL_HDLL) - { - PUSHSYSERR (pdbc->herr, _iodbcdm_dllerror ()); - PUSHSQLERR (pdbc->herr, en_IM003); - return SQL_ERROR; - } - - penv = (ENV_t FAR *) (pdbc->henv); - - if (penv != NULL) - { - if (penv->hdll != hdll) - { - _iodbcdm_driverunload (hdbc); - } - else - { - /* - * this will not unload the driver but only decrease its internal - * reference count - */ - _iodbcdm_dllclose (hdll); - } - } - - if (penv == NULL) - { - /* - * find out whether this dll has already been loaded on another - * connection - */ - for (penv = (ENV_t FAR *) genv->henv; - penv != NULL; - penv = (ENV_t FAR *) penv->next) - { - if (penv->hdll == hdll) - { - /* - * this will not unload the driver but only decrease its internal - * reference count - */ - _iodbcdm_dllclose (hdll); - break; - } - } - - if (penv == NULL) - /* no connection attaching with this dll */ - { - int i; - - /* create a new dll env instance */ - penv = (ENV_t FAR *) MEM_ALLOC (sizeof (ENV_t)); - - if (penv == NULL) - { - _iodbcdm_dllclose (hdll); - - PUSHSQLERR (pdbc->herr, en_S1001); - - return SQL_ERROR; - } - - for (i = 0; i < SQL_EXT_API_LAST + 1; i++) - { - (penv->dllproc_tab)[i] = SQL_NULL_HPROC; - } - - pdbc->henv = penv; - penv->hdll = hdll; - - /* call driver's SQLAllocHandle() or SQLAllocEnv() */ - -#if (ODBCVER >= 0x0300) - hproc = _iodbcdm_getproc (hdbc, en_AllocHandle); - - if (hproc) - { - CALL_DRIVER (hdbc, retcode, hproc, en_AllocHandle, - (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &(penv->dhenv))) - } - else /* try driver's SQLAllocEnv() */ -#endif - { - hproc = _iodbcdm_getproc (hdbc, en_AllocEnv); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM004; - } - else - { - CALL_DRIVER (hdbc, retcode, hproc, - en_AllocEnv, (&(penv->dhenv))) - } - } - - if (retcode == SQL_ERROR) - { - sqlstat = en_IM004; - } - - if (sqlstat != en_00000) - { - _iodbcdm_dllclose (hdll); - MEM_FREE (penv); - PUSHSQLERR (pdbc->herr, en_IM004); - - return SQL_ERROR; - } - - /* insert into dll env list */ - penv->next = (ENV_t FAR *) genv->henv; - genv->henv = penv; - - /* initiate this new env entry */ - penv->refcount = 0; /* we will increase it after - * driver's SQLAllocConnect() - * success - */ - } - - pdbc->henv = penv; - - if (pdbc->dhdbc == SQL_NULL_HDBC) - { - -#if (ODBCVER >= 0x0300) - hproc = _iodbcdm_getproc (hdbc, en_AllocHandle); - - if (hproc) - { - CALL_DRIVER (hdbc, retcode, hproc, en_AllocHandle, - (SQL_HANDLE_DBC, penv->dhenv, &(pdbc->dhdbc))) - } - else -#endif - - { - hproc = _iodbcdm_getproc (hdbc, en_AllocConnect); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM005; - } - else - { - CALL_DRIVER (hdbc, retcode, hproc, - en_AllocConnect, (penv->dhenv, &(pdbc->dhdbc))) - } - } - - if (retcode == SQL_ERROR) - { - sqlstat = en_IM005; - } - - if (sqlstat != en_00000) - { - _iodbcdm_driverunload (hdbc); - - pdbc->dhdbc = SQL_NULL_HDBC; - PUSHSQLERR (pdbc->herr, en_IM005); - - return SQL_ERROR; - } - } - - pdbc->henv = penv; - penv->refcount++; /* bookkeeping reference count on this driver */ - } - - /* driver's login timeout option must been set before - * its SQLConnect() call */ - if (pdbc->login_timeout != 0UL) - { - hproc = _iodbcdm_getproc (hdbc, en_SetConnectOption); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM004; - } - else - { - CALL_DRIVER (hdbc, retcode, hproc, - en_SetConnectOption, ( - pdbc->dhdbc, - SQL_LOGIN_TIMEOUT, - pdbc->login_timeout)) - - if (retcode == SQL_ERROR) - { - PUSHSQLERR (pdbc->herr, en_IM006); - - return SQL_SUCCESS_WITH_INFO; - } - } - } - - return SQL_SUCCESS; -} - - -/* - Call driver's SQLFreeConnect() - * - Call driver's SQLFreeEnv() ( for the last reference only) - * - Unload the share library( or decrease its reference - * count if it is not the last referenct ) - * - decrease bookkeeping reference count - * - state transition to allocated - */ -RETCODE -_iodbcdm_driverunload (HDBC hdbc) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - ENV_t FAR *penv; - ENV_t FAR *tpenv; - GENV_t FAR *genv; - HPROC hproc; - RETCODE retcode = SQL_SUCCESS; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* no pointer check will be performed in this function */ - penv = (ENV_t FAR *) pdbc->henv; - genv = (GENV_t FAR *) pdbc->genv; - - if (penv == NULL || penv->hdll == SQL_NULL_HDLL) - { - return SQL_SUCCESS; - } - -#if (ODBCVER >= 0x0300) - hproc = _iodbcdm_getproc (hdbc, en_FreeHandle); - - if (hproc) - { - CALL_DRIVER (hdbc, retcode, hproc, en_FreeHandle, - (SQL_HANDLE_DBC, pdbc->dhdbc)) - } - else -#endif - - { - hproc = _iodbcdm_getproc (hdbc, en_FreeConnect); - - if (hproc != SQL_NULL_HPROC) - { - CALL_DRIVER (hdbc, retcode, hproc, - en_FreeConnect, (pdbc->dhdbc)) - - pdbc->dhdbc = SQL_NULL_HDBC; - } - } - - penv->refcount--; - - if (!penv->refcount) - /* no other connections still attaching with this driver */ - { - -#if (ODBCVER >= 0x0300) - hproc = _iodbcdm_getproc (hdbc, en_FreeHandle); - - if (hproc) - { - CALL_DRIVER (hdbc, retcode, hproc, en_FreeHandle, - (SQL_HANDLE_ENV, penv->dhenv)) - } - else -#endif - - { - hproc = _iodbcdm_getproc (hdbc, en_FreeEnv); - - if (hproc != SQL_NULL_HPROC) - { - CALL_DRIVER (hdbc, retcode, hproc, en_FreeEnv, - (penv->dhenv)) - - penv->dhenv = SQL_NULL_HENV; - } - } - - _iodbcdm_dllclose (penv->hdll); - - penv->hdll = SQL_NULL_HDLL; - - for (tpenv = (ENV_t FAR *) genv->henv; - tpenv != NULL; - tpenv = (ENV_t FAR *) penv->next) - { - if (tpenv == penv) - { - genv->henv = penv->next; - break; - } - - if (tpenv->next == penv) - { - tpenv->next = penv->next; - break; - } - } - - MEM_FREE (penv); - } - - pdbc->henv = SQL_NULL_HENV; - pdbc->hstmt = SQL_NULL_HSTMT; - /* pdbc->herr = SQL_NULL_HERR; - -- delay to DM's SQLFreeConnect() */ - pdbc->dhdbc = SQL_NULL_HDBC; - pdbc->state = en_dbc_allocated; - - /* set connect options to default values */ - /********** - pdbc->access_mode = SQL_MODE_DEFAULT; - pdbc->autocommit = SQL_AUTOCOMMIT_DEFAULT; - pdbc->login_timeout = 0UL; - **********/ - pdbc->odbc_cursors = SQL_CUR_DEFAULT; - pdbc->packet_size = 0UL; - pdbc->quiet_mode = (UDWORD) NULL; - pdbc->txn_isolation = SQL_TXN_READ_UNCOMMITTED; - - if (pdbc->current_qualifier != NULL) - { - MEM_FREE (pdbc->current_qualifier); - pdbc->current_qualifier = NULL; - } - - return SQL_SUCCESS; -} - - -static RETCODE -_iodbcdm_dbcdelayset (HDBC hdbc) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - ENV_t FAR *penv; - HPROC hproc; - RETCODE retcode = SQL_SUCCESS; - RETCODE ret; - - penv = pdbc->henv; - - hproc = _iodbcdm_getproc (hdbc, en_SetConnectOption); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_IM006); - - return SQL_SUCCESS_WITH_INFO; - } - - if (pdbc->access_mode != SQL_MODE_DEFAULT) - { - CALL_DRIVER (hdbc, ret, hproc, - en_SetConnectOption, ( - SQL_ACCESS_MODE, - pdbc->access_mode)) - - retcode |= ret; - } - - if (pdbc->autocommit != SQL_AUTOCOMMIT_DEFAULT) - { - CALL_DRIVER (hdbc, ret, hproc, - en_SetConnectOption, ( - pdbc->dhdbc, - SQL_AUTOCOMMIT, - pdbc->autocommit)) - - retcode |= ret; - } - - if (pdbc->current_qualifier != NULL) - { - CALL_DRIVER (hdbc, ret, hproc, - en_SetConnectOption, ( - pdbc->dhdbc, - SQL_CURRENT_QUALIFIER, - pdbc->current_qualifier)) - - retcode |= ret; - } - - if (pdbc->packet_size != 0UL) - { - CALL_DRIVER (hdbc, ret, hproc, - en_SetConnectOption, ( - pdbc->dhdbc, - SQL_PACKET_SIZE, - pdbc->packet_size)) - - retcode |= ret; - } - - if (pdbc->quiet_mode != (UDWORD) NULL) - { - CALL_DRIVER (hdbc, ret, hproc, - en_SetConnectOption, ( - pdbc->dhdbc, - SQL_QUIET_MODE, - pdbc->quiet_mode)) - - retcode |= ret; - } - - if (pdbc->txn_isolation != SQL_TXN_READ_UNCOMMITTED) - { - CALL_DRIVER (hdbc, ret, hproc, - en_SetConnectOption, ( - pdbc->dhdbc, - SQL_TXN_ISOLATION, - pdbc->txn_isolation)) - } - - /* check error code for driver's SQLSetConnectOption() call */ - if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - { - PUSHSQLERR (pdbc->herr, en_IM006); - - retcode = SQL_ERROR; - } - - /* get cursor behavior on transaction commit or rollback */ - hproc = _iodbcdm_getproc (hdbc, en_GetInfo); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_01000); - - return retcode; - } - - CALL_DRIVER (hdbc, ret, hproc, - en_GetInfo, ( - pdbc->dhdbc, - SQL_CURSOR_COMMIT_BEHAVIOR, - (PTR) & (pdbc->cb_commit), - sizeof (pdbc->cb_commit), - NULL)) - - retcode |= ret; - - CALL_DRIVER (hdbc, ret, hproc, - en_GetInfo, ( - pdbc->dhdbc, - SQL_CURSOR_ROLLBACK_BEHAVIOR, - (PTR) & (pdbc->cb_rollback), - sizeof (pdbc->cb_rollback), - NULL)) - - retcode |= ret; - - if (retcode != SQL_SUCCESS - && retcode != SQL_SUCCESS_WITH_INFO) - { - return SQL_ERROR; - } - - return retcode; -} - - -static RETCODE -_iodbcdm_settracing (HDBC hdbc, char *dsn, int dsnlen) -{ - char buf[256]; - char *ptr; - RETCODE setopterr = SQL_SUCCESS; - - /* Get Driver's DLL path from specificed or default dsn section */ - ptr = _iodbcdm_getkeyvalbydsn (dsn, dsnlen, "TraceFile", - (char FAR *) buf, sizeof (buf)); - - if (ptr == NULL || ptr[0] == '\0') - { - ptr = (char FAR *) (SQL_OPT_TRACE_FILE_DEFAULT); - } - - setopterr |= SQLSetConnectOption (hdbc, SQL_OPT_TRACEFILE, (UDWORD) (ptr)); - - ptr = _iodbcdm_getkeyvalbydsn (dsn, dsnlen, "Trace", - (char FAR *) buf, sizeof (buf)); - - if (ptr != NULL) - { - UDWORD opt = (UDWORD) (-1L); - - if (STREQ (ptr, "ON") - || STREQ (ptr, "On") - || STREQ (ptr, "on") - || STREQ (ptr, "1")) - { - opt = SQL_OPT_TRACE_ON; - } - - if (STREQ (ptr, "OFF") - || STREQ (ptr, "Off") - || STREQ (ptr, "off") - || STREQ (ptr, "0")) - { - opt = SQL_OPT_TRACE_OFF; - } - - if (opt != (UDWORD) (-1L)) - { - setopterr |= SQLSetConnectOption (hdbc, - SQL_OPT_TRACE, opt); - } - } - - return setopterr; -} - - -RETCODE SQL_API -SQLConnect ( - HDBC hdbc, - UCHAR FAR * szDSN, - SWORD cbDSN, - UCHAR FAR * szUID, - SWORD cbUID, - UCHAR FAR * szAuthStr, - SWORD cbAuthStr) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - RETCODE retcode = SQL_SUCCESS; - RETCODE setopterr = SQL_SUCCESS; - char driver[1024] = {'\0'}; /* MS SDK Guide - * specifies driver - * path can't longer - * than 255. */ - char *ptr; - HPROC hproc; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check arguments */ - if ((cbDSN < 0 && cbDSN != SQL_NTS) - || (cbUID < 0 && cbUID != SQL_NTS) - || (cbAuthStr < 0 && cbAuthStr != SQL_NTS) - || (cbDSN > SQL_MAX_DSN_LENGTH)) - { - PUSHSQLERR (pdbc->herr, en_S1090); - - return SQL_ERROR; - } - - if (szDSN == NULL || cbDSN == 0) - { - PUSHSQLERR (pdbc->herr, en_IM002); - - return SQL_ERROR; - } - - /* check state */ - if (pdbc->state != en_dbc_allocated) - { - PUSHSQLERR (pdbc->herr, en_08002); - - return SQL_ERROR; - } - - setopterr |= _iodbcdm_settracing (hdbc, - (char *) szDSN, cbDSN); - - ptr = _iodbcdm_getkeyvalbydsn (szDSN, cbDSN, "Driver", - (char FAR *) driver, sizeof (driver)); - - if (ptr == NULL) - /* No specified or default dsn section or - * no driver specification in this dsn section */ - { - PUSHSQLERR (pdbc->herr, en_IM002); - - return SQL_ERROR; - } - - retcode = _iodbcdm_driverload (driver, hdbc); - - switch (retcode) - { - case SQL_SUCCESS: - break; - - case SQL_SUCCESS_WITH_INFO: - setopterr = SQL_ERROR; - /* unsuccessed in calling driver's - * SQLSetConnectOption() to set login - * timeout. - */ - break; - - default: - return retcode; - } - - hproc = _iodbcdm_getproc (hdbc, en_Connect); - - if (hproc == SQL_NULL_HPROC) - { - _iodbcdm_driverunload (hdbc); - - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_Connect, ( - pdbc->dhdbc, - szDSN, cbDSN, - szUID, cbUID, - szAuthStr, cbAuthStr)) - - if (retcode != SQL_SUCCESS - && retcode != SQL_SUCCESS_WITH_INFO) - { - /* not unload driver for retrive error - * messge from driver */ - /********* - _iodbcdm_driverunload( hdbc ); - **********/ - - return retcode; - } - - /* state transition */ - pdbc->state = en_dbc_connected; - - /* do delaid option setting */ - setopterr |= _iodbcdm_dbcdelayset (hdbc); - - if (setopterr != SQL_SUCCESS) - { - return SQL_SUCCESS_WITH_INFO; - } - - return retcode; -} - - -RETCODE SQL_API -SQLDriverConnect ( - HDBC hdbc, - SQLHWND hwnd, - UCHAR FAR * szConnStrIn, - SWORD cbConnStrIn, - UCHAR FAR * szConnStrOut, - SWORD cbConnStrOutMax, - SWORD FAR * pcbConnStrOut, - UWORD fDriverCompletion) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - HDLL hdll; - char FAR *drv; - char drvbuf[1024]; - char FAR *dsn; - char dsnbuf[SQL_MAX_DSN_LENGTH + 1]; - UCHAR cnstr2drv[1024]; - - HPROC hproc; - HPROC dialproc; - - int sqlstat = en_00000; - RETCODE retcode = SQL_SUCCESS; - RETCODE setopterr = SQL_SUCCESS; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check arguments */ - if ((cbConnStrIn < 0 && cbConnStrIn != SQL_NTS) - || cbConnStrOutMax < 0) - { - PUSHSQLERR (pdbc->herr, en_S1090); - - return SQL_ERROR; - } - - /* check state */ - if (pdbc->state != en_dbc_allocated) - { - PUSHSQLERR (pdbc->herr, en_08002); - - return SQL_ERROR; - } - - drv = _iodbcdm_getkeyvalinstr (szConnStrIn, cbConnStrIn, - "DRIVER", drvbuf, sizeof (drvbuf)); - - dsn = _iodbcdm_getkeyvalinstr (szConnStrIn, cbConnStrIn, - "DSN", dsnbuf, sizeof (dsnbuf)); - - switch (fDriverCompletion) - { - case SQL_DRIVER_NOPROMPT: - break; - - case SQL_DRIVER_COMPLETE: - case SQL_DRIVER_COMPLETE_REQUIRED: - if (dsn != NULL || drv != NULL) - { - break; - } - /* fall to next case */ - case SQL_DRIVER_PROMPT: - /* Get data source dialog box function from - * current executable */ - hdll = _iodbcdm_dllopen ((char FAR *) NULL); - dialproc = _iodbcdm_dllproc (hdll, - "_iodbcdm_drvconn_dialbox"); - - if (dialproc == SQL_NULL_HPROC) - { - sqlstat = en_IM008; - break; - } - - retcode = dialproc ( - hwnd, /* window or display handle */ - dsnbuf, /* input/output dsn buf */ - sizeof (dsnbuf), /* buf size */ - &sqlstat); /* error code */ - - if (retcode != SQL_SUCCESS) - { - break; - } - - if (cbConnStrIn == SQL_NTS) - { - cbConnStrIn = STRLEN (szConnStrIn); - } - - dsn = dsnbuf; - - if (dsn[0] == '\0') - { - dsn = "default"; - } - - if (cbConnStrIn > sizeof (cnstr2drv) - - STRLEN (dsn) - STRLEN ("DSN=;") - 1) - { - sqlstat = en_S1001; /* a lazy way to avoid - * using heap memory */ - break; - } - - sprintf ((char*)cnstr2drv, "DSN=%s;", dsn); - cbConnStrIn += STRLEN (cnstr2drv); - STRNCAT (cnstr2drv, szConnStrIn, cbConnStrIn); - szConnStrIn = cnstr2drv; - break; - - default: - sqlstat = en_S1110; - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pdbc->herr, sqlstat); - - return SQL_ERROR; - } - - if (dsn == NULL || dsn[0] == '\0') - { - dsn = "default"; - } - else - /* if you want tracing, you must use a DSN */ - { - setopterr |= _iodbcdm_settracing (hdbc, - (char *) dsn, SQL_NTS); - } - - if (drv == NULL || drv[0] == '\0') - { - drv = _iodbcdm_getkeyvalbydsn (dsn, SQL_NTS, "Driver", - drvbuf, sizeof (drvbuf)); - } - - if (drv == NULL) - { - PUSHSQLERR (pdbc->herr, en_IM002); - - return SQL_ERROR; - } - - retcode = _iodbcdm_driverload (drv, hdbc); - - switch (retcode) - { - case SQL_SUCCESS: - break; - - case SQL_SUCCESS_WITH_INFO: - setopterr = SQL_ERROR; - /* unsuccessed in calling driver's - * SQLSetConnectOption() to set login - * timeout. - */ - break; - - default: - return retcode; - } - - hproc = _iodbcdm_getproc (hdbc, en_DriverConnect); - - if (hproc == SQL_NULL_HPROC) - { - _iodbcdm_driverunload (hdbc); - - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_DriverConnect, ( - pdbc->dhdbc, hwnd, - szConnStrIn, cbConnStrIn, - szConnStrOut, cbConnStrOutMax, - pcbConnStrOut, fDriverCompletion)) - - if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - { - /* don't unload driver here for retrive - * error message from driver */ - /******** - _iodbcdm_driverunload( hdbc ); - *********/ - - return retcode; - } - - /* state transition */ - pdbc->state = en_dbc_connected; - - /* do delaid option setting */ - setopterr |= _iodbcdm_dbcdelayset (hdbc); - - if (setopterr != SQL_SUCCESS) - { - return SQL_SUCCESS_WITH_INFO; - } - - return retcode; -} - - -RETCODE SQL_API -SQLBrowseConnect ( - HDBC hdbc, - UCHAR FAR * szConnStrIn, - SWORD cbConnStrIn, - UCHAR FAR * szConnStrOut, - SWORD cbConnStrOutMax, - SWORD FAR * pcbConnStrOut) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - char FAR *drv; - char drvbuf[1024]; - char FAR *dsn; - char dsnbuf[SQL_MAX_DSN_LENGTH + 1]; - - HPROC hproc; - - RETCODE retcode = SQL_SUCCESS; - RETCODE setopterr = SQL_SUCCESS; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check arguments */ - if ((cbConnStrIn < 0 && cbConnStrIn != SQL_NTS) || cbConnStrOutMax < 0) - { - PUSHSQLERR (pdbc->herr, en_S1090); - - return SQL_ERROR; - } - - if (pdbc->state == en_dbc_allocated) - { - drv = _iodbcdm_getkeyvalinstr (szConnStrIn, cbConnStrIn, - "DRIVER", drvbuf, sizeof (drvbuf)); - - dsn = _iodbcdm_getkeyvalinstr (szConnStrIn, cbConnStrIn, - "DSN", dsnbuf, sizeof (dsnbuf)); - - if (dsn == NULL || dsn[0] == '\0') - { - dsn = "default"; - } - else - /* if you want tracing, you must use a DSN */ - { - setopterr |= _iodbcdm_settracing (hdbc, - (char *) dsn, SQL_NTS); - } - - if (drv == NULL || drv[0] == '\0') - { - drv = _iodbcdm_getkeyvalbydsn (dsn, SQL_NTS, "Driver", - drvbuf, sizeof (drvbuf)); - } - - if (drv == NULL) - { - PUSHSQLERR (pdbc->herr, en_IM002); - - return SQL_ERROR; - } - - retcode = _iodbcdm_driverload (drv, hdbc); - - switch (retcode) - { - case SQL_SUCCESS: - break; - - case SQL_SUCCESS_WITH_INFO: - setopterr = SQL_ERROR; - /* unsuccessed in calling driver's - * SQLSetConnectOption() to set login - * timeout. - */ - break; - - default: - return retcode; - } - } - else if (pdbc->state != en_dbc_needdata) - { - PUSHSQLERR (pdbc->herr, en_08002); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (hdbc, en_BrowseConnect); - - if (hproc == SQL_NULL_HPROC) - { - _iodbcdm_driverunload (hdbc); - - pdbc->state = en_dbc_allocated; - - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_BrowseConnect, ( - pdbc->dhdbc, - szConnStrIn, cbConnStrIn, - szConnStrOut, cbConnStrOutMax, - pcbConnStrOut)) - - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - pdbc->state = en_dbc_connected; - setopterr |= _iodbcdm_dbcdelayset (hdbc); - if (setopterr != SQL_SUCCESS) - { - retcode = SQL_SUCCESS_WITH_INFO; - } - break; - - case SQL_NEED_DATA: - pdbc->state = en_dbc_needdata; - break; - - case SQL_ERROR: - pdbc->state = en_dbc_allocated; - /* but the driver will not unloaded - * to allow application retrive err - * message from driver - */ - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLDisconnect (HDBC hdbc) -{ - DBC_t FAR *pdbc = (DBC_t *) hdbc; - STMT_t FAR *pstmt; - RETCODE retcode; - HPROC hproc; - - int sqlstat = en_00000; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check hdbc state */ - if (pdbc->state == en_dbc_allocated) - { - sqlstat = en_08003; - } - - /* check stmt(s) state */ - for (pstmt = (STMT_t FAR *) pdbc->hstmt; - pstmt != NULL && sqlstat == en_00000; - pstmt = (STMT_t FAR *) pstmt->next) - { - if (pstmt->state >= en_stmt_needdata - || pstmt->asyn_on != en_NullProc) - /* In this case one need to call - * SQLCancel() first */ - { - sqlstat = en_S1010; - } - } - - if (sqlstat == en_00000) - { - hproc = _iodbcdm_getproc (hdbc, en_Disconnect); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pdbc->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_Disconnect, ( - pdbc->dhdbc)) - - if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) - { - /* diff from MS specs. We disallow - * driver SQLDisconnect() return - * SQL_SUCCESS_WITH_INFO and post - * error message. - */ - retcode = SQL_SUCCESS; - } - else - { - return retcode; - } - - /* free all statement handle(s) on this connection */ - for (; pdbc->hstmt;) - { - _iodbcdm_dropstmt (pdbc->hstmt); - } - - /* state transition */ - if (retcode == SQL_SUCCESS) - { - pdbc->state = en_dbc_allocated; - } - - return retcode; -} - - -RETCODE SQL_API -SQLNativeSql ( - HDBC hdbc, - UCHAR FAR * szSqlStrIn, - SDWORD cbSqlStrIn, - UCHAR FAR * szSqlStr, - SDWORD cbSqlStrMax, - SDWORD FAR * pcbSqlStr) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - HPROC hproc; - int sqlstat = en_00000; - RETCODE retcode; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - if (szSqlStrIn == NULL) - { - sqlstat = en_S1009; - } - else if (cbSqlStrIn < 0 && cbSqlStrIn != SQL_NTS) - { - sqlstat = en_S1090; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pdbc->herr, sqlstat); - - return SQL_ERROR; - } - - /* check state */ - if (pdbc->state <= en_dbc_needdata) - { - PUSHSQLERR (pdbc->herr, en_08003); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (hdbc, en_NativeSql); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_NativeSql, - (pdbc->dhdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr)) - - return retcode; -} diff --git a/src/iodbc/dlf.c b/src/iodbc/dlf.c deleted file mode 100644 index 46cf232907..0000000000 --- a/src/iodbc/dlf.c +++ /dev/null @@ -1,612 +0,0 @@ -/* - * dlf.c - * - * $Id$ - * - * Dynamic Library Loader (mapping to SVR4) - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "dlf.h" -#include - -#ifdef DLDAPI_DEFINED -#undef DLDAPI_DEFINED -#endif - -#ifdef DLDAPI_SVR4_DLFCN -#define DLDAPI_DEFINED -static char sccsid[] = "@(#)dynamic load interface -- SVR4 dlfcn"; -#endif - -/********************************* - * - * HP/UX - * - *********************************/ - -#ifdef DLDAPI_HP_SHL -#define DLDAPI_DEFINED -#include - -static char sccsid[] = "@(#)dynamic load interface -- HP/UX dl(shl)"; - -void * -dlopen (char *path, int mode) -{ - return (void *) shl_load ((char *) (path), BIND_DEFERRED, 0L); -} - - -void * -dlsym (void *hdll, char *sym) -{ - void *symaddr = 0; - int ret; - - if (!hdll) - hdll = (void *) PROG_HANDLE; - - /* Remember, a driver may export calls as function pointers - * (i.e. with type TYPE_DATA) rather than as functions - * (i.e. with type TYPE_PROCEDURE). Thus, to be safe, we - * uses TYPE_UNDEFINED to cover all of them. - */ - ret = shl_findsym ((shl_t *) & hdll, sym, TYPE_UNDEFINED, &symaddr); - - if (ret == -1) - return 0; - - return symaddr; -} - - -char * -dlerror () -{ - extern char *strerror (); - - return strerror (errno); -} - - -int -dlclose (void *hdll) -{ - return shl_unload ((shl_t) hdll); -} -#endif /* end of HP/UX Seection */ - - -/********************************* - * - * IBM AIX - * - *********************************/ - -#ifdef DLDAPI_AIX_LOAD -#define DLDAPI_DEFINED -#include -#include -#include -#include - -/* - * Following id sting is a copyright mark. Removing(i.e. use the - * source code in this .c file without include it or make it not - * appear in the final object file of AIX platform) or modifing - * it without permission from original author(kejin@empress.com) - * are copyright violation. - */ -static char sccsid[] -= "@(#)dynamic load interface, Copyright(c) 1995 by Ke Jin"; - -#ifndef HTAB_SIZE -#define HTAB_SIZE 256 -#endif - -#define FACTOR 0.618039887 /* i.e. (sqrt(5) - 1)/2 */ - -#ifndef ENTRY_SYM -#define ENTRY_SYM ".__start" /* default entry point for aix */ -#endif - -typedef struct slot_s - { - char *sym; - long fdesc[3]; /* 12 bytes function descriptor */ - struct slot_s *next; - } -slot_t; - -/* Note: on AIX, a function pointer actually points to a - * function descriptor, a 12 bytes data. The first 4 bytes - * is the virtual address of the function. The next 4 bytes - * is the virtual address of TOC (Table of Contents) of the - * object module the function belong to. The last 4 bytes - * are always 0 for C and Fortran functions. Every object - * module has an entry point (which can be specified at link - * time by -e ld option). iODBC driver manager requires ODBC - * driver shared library always use the default entry point - * (so you shouldn't use -e ld option when creating a driver - * share library). load() returns the function descriptor of - * a module's entry point. From which we can calculate function - * descriptors of other functions in the same module by using - * the fact that the load() doesn't change the relative - * offset of functions to their module entry point(i.e the - * offset in memory loaded by load() will be as same as in - * the module library file). - */ - -typedef slot_t *hent_t; -typedef struct nlist nlist_t; -typedef struct stat stat_t; - -typedef struct obj - { - int dev; /* device id */ - int ino; /* inode number */ - char *path; /* file name */ - int (*pentry) (); /* entry point of this share library */ - int refn; /* number of reference */ - hent_t htab[HTAB_SIZE]; - struct obj * next; - } -obj_t; - -static char *errmsg = 0; - -static void -init_htab (hent_t * ht) -/* initate a hashing table */ -{ - int i; - - for (i = 0; i < HTAB_SIZE; i++) - ht[i] = (slot_t *) 0; - - return; -} - - -static void -clean_htab (hent_t * ht) -/* free all slots */ -{ - int i; - slot_t *ent; - slot_t *tent; - - for (i = 0; i < HTAB_SIZE; i++) - { - for (ent = ht[i]; ent;) - { - tent = ent->next; - - free (ent->sym); - free (ent); - - ent = tent; - } - - ht[i] = 0; - } - - return; -} - - -static int -hash (char *sym) -{ - int a, key; - double f; - - if (!sym || !*sym) - return 0; - - for (key = *sym; *sym; sym++) - { - key += *sym; - a = key; - - key = (int) ((a << 8) + (key >> 8)); - key = (key > 0) ? key : -key; - } - - f = key * FACTOR; - a = (int) f; - - return (int) ((HTAB_SIZE - 1) * (f - a)); -} - - -static hent_t -search (hent_t * htab, char *sym) -/* search hashing table to find a matched slot */ -{ - int key; - slot_t *ent; - - key = hash (sym); - - for (ent = htab[key]; ent; ent = ent->next) - { - if (!strcmp (ent->sym, sym)) - return ent; - } - - return 0; /* no match */ -} - - -static void -insert (hent_t * htab, slot_t * ent) -/* insert a new slot to hashing table */ -{ - int key; - - key = hash (ent->sym); - - ent->next = htab[key]; - htab[key] = ent; - - return; -} - - -static slot_t * -slot_alloc (char *sym) -/* allocate a new slot with symbol */ -{ - slot_t *ent; - - ent = (slot_t *) malloc (sizeof (slot_t)); - - ent->sym = (char *) malloc (strlen (sym) + 1); - - if (!ent->sym) - { - free (ent); - return 0; - } - - strcpy (ent->sym, sym); - - return ent; -} - - -static obj_t *obj_list = 0; - -void * -dlopen (char *file, int mode) -{ - stat_t st; - obj_t *pobj; - char buf[1024]; - - if (!file || !*file) - { - errno = EINVAL; - return 0; - } - - errno = 0; - errmsg = 0; - - if (stat (file, &st)) - return 0; - - for (pobj = obj_list; pobj; pobj = pobj->next) - /* find a match object */ - { - if (pobj->ino == st.st_ino - && pobj->dev == st.st_dev) - { - /* found a match. increase its - * reference count and return - * its address */ - pobj->refn++; - return pobj; - } - } - - pobj = (obj_t *) malloc (sizeof (obj_t)); - - if (!pobj) - return 0; - - pobj->path = (char *) malloc (strlen (file) + 1); - - if (!pobj->path) - { - free (pobj); - return 0; - } - - strcpy (pobj->path, file); - - pobj->dev = st.st_dev; - pobj->ino = st.st_ino; - pobj->refn = 1; - - pobj->pentry = (int (*)()) load (file, 0, 0); - - if (!pobj->pentry) - { - free (pobj->path); - free (pobj); - return 0; - } - - init_htab (pobj->htab); - - pobj->next = obj_list; - obj_list = pobj; - - return pobj; -} - - -int -dlclose (void *hobj) -{ - obj_t *pobj = (obj_t *) hobj; - obj_t *tpobj; - int match = 0; - - if (!hobj) - { - errno = EINVAL; - return -1; - } - - errno = 0; - errmsg = 0; - - if (pobj == obj_list) - { - pobj->refn--; - - if (pobj->refn) - return 0; - - match = 1; - obj_list = pobj->next; - } - - for (tpobj = obj_list; !match && tpobj; tpobj = tpobj->next) - { - if (tpobj->next == pobj) - { - pobj->refn--; - - if (pobj->refn) - return 0; - - match = 1; - tpobj->next = pobj->next; - } - } - - if (match) - { - unload ((void *) (pobj->pentry)); - clean_htab (pobj->htab); - free (pobj->path); - free (pobj); - } - - return 0; -} - - -char * -dlerror () -{ - extern char *sys_errlist[]; - - if (!errmsg || !errmsg[0]) - { - if (errno >= 0) - return sys_errlist[errno]; - - return ""; - } - - return errmsg; -} - - -void * -dlsym (void *hdl, char *sym) -{ - nlist_t nl[3]; - obj_t *pobj = (obj_t *) hdl; - slot_t *ent; - int (*fp) (); - long lbuf[3]; - - if (!hdl || !(pobj->htab) || !sym || !*sym) - { - errno = EINVAL; - return 0; - } - - errno = 0; - errmsg = 0; - - ent = search (pobj->htab, sym); - - if (ent) - return ent->fdesc; - -#define n_name _n._n_name - - nl[0].n_name = ENTRY_SYM; - nl[1].n_name = sym; - nl[2].n_name = 0; - - /* There is a potential problem here. If application - * did not pass a full path name, and changed the - * working directory after the load(), then nlist() - * will be unable to open the original shared library - * file to resolve the symbols. there are 3 ways to working - * round this: 1. convert to full pathname in driver - * manager. 2. applications always pass driver's full - * path name. 3. if driver itself don't support - * SQLGetFunctions(), call it with SQL_ALL_FUNCTIONS - * as flag immidately after SQLConnect(), SQLDriverConnect() - * and SQLBrowseConnect() to force the driver manager - * resolving all will be used symbols. - */ - if (nlist (pobj->path, nl) == -1) - return 0; - - if (!nl[0].n_type && !nl[0].n_value) - { - errmsg = "can't locate module entry symbol"; - return 0; - } - - /* Note: On AIX 3.x if the object library is not - * built with -g compiling option, .n_type field - * is always 0. While on 4.x it will be 32. - * On AIX 4.x, if the symbol is a entry point, - * n_value will be 0. However, one thing is for sure - * that if a symbol is not existance in the file, - * both .n_type and .n_value would be 0. - */ - - if (!nl[1].n_type && !nl[1].n_value) - { - errmsg = "symbol not existance in this module"; - return 0; - } - - ent = slot_alloc (sym); - - if (!ent) - return 0; - - /* catch it with a slot in the hashing table */ - insert (pobj->htab, ent); - - memcpy (ent->fdesc, pobj->pentry, sizeof (ent->fdesc)); - - /* now ent->fdesc[0] is the virtual address of entry point - * and ent->fdesc[1] is the TOC of the module - */ - - /* let's calculate the virtual address of the symbol - * by adding a relative offset getting from the module - * file symbol table, i.e - * - * functin virtual address = entry point virtual address + - * + ( function offset in file - entry point offset in file ) - */ - - (ent->fdesc)[0] = (ent->fdesc)[0] + - (nl[1].n_value - nl[0].n_value); - - /* return the function descriptor */ - return ent->fdesc; -} -#endif /* end of IBM AIX Section */ - - -/********************************* - * - * Windows 3.x, 95, NT - * - *********************************/ - -#ifdef DLDAPI_WINDOWS -#define DLDAPI_DEFINED -#include - -void FAR * -dlopen (char FAR * dll, int mode) -{ - HINSTANCE hint; - - if (dll == NULL) - { - return GetWindowWord (NULL, GWW_HINSTANCE); - } - - hint = LoadLibrary (dll); - - if (hint < HINSTANCE_ERROR) - { - return NULL; - } - - return (void FAR *) hint; -} - - -void FAR * -dlsym (void FAR * hdll, char FAR * sym) -{ - return (void FAR *) GetProcAddress (hdll, sym); -} - - -char FAR * -dlerror () -{ - return 0L; /* unimplemented yet */ -} - - -int -dlclose (void FAR * hdll) -{ - FreeLibrary ((HINSTANCE) hdll); -} -#endif /* end of Windows family */ - - -/*********************************** - * - * other platforms - * - ***********************************/ - -#ifdef DLDAPI_OS2 -#define DLDAPI_DEFINED -/* - * DosLoadModule(), DosQueryProcAddress(), DosFreeModule(), ... - */ -#endif - -#ifdef DLDAPI_MAC -#define DLDAPI_DEFINED -#endif - -#ifdef DLDAPI_NEXT -#define DLDAPI_DEFINED -#endif - -#ifndef DLDAPI_DEFINED -#error "dynamic load editor undefined" -#endif diff --git a/src/iodbc/dlf.h b/src/iodbc/dlf.h deleted file mode 100644 index a766ebbe52..0000000000 --- a/src/iodbc/dlf.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * dlf.h - * - * $Id$ - * - * Dynamic Library Loader (mapping to SVR4) - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _DLF_H -#define _DLF_H -#include "config.h" - -#if defined(HAVE_LIBDL) -#define DLDAPI_SVR4_DLFCN -#elif defined(HAVE_SHL_LOAD) -#define DLDAPI_HP_SHL -#endif - -#ifdef DLDAPI_SVR4_DLFCN -#include -#elif DLDAPI_AIX_LOAD -#include -#else -extern void FAR *dlopen (char FAR * path, int mode); -extern void FAR *dlsym (void FAR * hdll, char FAR * sym); -extern char FAR *dlerror (); -extern int dlclose (void FAR * hdll); -#endif - -#ifndef RTLD_LAZY -#define RTLD_LAZY 1 -#endif - -#define DLL_OPEN(dll) (void*)dlopen((char*)(path), RTLD_LAZY) -#define DLL_PROC(hdll, sym) (void*)dlsym((void*)(hdll), (char*)sym) -#define DLL_ERROR() (char*)dlerror() -#define DLL_CLOSE(hdll) dlclose((void*)(hdll)) -#endif diff --git a/src/iodbc/dlproc.c b/src/iodbc/dlproc.c deleted file mode 100644 index df67ba8ed0..0000000000 --- a/src/iodbc/dlproc.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * dlproc.c - * - * $Id$ - * - * Load driver and resolve driver's function entry point - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" - -#include "itrace.h" - -#include "henv.ci" - -HPROC -_iodbcdm_getproc (HDBC hdbc, int idx) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - ENV_t FAR *penv; - HPROC FAR *phproc; - - if (idx <= 0 || idx > SQL_EXT_API_LAST) - /* first entry naver used */ - { - return SQL_NULL_HPROC; - } - - penv = (ENV_t FAR *) (pdbc->henv); - - if (penv == NULL) - { - return SQL_NULL_HPROC; - } - - phproc = penv->dllproc_tab + idx; - - if (*phproc == SQL_NULL_HPROC) - { - int i, en_idx; - - for (i = 0;; i++) - { - en_idx = odbcapi_symtab[i].en_idx; - - if (en_idx == en_NullProc) - { - break; - } - - if (en_idx == idx) - { - *phproc = _iodbcdm_dllproc (penv->hdll, - odbcapi_symtab[i].symbol); - - break; - } - } - } - - return *phproc; -} - - -HDLL -_iodbcdm_dllopen (char FAR * path) -{ - return (HDLL) DLL_OPEN (path); -} - - -HPROC -_iodbcdm_dllproc (HDLL hdll, char FAR * sym) -{ - return (HPROC) DLL_PROC (hdll, sym); -} - - -int -_iodbcdm_dllclose (HDLL hdll) -{ - DLL_CLOSE (hdll); - - return 0; -} - - -char * -_iodbcdm_dllerror () -{ - return DLL_ERROR (); -} - diff --git a/src/iodbc/dlproc.h b/src/iodbc/dlproc.h deleted file mode 100644 index 663055599d..0000000000 --- a/src/iodbc/dlproc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * dlproc.h - * - * $Id$ - * - * Load driver and resolve driver's function entry point - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _DLPROC_H -#define _DLPROC_H - -#include "dlf.h" - -typedef RETCODE (FAR * HPROC) (); - -#ifdef DLDAPI_SVR4_DLFCN -#include -typedef void *HDLL; -#endif - -#ifdef DLDAPI_HP_SHL -#include -typedef shl_t HDLL; -#endif - -#if defined(DLDAPI_AIX_LOAD) || defined(__DECCXX) -typedef void *HDLL; -#endif - -extern HPROC _iodbcdm_getproc (); -extern HDLL _iodbcdm_dllopen (char FAR * dll); -extern HPROC _iodbcdm_dllproc (HDLL hdll, char FAR * sym); -extern char FAR *_iodbcdm_dllerror (); -extern int _iodbcdm_dllclose (HDLL hdll); - -#define SQL_NULL_HDLL ((HDLL)NULL) -#define SQL_NULL_HPROC ((HPROC)NULL) -#endif diff --git a/src/iodbc/execute.c b/src/iodbc/execute.c deleted file mode 100644 index 64d71d6ba5..0000000000 --- a/src/iodbc/execute.c +++ /dev/null @@ -1,768 +0,0 @@ -/* - * execute.c - * - * $Id$ - * - * Invoke a query - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -static void -do_cursoropen (STMT_t FAR * pstmt) -{ - RETCODE retcode; - SWORD ncol; - - pstmt->state = en_stmt_executed; - - retcode = SQLNumResultCols (pstmt, &ncol); - - if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) - { - if (ncol) - { - pstmt->state = en_stmt_cursoropen; - pstmt->cursor_state = en_stmt_cursor_opened; - } - else - { - pstmt->state = en_stmt_executed; - pstmt->cursor_state = en_stmt_cursor_no; - } - } -} - - -RETCODE SQL_API -SQLExecute (HSTMT hstmt) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - sqlstat = en_S1010; - break; - - case en_stmt_executed: - if (!pstmt->prep_state) - { - sqlstat = en_S1010; - } - break; - - case en_stmt_cursoropen: - if (!pstmt->prep_state) - { - sqlstat = en_S1010; - } - break; - - case en_stmt_fetched: - case en_stmt_xfetched: - if (!pstmt->prep_state) - { - sqlstat = en_S1010; - } - else - { - sqlstat = en_24000; - } - break; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - default: - break; - } - } - else if (pstmt->asyn_on != en_Execute) - { - sqlstat = en_S1010; - } - - if (sqlstat == en_00000) - { - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Execute); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Execute, - (pstmt->dhstmt)) - - /* stmt state transition */ - if (pstmt->asyn_on == en_Execute) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NEED_DATA: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_prepared: - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - do_cursoropen (hstmt); - break; - - case SQL_NEED_DATA: - pstmt->state = en_stmt_needdata; - pstmt->need_on = en_Execute; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_Execute; - break; - - default: - break; - } - break; - - case en_stmt_executed: - switch (retcode) - { - case SQL_ERROR: - pstmt->state = en_stmt_allocated; - pstmt->cursor_state = en_stmt_cursor_no; - pstmt->prep_state = 0; - break; - - case SQL_NEED_DATA: - pstmt->state = en_stmt_needdata; - pstmt->need_on = en_Execute; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_Execute; - break; - - default: - break; - } - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLExecDirect ( - HSTMT hstmt, - UCHAR FAR * szSqlStr, - SDWORD cbSqlStr) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - - int sqlstat = en_00000; - RETCODE retcode = SQL_SUCCESS; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check arguments */ - if (szSqlStr == NULL) - { - sqlstat = en_S1009; - } - else if (cbSqlStr < 0 && cbSqlStr != SQL_NTS) - { - sqlstat = en_S1090; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_fetched: - case en_stmt_xfetched: - sqlstat = en_24000; - break; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - default: - break; - } - } - else if (pstmt->asyn_on != en_ExecDirect) - { - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ExecDirect); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ExecDirect, - (pstmt->dhstmt, szSqlStr, cbSqlStr)) - - /* stmt state transition */ - if (pstmt->asyn_on == en_ExecDirect) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NEED_DATA: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - if (pstmt->state <= en_stmt_executed) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - do_cursoropen (hstmt); - break; - - case SQL_NEED_DATA: - pstmt->state = en_stmt_needdata; - pstmt->need_on = en_ExecDirect; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_ExecDirect; - break; - - case SQL_ERROR: - pstmt->state = en_stmt_allocated; - pstmt->cursor_state = en_stmt_cursor_no; - pstmt->prep_state = 0; - break; - - default: - break; - } - } - - return retcode; -} - - -RETCODE SQL_API -SQLPutData ( - HSTMT hstmt, - PTR rgbValue, - SDWORD cbValue) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument value */ - if (rgbValue == NULL && - (cbValue != SQL_DEFAULT_PARAM && cbValue != SQL_NULL_DATA)) - { - PUSHSQLERR (pstmt->herr, en_S1009); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - if (pstmt->state <= en_stmt_xfetched) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - } - else if (pstmt->asyn_on != en_PutData) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_PutData); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_PutData, - (pstmt->dhstmt, rgbValue, cbValue)) - - /* state transition */ - if (pstmt->asyn_on == en_PutData) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - /* must in mustput or canput states */ - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - pstmt->state = en_stmt_canput; - break; - - case SQL_ERROR: - switch (pstmt->need_on) - { - case en_ExecDirect: - pstmt->state = en_stmt_allocated; - pstmt->need_on = en_NullProc; - break; - - case en_Execute: - if (pstmt->prep_state) - { - pstmt->state = en_stmt_prepared; - pstmt->need_on = en_NullProc; - } - break; - - case en_SetPos: - /* Is this possible ???? */ - pstmt->state = en_stmt_xfetched; - break; - - default: - break; - } - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_PutData; - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLParamData ( - HSTMT hstmt, - PTR FAR * prgbValue) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - if (pstmt->state <= en_stmt_xfetched) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - } - else if (pstmt->asyn_on != en_ParamData) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ParamData); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ParamData, - (pstmt->dhstmt, prgbValue)) - - /* state transition */ - if (pstmt->asyn_on == en_ParamData) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - if (pstmt->state < en_stmt_needdata) - { - return retcode; - } - - switch (retcode) - { - case SQL_ERROR: - switch (pstmt->need_on) - { - case en_ExecDirect: - pstmt->state = en_stmt_allocated; - break; - - case en_Execute: - pstmt->state = en_stmt_prepared; - break; - - case en_SetPos: - pstmt->state = en_stmt_xfetched; - pstmt->cursor_state - = en_stmt_cursor_xfetched; - break; - - default: - break; - } - pstmt->need_on = en_NullProc; - break; - - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - switch (pstmt->state) - { - case en_stmt_needdata: - pstmt->state = en_stmt_mustput; - break; - - case en_stmt_canput: - switch (pstmt->need_on) - { - case en_SetPos: - pstmt->state - = en_stmt_xfetched; - pstmt->cursor_state - = en_stmt_cursor_xfetched; - break; - - case en_ExecDirect: - case en_Execute: - do_cursoropen (hstmt); - break; - - default: - break; - } - break; - - default: - break; - } - pstmt->need_on = en_NullProc; - break; - - case SQL_NEED_DATA: - pstmt->state = en_stmt_mustput; - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLNumParams ( - HSTMT hstmt, - SWORD FAR * pcpar) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - - default: - break; - } - } - else if (pstmt->asyn_on != en_NumParams) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_NumParams); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_NumParams, - (pstmt->dhstmt, pcpar)) - - /* state transition */ - if (pstmt->asyn_on == en_NumParams) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - break; - - default: - return retcode; - } - } - - if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_NumParams; - } - - return retcode; -} - - -RETCODE SQL_API -SQLDescribeParam ( - HSTMT hstmt, - UWORD ipar, - SWORD FAR * pfSqlType, - UDWORD FAR * pcbColDef, - SWORD FAR * pibScale, - SWORD FAR * pfNullable) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - if (ipar == 0) - { - PUSHSQLERR (pstmt->herr, en_S1093); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - - default: - break; - } - } - else if (pstmt->asyn_on != en_DescribeParam) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_DescribeParam); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_DescribeParam, - (pstmt->dhstmt, ipar, pfSqlType, pcbColDef, pibScale, pfNullable)) - - /* state transition */ - if (pstmt->asyn_on == en_DescribeParam) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - break; - - default: - return retcode; - } - } - - if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_DescribeParam; - } - - return retcode; -} diff --git a/src/iodbc/fetch.c b/src/iodbc/fetch.c deleted file mode 100644 index 8bf06274b6..0000000000 --- a/src/iodbc/fetch.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * fetch.c - * - * $Id$ - * - * Fetch query result - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -RETCODE SQL_API -SQLFetch (HSTMT hstmt) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - case en_stmt_xfetched: - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - - default: - break; - } - } - else if (pstmt->asyn_on != en_Fetch) - { - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Fetch); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Fetch, - (pstmt->dhstmt)) - - /* state transition */ - if (pstmt->asyn_on == en_Fetch) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NO_DATA_FOUND: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_cursoropen: - case en_stmt_fetched: - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - pstmt->state = en_stmt_fetched; - pstmt->cursor_state = en_stmt_cursor_fetched; - break; - - case SQL_NO_DATA_FOUND: - if (pstmt->prep_state) - { - pstmt->state = en_stmt_prepared; - } - else - { - - pstmt->state = en_stmt_allocated; - } - pstmt->cursor_state = en_stmt_cursor_no; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_Fetch; - break; - - default: - break; - } - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLExtendedFetch ( - HSTMT hstmt, - UWORD fFetchType, - SDWORD irow, - UDWORD FAR * pcrow, - UWORD FAR * rgfRowStatus) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check fetch type */ - if (fFetchType < SQL_FETCH_NEXT || fFetchType > SQL_FETCH_BOOKMARK) - { - /* Unlike MS driver manager(i.e. DM), - * we don't check driver's ODBC version - * against SQL_FETCH_RESUME (only 1.0) - * and SQL_FETCH_BOOKMARK (only 2.0). - */ - PUSHSQLERR (pstmt->herr, en_S1106); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - case en_stmt_fetched: - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - - default: - break; - } - } - else if (pstmt->asyn_on != en_ExtendedFetch) - { - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ExtendedFetch); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ExtendedFetch, - (pstmt->dhstmt, fFetchType, irow, pcrow, rgfRowStatus)) - - /* state transition */ - if (pstmt->asyn_on == en_ExtendedFetch) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NO_DATA_FOUND: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_cursoropen: - case en_stmt_xfetched: - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NO_DATA_FOUND: - pstmt->state = en_stmt_xfetched; - pstmt->cursor_state = en_stmt_cursor_xfetched; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_ExtendedFetch; - break; - - default: - break; - } - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLGetData ( - HSTMT hstmt, - UWORD icol, - SWORD fCType, - PTR rgbValue, - SDWORD cbValueMax, - SDWORD FAR * pcbValue) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - if (rgbValue == NULL) - { - sqlstat = en_S1009; - } - else if (cbValueMax < 0) - { - sqlstat = en_S1090; - } - else - { - switch (fCType) - { - case SQL_C_DEFAULT: - case SQL_C_CHAR: - case SQL_C_BINARY: - case SQL_C_BIT: - case SQL_C_TINYINT: - case SQL_C_STINYINT: - case SQL_C_UTINYINT: - case SQL_C_SHORT: - case SQL_C_SSHORT: - case SQL_C_USHORT: - case SQL_C_LONG: - case SQL_C_SLONG: - case SQL_C_ULONG: - case SQL_C_FLOAT: - case SQL_C_DOUBLE: - case SQL_C_DATE: - case SQL_C_TIME: - case SQL_C_TIMESTAMP: - break; - - default: - sqlstat = en_S1003; - break; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - case en_stmt_executed: - case en_stmt_cursoropen: - sqlstat = en_24000; - break; - - default: - break; - } - } - else if (pstmt->asyn_on != en_GetData) - { - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetData); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_GetData, - (pstmt->dhstmt, icol, fCType, rgbValue, cbValueMax, pcbValue)) - - /* state transition */ - if (pstmt->asyn_on == en_GetData) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NO_DATA_FOUND: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_fetched: - case en_stmt_xfetched: - if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_GetData; - break; - } - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLMoreResults (HSTMT hstmt) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT - || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - return SQL_NO_DATA_FOUND; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - - default: - break; - } - } - else if (pstmt->asyn_on != en_MoreResults) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_MoreResults); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_MoreResults, - (pstmt->dhstmt)) - - /* state transition */ - if (pstmt->asyn_on == en_MoreResults) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NO_DATA_FOUND: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - /* driver should return SQL_NO_DATA_FOUND */ - break; - - case en_stmt_executed: - if (retcode == SQL_NO_DATA_FOUND) - { - if (pstmt->prep_state) - { - pstmt->state = en_stmt_prepared; - } - else - { - pstmt->state = en_stmt_allocated; - } - } - else if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_MoreResults; - } - break; - - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - if (retcode == SQL_SUCCESS) - { - break; - } - else if (retcode == SQL_NO_DATA_FOUND) - { - if (pstmt->prep_state) - { - pstmt->state = en_stmt_prepared; - } - else - { - pstmt->state = en_stmt_allocated; - } - } - else if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_MoreResults; - } - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLSetPos ( - HSTMT hstmt, - UWORD irow, - UWORD fOption, - UWORD fLock) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument value */ - if (fOption > SQL_ADD || fLock > SQL_LOCK_UNLOCK) - { - PUSHSQLERR (pstmt->herr, en_S1009); - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - case en_stmt_fetched: - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - case en_stmt_executed: - case en_stmt_cursoropen: - sqlstat = en_24000; - break; - - default: - break; - } - } - else if (pstmt->asyn_on != en_SetPos) - { - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetPos); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetPos, - (pstmt->dhstmt, irow, fOption, fLock)) - - /* state transition */ - if (pstmt->asyn_on == en_SetPos) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_NEED_DATA: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - /* now, the only possible init state is 'xfetched' */ - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - break; - - case SQL_NEED_DATA: - pstmt->state = en_stmt_needdata; - pstmt->need_on = en_SetPos; - break; - - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_SetPos; - break; - - default: - break; - } - - return retcode; -} diff --git a/src/iodbc/hdbc.c b/src/iodbc/hdbc.c deleted file mode 100644 index afb6472d19..0000000000 --- a/src/iodbc/hdbc.c +++ /dev/null @@ -1,811 +0,0 @@ -/* - * hdbc.c - * - * $Id$ - * - * Data source connect object management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" -#include "stdio.h" - -extern RETCODE _iodbcdm_driverunload(); - - -RETCODE SQL_API -SQLAllocConnect ( - HENV henv, - HDBC FAR * phdbc) -{ - GENV_t FAR *genv = (GENV_t FAR *) henv; - DBC_t FAR *pdbc; - -#if (ODBCVER >= 0x0300) - if (henv == SQL_NULL_HENV || genv->type != SQL_HANDLE_ENV) -#else - if (henv == SQL_NULL_HENV) -#endif - - { - return SQL_INVALID_HANDLE; - } - - if (phdbc == NULL) - { - PUSHSQLERR (genv->herr, en_S1009); - - return SQL_ERROR; - } - - pdbc = (DBC_t FAR *) MEM_ALLOC (sizeof (DBC_t)); - - if (pdbc == NULL) - { - *phdbc = SQL_NULL_HDBC; - - PUSHSQLERR (genv->herr, en_S1001); - - return SQL_ERROR; - } - -#if (ODBCVER >= 0x0300) - pdbc->type = SQL_HANDLE_DBC; -#endif - - /* insert this dbc entry into the link list */ - pdbc->next = genv->hdbc; - genv->hdbc = pdbc; - pdbc->genv = henv; - - pdbc->henv = SQL_NULL_HENV; - pdbc->hstmt = SQL_NULL_HSTMT; - pdbc->herr = SQL_NULL_HERR; - pdbc->dhdbc = SQL_NULL_HDBC; - pdbc->state = en_dbc_allocated; - pdbc->trace = 0; - pdbc->tstm = NULL; - pdbc->tfile = NULL; - - /* set connect options to default values */ - pdbc->access_mode = SQL_MODE_DEFAULT; - pdbc->autocommit = SQL_AUTOCOMMIT_DEFAULT; - pdbc->current_qualifier = NULL; - pdbc->login_timeout = 0UL; - pdbc->odbc_cursors = SQL_CUR_DEFAULT; - pdbc->packet_size = 0UL; - pdbc->quiet_mode = (UDWORD) NULL; - pdbc->txn_isolation = SQL_TXN_READ_UNCOMMITTED; - pdbc->cb_commit = (SWORD) SQL_CB_DELETE; - pdbc->cb_rollback = (SWORD) SQL_CB_DELETE; - - *phdbc = (HDBC) pdbc; - - return SQL_SUCCESS; -} - - -RETCODE SQL_API -SQLFreeConnect (HDBC hdbc) -{ - GENV_t FAR *genv; - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - DBC_t FAR *tpdbc; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pdbc->state != en_dbc_allocated) - { - PUSHSQLERR (pdbc->herr, en_S1010); - - return SQL_ERROR; - } - - genv = (GENV_t FAR *) pdbc->genv; - - for (tpdbc = (DBC_t FAR *) genv->hdbc; - tpdbc != NULL; - tpdbc = tpdbc->next) - { - if (pdbc == tpdbc) - { - genv->hdbc = pdbc->next; - break; - } - - if (pdbc == tpdbc->next) - { - tpdbc->next = pdbc->next; - break; - } - } - - /* free this dbc */ - _iodbcdm_driverunload (pdbc); - _iodbcdm_freesqlerrlist (pdbc->herr); - - if (pdbc->tfile) - { - MEM_FREE (pdbc->tfile); - } - - SQLSetConnectOption (pdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF); - - MEM_FREE (pdbc); - - return SQL_SUCCESS; -} - - -RETCODE SQL_API -SQLSetConnectOption ( - HDBC hdbc, - UWORD fOption, - UDWORD vParam) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - STMT_t FAR *pstmt; - HPROC hproc = SQL_NULL_HPROC; - int sqlstat = en_00000; - RETCODE retcode = SQL_SUCCESS; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check option */ - if (fOption < SQL_CONN_OPT_MIN || - (fOption > SQL_CONN_OPT_MAX && fOption < SQL_CONNECT_OPT_DRVR_START)) - { - PUSHSQLERR (pdbc->herr, en_S1092); - - return SQL_ERROR; - } - - /* check state of connection handle */ - switch (pdbc->state) - { - case en_dbc_allocated: - if (fOption == SQL_TRANSLATE_DLL || fOption == SQL_TRANSLATE_OPTION) - { - /* This two options are only meaningful - * for specified driver. So, has to be - * set after a dirver has been loaded. - */ - sqlstat = en_08003; - break; - } - - if (fOption >= SQL_CONNECT_OPT_DRVR_START && pdbc->henv == SQL_NULL_HENV) - /* An option only meaningful for drivers - * is passed before loading a driver. - * We classify this as an invalid option error. - * This is not documented by MS SDK guide. - */ - { - sqlstat = en_S1092; - break; - } - break; - - case en_dbc_needdata: - sqlstat = en_S1010; - break; - - case en_dbc_connected: - case en_dbc_hstmt: - if (fOption == SQL_ODBC_CURSORS) - { - sqlstat = en_08002; - } - break; - - default: - break; - } - - /* check state of statement handle(s) */ - for (pstmt = (STMT_t FAR *) pdbc->hstmt; - pstmt != NULL && sqlstat == en_00000; - pstmt = (STMT_t FAR *) pstmt->next) - { - if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc) - { - sqlstat = en_S1010; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pdbc->herr, sqlstat); - - return SQL_ERROR; - } - - if (fOption == SQL_OPT_TRACE) - /* tracing flag can be set before and after connect - * and only meaningful for driver manager(actually - * there is only one tracing file under one global - * environment). - */ - { - switch (vParam) - { - case SQL_OPT_TRACE_ON: - if (pdbc->tfile == NULL) - { - pdbc->tfile = (char FAR *) MEM_ALLOC (1 + - STRLEN (SQL_OPT_TRACE_FILE_DEFAULT)); - - if (pdbc->tfile == NULL) - { - PUSHSQLERR (pdbc->herr, en_S1001); - - return SQL_ERROR; - } - - STRCPY (pdbc->tfile, SQL_OPT_TRACE_FILE_DEFAULT); - } - - if (pdbc->tstm == NULL) - { - -#if defined(stderr) && defined(stdout) - if (STREQ (pdbc->tfile, "stderr")) - { - pdbc->tstm = stderr; - } - else if (STREQ (pdbc->tfile, "stdout")) - { - pdbc->tstm = stdout; - } - else -#endif - - { - pdbc->tstm - = fopen (pdbc->tfile, "a+"); - } - - if (pdbc->tstm) - { - pdbc->trace = 1; - } - else - { - pdbc->trace = 0; - - sqlstat = en_IM013; - retcode = SQL_ERROR; - } - } - break; - - case SQL_OPT_TRACE_OFF: - if (pdbc->trace && pdbc->tstm) - { - -#if defined(stderr) && defined(stdout) - if (stderr != (FILE FAR *) (pdbc->tstm) - && stdout != (FILE FAR *) (pdbc->tstm)) -#endif - - { - fclose (pdbc->tstm); - } - } - pdbc->tstm = NULL; - pdbc->trace = 0; - break; - - default: - PUSHSQLERR (pdbc->herr, en_S1009); - retcode = SQL_ERROR; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pdbc->herr, sqlstat); - } - - return retcode; - } - - if (fOption == SQL_OPT_TRACEFILE) - /* Tracing file can be set before and after connect - * and only meaningful for driver manager. - */ - { - if (vParam == 0UL || ((char FAR *) vParam)[0] == 0) - { - PUSHSQLERR (pdbc->herr, en_S1009); - - return SQL_ERROR; - } - - if (pdbc->tfile && STREQ (pdbc->tfile, vParam)) - { - return SQL_SUCCESS; - } - - if (pdbc->trace) - { - PUSHSQLERR (pdbc->herr, en_IM014); - - return SQL_ERROR; - } - - if (pdbc->tfile) - { - MEM_FREE (pdbc->tfile); - } - - pdbc->tfile = (char FAR *) MEM_ALLOC (1 + STRLEN (vParam)); - - if (pdbc->tfile == NULL) - { - PUSHSQLERR (pdbc->herr, en_S1001); - - return SQL_ERROR; - } - - STRCPY (pdbc->tfile, vParam); - - return SQL_SUCCESS; - } - - if (pdbc->state != en_dbc_allocated) - { - /* If already connected, then, driver's odbc call - * will be invoked. Otherwise, we only save the options - * and delay the setting process until the connection - * been established. - */ - hproc = _iodbcdm_getproc (hdbc, en_SetConnectOption); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_SetConnectOption, - (pdbc->dhdbc, fOption, vParam)) - - if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - { - return retcode; - } - } - - /* - * Now, either driver's odbc call was successed or - * driver has not been loaded yet. In the first case, we - * need flip flag for(such as access_mode, autocommit, ...) - * for our finit state machine. While in the second case, - * we need save option values(such as current_qualifier, ...) - * for delaied setting. So, ... - */ - - /* No matter what state we are(i.e. allocated or connected, ..) - * we need to flip the flag. - */ - switch (fOption) - { - case SQL_ACCESS_MODE: - pdbc->access_mode = vParam; - break; - - case SQL_AUTOCOMMIT: - pdbc->autocommit = vParam; - break; - } - - /* state transition */ - if (pdbc->state != en_dbc_allocated) - { - return retcode; - } - - /* Only 'allocated' state is possible here, and we need to - * save the options for delaied setting. - */ - switch (fOption) - { - case SQL_CURRENT_QUALIFIER: - if (pdbc->current_qualifier != NULL) - { - MEM_FREE (pdbc->current_qualifier); - } - - if (vParam == 0UL) - { - pdbc->current_qualifier = NULL; - - break; - } - - pdbc->current_qualifier - = (char FAR *) MEM_ALLOC ( - STRLEN (vParam) + 1); - - if (pdbc->current_qualifier == NULL) - { - PUSHSQLERR (pdbc->herr, en_S1001); - return SQL_ERROR; - } - - STRCPY (pdbc->current_qualifier, vParam); - break; - - case SQL_LOGIN_TIMEOUT: - pdbc->login_timeout = vParam; - break; - - case SQL_ODBC_CURSORS: - pdbc->odbc_cursors = vParam; - break; - - case SQL_PACKET_SIZE: - pdbc->packet_size = vParam; - break; - - case SQL_QUIET_MODE: - pdbc->quiet_mode = vParam; - break; - - case SQL_TXN_ISOLATION: - pdbc->txn_isolation = vParam; - break; - - default: - /* Since we didn't save the option value for delaied - * setting, we should raise an error here. - */ - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLGetConnectOption ( - HDBC hdbc, - UWORD fOption, - PTR pvParam) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - int sqlstat = en_00000; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check option */ - if (fOption < SQL_CONN_OPT_MIN || - (fOption > SQL_CONN_OPT_MAX && fOption < SQL_CONNECT_OPT_DRVR_START)) - { - PUSHSQLERR (pdbc->herr, en_S1092); - - return SQL_ERROR; - } - - /* check state */ - switch (pdbc->state) - { - case en_dbc_allocated: - if (fOption != SQL_ACCESS_MODE - && fOption != SQL_AUTOCOMMIT - && fOption != SQL_LOGIN_TIMEOUT - && fOption != SQL_OPT_TRACE - && fOption != SQL_OPT_TRACEFILE) - { - sqlstat = en_08003; - } - /* MS ODBC SDK document only - * allows SQL_ACCESS_MODE - * and SQL_AUTOCOMMIT in this - * dbc state. We allow another - * two options, because they - * are only meaningful for driver - * manager. - */ - break; - - case en_dbc_needdata: - sqlstat = en_S1010; - break; - - default: - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pdbc->herr, sqlstat); - - return SQL_ERROR; - } - - /* Tracing and tracing file options are only - * meaningful for driver manager - */ - if (fOption == SQL_OPT_TRACE) - { - if (pdbc->trace) - *((UDWORD *) pvParam) = (UDWORD) SQL_OPT_TRACE_ON; - else - *((UDWORD *) pvParam) = (UDWORD) SQL_OPT_TRACE_OFF; - - return SQL_SUCCESS; - } - - if (fOption == SQL_OPT_TRACEFILE) - { - STRCPY (pvParam, pdbc->tfile); - - return SQL_ERROR; - } - - if (pdbc->state != en_dbc_allocated) - /* if already connected, we will invoke driver's function */ - { - hproc = _iodbcdm_getproc (hdbc, en_GetConnectOption); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_GetConnectOption, - (pdbc->dhdbc, fOption, pvParam)) - - return retcode; - } - - /* We needn't to handle options which are not allowed - * to be *get* at a allocated dbc state(and two tracing - * options which has been handled and returned). Thus, - * there are only two possible cases. - */ - switch (fOption) - { - case SQL_ACCESS_MODE: - *((UDWORD *) pvParam) = pdbc->access_mode; - break; - - case SQL_AUTOCOMMIT: - *((UDWORD *) pvParam) = pdbc->autocommit; - break; - - case SQL_LOGIN_TIMEOUT: - *((UDWORD *) pvParam) = pdbc->login_timeout; - break; - - default: - break; - } - - return SQL_SUCCESS; -} - - -static RETCODE -_iodbcdm_transact ( - HDBC hdbc, - UWORD fType) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - STMT_t FAR *pstmt; - HPROC hproc; - RETCODE retcode; - - /* check state */ - switch (pdbc->state) - { - case en_dbc_allocated: - case en_dbc_needdata: - PUSHSQLERR (pdbc->herr, en_08003); - return SQL_ERROR; - - case en_dbc_connected: - return SQL_SUCCESS; - - case en_dbc_hstmt: - default: - break; - } - - for (pstmt = (STMT_t FAR *) (pdbc->hstmt); - pstmt != NULL; - pstmt = pstmt->next) - { - if (pstmt->state >= en_stmt_needdata - || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pdbc->herr, en_S1010); - - return SQL_ERROR; - } - } - - hproc = _iodbcdm_getproc (hdbc, en_Transact); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_Transact, - (SQL_NULL_HENV, pdbc->dhdbc, fType)) - - /* state transition */ - if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - { - return retcode; - } - - pdbc->state = en_dbc_hstmt; - - for (pstmt = (STMT_t FAR *) (pdbc->hstmt); - pstmt != NULL; - pstmt = pstmt->next) - { - switch (pstmt->state) - { - case en_stmt_prepared: - if (pdbc->cb_commit == SQL_CB_DELETE - || pdbc->cb_rollback == SQL_CB_DELETE) - { - pstmt->state = en_stmt_allocated; - pstmt->prep_state = 0; - break; - } - break; - - case en_stmt_executed: - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - if (!pstmt->prep_state - && pdbc->cb_commit != SQL_CB_PRESERVE - && pdbc->cb_rollback != SQL_CB_PRESERVE) - { - pstmt->state = en_stmt_allocated; - pstmt->prep_state = 0; - pstmt->cursor_state = en_stmt_cursor_no; - break; - } - - if (pstmt->prep_state) - { - if (pdbc->cb_commit == SQL_CB_DELETE - || pdbc->cb_rollback == SQL_CB_DELETE) - { - pstmt->state = en_stmt_allocated; - pstmt->prep_state = 0; - pstmt->cursor_state = en_stmt_cursor_no; - break; - } - - if (pdbc->cb_commit == SQL_CB_CLOSE - || pdbc->cb_rollback == SQL_CB_CLOSE) - { - pstmt->state - = en_stmt_prepared; - pstmt->cursor_state - = en_stmt_cursor_no; - break; - } - break; - } - break; - - default: - break; - } - } - - return retcode; -} - - -RETCODE SQL_API -SQLTransact ( - HENV henv, - HDBC hdbc, - UWORD fType) -{ - GENV_t FAR *genv = (GENV_t FAR *) henv; - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - HERR herr; - RETCODE retcode = 0; - - if (hdbc != SQL_NULL_HDBC) - { - herr = pdbc->herr; - } - else if (henv != SQL_NULL_HENV) - { - herr = genv->herr; - } - else - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - if (fType != SQL_COMMIT - && fType != SQL_ROLLBACK) - { - PUSHSQLERR (herr, en_S1012); - - return SQL_ERROR; - } - - if (hdbc != SQL_NULL_HDBC) - { - retcode = _iodbcdm_transact (hdbc, fType); - } - else - { - for (pdbc = (DBC_t FAR *) (genv->hdbc); - pdbc != NULL; - pdbc = pdbc->next) - { - retcode |= _iodbcdm_transact (hdbc, fType); - } - } - - if (retcode != SQL_SUCCESS - && retcode != SQL_SUCCESS_WITH_INFO) - { - /* fail on one of the connection */ - return SQL_ERROR; - } - - return retcode; -} diff --git a/src/iodbc/hdbc.h b/src/iodbc/hdbc.h deleted file mode 100644 index 659eadcc05..0000000000 --- a/src/iodbc/hdbc.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * hdbc.h - * - * $Id$ - * - * Data source connect object management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _HDBC_H -#define _HDBC_H - -typedef struct DBC - { - int type; /* must be 1st field */ - struct DBC FAR * - next; - - HENV genv; /* back point to global env object */ - - HDBC dhdbc; /* driver's private dbc */ - HENV henv; /* back point to instant env object */ - HSTMT hstmt; /* list of statement object handle(s) */ - HERR herr; - - int state; - - /* options */ - UDWORD access_mode; - UDWORD autocommit; - - UDWORD login_timeout; - UDWORD odbc_cursors; - UDWORD packet_size; - UDWORD quiet_mode; - UDWORD txn_isolation; - SWORD cb_commit; - SWORD cb_rollback; - - char FAR * - current_qualifier; - - int trace; /* trace flag */ - char FAR * - tfile; - void FAR * - tstm; /* trace stream */ - } -DBC_t; - -/* - * Note: - * - ODBC applications can see address of driver manager's - * connection object, i.e connection handle -- a void pointer, - * but not detail of it. ODBC applications can neither see - * detail driver's connection object nor its address. - * - * - ODBC driver manager knows its own connection objects and - * exposes their address to an ODBC application. Driver manager - * also knows address of driver's connection objects and keeps - * it via dhdbc field in driver manager's connection object. - * - * - ODBC driver exposes address of its own connection object to - * driver manager without detail. - * - * - Applications can get driver's connection object handle by - * SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC. - */ - -enum - { - en_dbc_allocated, - en_dbc_needdata, - en_dbc_connected, - en_dbc_hstmt - }; -#endif diff --git a/src/iodbc/henv.c b/src/iodbc/henv.c deleted file mode 100644 index 54dbac8dee..0000000000 --- a/src/iodbc/henv.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * henv.c - * - * $Id$ - * - * Environment object management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" - -#include "itrace.h" - -RETCODE SQL_API -SQLAllocEnv (HENV FAR * phenv) -{ - GENV_t FAR *genv; - - genv = (GENV_t *) MEM_ALLOC (sizeof (GENV_t)); - - if (genv == NULL) - { - *phenv = SQL_NULL_HENV; - - return SQL_ERROR; - } - -#if (ODBCVER >= 0x0300 ) - genv->type = SQL_HANDLE_ENV; -#endif - - genv->henv = SQL_NULL_HENV; /* driver's env list */ - genv->hdbc = SQL_NULL_HDBC; /* driver's dbc list */ - genv->herr = SQL_NULL_HERR; /* err list */ - - *phenv = (HENV) genv; - - return SQL_SUCCESS; -} - - -RETCODE SQL_API -SQLFreeEnv (HENV henv) -{ - GENV_t FAR *genv = (GENV_t *) henv; - - if (henv == SQL_NULL_HENV) - { - return SQL_INVALID_HANDLE; - } - - if (genv->hdbc != SQL_NULL_HDBC) - { - PUSHSQLERR (genv->herr, en_S1010); - - return SQL_ERROR; - } - - _iodbcdm_freesqlerrlist (genv->herr); - - MEM_FREE (henv); - - return SQL_SUCCESS; -} diff --git a/src/iodbc/henv.ci b/src/iodbc/henv.ci deleted file mode 100644 index c320b45f8d..0000000000 --- a/src/iodbc/henv.ci +++ /dev/null @@ -1,117 +0,0 @@ -/* - * henv.ci - * - * $Id$ - * - * Function names - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* There are some exceptions : - * on FreeBSD 2.x CLI_NAME_PREFIX is defined in Config.mk as "_SQL" - * on HP/UX s300/s400, CLI_NAME_PREFIX is defined in Config.mk as "_SQL" - * on AIX 3.x 4.x, CLI_NAME_PREFIX is defined in Config.mk as ".SQL" - */ -#ifndef CLI_NAME_PREFIX -# define CLI_NAME_PREFIX "SQL" /* using call by value prefix */ -#else -# ifdef NEED_USCORE -# define CLI_NAME_PREFIX "_SQL" -# endif -#endif - -static struct - { - int en_idx; - char *symbol; - } -odbcapi_symtab[] = { - -#if (ODBCVER >= 0x0300) - { en_AllocHandle CLI_NAME_PREFIX "AllocHandle" }, - { en_FreeHandle CLI_NAME_PREFIX "FreeHandle" }, -#endif - { en_AllocEnv, CLI_NAME_PREFIX "AllocEnv" }, - { en_AllocConnect, CLI_NAME_PREFIX "AllocConnect" }, - { en_Connect, CLI_NAME_PREFIX "Connect" }, - { en_DriverConnect, CLI_NAME_PREFIX "DriverConnect" }, - { en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect" }, - - { en_DataSources, CLI_NAME_PREFIX "DataSources" }, - { en_Drivers, CLI_NAME_PREFIX "Driver" }, - { en_GetInfo, CLI_NAME_PREFIX "GetInfo" }, - { en_GetFunctions, CLI_NAME_PREFIX "GetFunctions" }, - { en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo" }, - - { en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption" }, - { en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption" }, - { en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption" }, - { en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption" }, - - { en_AllocStmt, CLI_NAME_PREFIX "AllocStmt" }, - { en_Prepare, CLI_NAME_PREFIX "Prepare" }, - { en_BindParameter, CLI_NAME_PREFIX "BindParameter" }, - { en_ParamOptions, CLI_NAME_PREFIX "ParamOptions" }, - { en_GetCursorName, CLI_NAME_PREFIX "GetCursorName" }, - { en_SetCursorName, CLI_NAME_PREFIX "SetCursorName" }, - { en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions" }, - { en_SetParam, CLI_NAME_PREFIX "SetParam" }, - - { en_Execute, CLI_NAME_PREFIX "Execute" }, - { en_ExecDirect, CLI_NAME_PREFIX "ExecDirect" }, - { en_NativeSql, CLI_NAME_PREFIX "NativeSql" }, - { en_DescribeParam, CLI_NAME_PREFIX "DescribeParam" }, - { en_NumParams, CLI_NAME_PREFIX "NumParams" }, - { en_ParamData, CLI_NAME_PREFIX "ParamData" }, - { en_PutData, CLI_NAME_PREFIX "PutData" }, - - { en_RowCount, CLI_NAME_PREFIX "RowCount" }, - { en_NumResultCols, CLI_NAME_PREFIX "NumResultCols" }, - { en_DescribeCol, CLI_NAME_PREFIX "DescribeCol" }, - { en_ColAttributes, CLI_NAME_PREFIX "ColAttributes" }, - { en_BindCol, CLI_NAME_PREFIX "BindCol" }, - { en_Fetch, CLI_NAME_PREFIX "Fetch" }, - { en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch" }, - { en_GetData, CLI_NAME_PREFIX "GetData" }, - { en_SetPos, CLI_NAME_PREFIX "SetPos" }, - { en_MoreResults, CLI_NAME_PREFIX "MoreResults" }, - { en_Error, CLI_NAME_PREFIX "Error" }, - - { en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges" }, - { en_Columns, CLI_NAME_PREFIX "Columns" }, - { en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys" }, - { en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys" }, - { en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns" }, - { en_Procedures, CLI_NAME_PREFIX "Procedures" }, - { en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns" }, - { en_Statistics, CLI_NAME_PREFIX "Statistics" }, - { en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges" }, - { en_Tables, CLI_NAME_PREFIX "Tables" }, - - { en_FreeStmt, CLI_NAME_PREFIX "FreeStmt" }, - { en_Cancel, CLI_NAME_PREFIX "Cancel" }, - { en_Transact, CLI_NAME_PREFIX "Transact" }, - - { en_Disconnect, CLI_NAME_PREFIX "Disconnect" }, - { en_FreeConnect, CLI_NAME_PREFIX "FreeConnect" }, - { en_FreeEnv, CLI_NAME_PREFIX "FreeEnv" }, - - { en_NullProc, NULL } -}; diff --git a/src/iodbc/henv.h b/src/iodbc/henv.h deleted file mode 100644 index f2a44907ef..0000000000 --- a/src/iodbc/henv.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * henv.h - * - * $Id$ - * - * Environment object management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _HENV_H -#define _HENV_H - -#include "config.h" -#include "dlproc.h" - -#include "isql.h" -#include "isqlext.h" - -#ifndef SYSERR -#define SYSERR -1 -#endif - -enum - { - -#if (ODBCVER >= 0x0300) - en_AllocHandle = SQL_API_SQLALLOCHANDLE, - en_FreeHandle = SQL_API_SQLFREEHANDLE, -#endif - - en_AllocEnv = SQL_API_SQLALLOCENV, - en_AllocConnect = SQL_API_SQLALLOCCONNECT, - en_Connect = SQL_API_SQLCONNECT, - en_DriverConnect = SQL_API_SQLDRIVERCONNECT, - en_BrowseConnect = SQL_API_SQLBROWSECONNECT, - - en_DataSources = SQL_API_SQLDATASOURCES, - en_Drivers = SQL_API_SQLDRIVERS, - en_GetInfo = SQL_API_SQLGETINFO, - en_GetFunctions = SQL_API_SQLGETFUNCTIONS, - en_GetTypeInfo = SQL_API_SQLGETTYPEINFO, - - en_SetConnectOption = SQL_API_SQLSETCONNECTOPTION, - en_GetConnectOption = SQL_API_SQLGETCONNECTOPTION, - en_SetStmtOption = SQL_API_SQLSETSTMTOPTION, - en_GetStmtOption = SQL_API_SQLGETSTMTOPTION, - - en_AllocStmt = SQL_API_SQLALLOCSTMT, - en_Prepare = SQL_API_SQLPREPARE, - en_BindParameter = SQL_API_SQLBINDPARAMETER, - en_ParamOptions = SQL_API_SQLPARAMOPTIONS, - en_GetCursorName = SQL_API_SQLGETCURSORNAME, - en_SetCursorName = SQL_API_SQLSETCURSORNAME, - en_SetScrollOptions = SQL_API_SQLSETSCROLLOPTIONS, - en_SetParam = SQL_API_SQLSETPARAM, - - en_Execute = SQL_API_SQLEXECUTE, - en_ExecDirect = SQL_API_SQLEXECDIRECT, - en_NativeSql = SQL_API_SQLNATIVESQL, - en_DescribeParam = SQL_API_SQLDESCRIBEPARAM, - en_NumParams = SQL_API_SQLNUMPARAMS, - en_ParamData = SQL_API_SQLPARAMDATA, - en_PutData = SQL_API_SQLPUTDATA, - - en_RowCount = SQL_API_SQLROWCOUNT, - en_NumResultCols = SQL_API_SQLNUMRESULTCOLS, - en_DescribeCol = SQL_API_SQLDESCRIBECOL, - en_ColAttributes = SQL_API_SQLCOLATTRIBUTES, - en_BindCol = SQL_API_SQLBINDCOL, - en_Fetch = SQL_API_SQLFETCH, - en_ExtendedFetch = SQL_API_SQLEXTENDEDFETCH, - en_GetData = SQL_API_SQLGETDATA, - en_SetPos = SQL_API_SQLSETPOS, - en_MoreResults = SQL_API_SQLMORERESULTS, - en_Error = SQL_API_SQLERROR, - - en_ColumnPrivileges = SQL_API_SQLCOLUMNPRIVILEGES, - en_Columns = SQL_API_SQLCOLUMNS, - en_ForeignKeys = SQL_API_SQLFOREIGNKEYS, - en_PrimaryKeys = SQL_API_SQLPRIMARYKEYS, - en_ProcedureColumns = SQL_API_SQLPROCEDURECOLUMNS, - en_Procedures = SQL_API_SQLPROCEDURES, - en_SpecialColumns = SQL_API_SQLSPECIALCOLUMNS, - en_Statistics = SQL_API_SQLSTATISTICS, - en_TablePrivileges = SQL_API_SQLTABLEPRIVILEGES, - en_Tables = SQL_API_SQLTABLES, - - en_FreeStmt = SQL_API_SQLFREESTMT, - en_Cancel = SQL_API_SQLCANCEL, - en_Transact = SQL_API_SQLTRANSACT, - - en_Disconnect = SQL_API_SQLDISCONNECT, - en_FreeConnect = SQL_API_SQLFREECONNECT, - en_FreeEnv = SQL_API_SQLFREEENV, - - en_NullProc = SYSERR - }; - -typedef struct - { - int type; /* must be 1st field */ - - HENV henv; /* driver's env list */ - HDBC hdbc; /* driver's dbc list */ - HERR herr; /* err list */ - int state; - } -GENV_t; - -typedef struct - { - HENV next; /* next attached env handle */ - int refcount; /* Driver's bookkeeping reference count */ - HPROC dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls */ - - HENV dhenv; /* driver env handle */ - HDLL hdll; /* drvier share library handle */ - } -ENV_t; - -/* Note: - - * - ODBC applications only know about global environment handle, - * a void pointer points to a GENV_t object. There is only one - * this object per process(however, to make the library reentrant, - * we still keep this object on heap). Applications only know - * address of this object and needn't care about its detail. - * - * - ODBC driver manager knows about instance environment handles, - * void pointers point to ENV_t objects. There are maybe more - * than one this kind of objects per process. However, multiple - * connections to a same data source(i.e. call same share library) - * will share one instance environment object. - * - * - ODBC drvier manager knows about their own environemnt handle, - * a void pointer point to a driver defined object. Every driver - * keeps one of its own environment object and driver manager - * keeps address of it by the 'dhenv' field in the instance - * environment object without care about its detail. - * - * - Applications can get driver's environment object handle by - * SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV - */ -#endif diff --git a/src/iodbc/herr.c b/src/iodbc/herr.c deleted file mode 100644 index ad9ba81e87..0000000000 --- a/src/iodbc/herr.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * herr.c - * - * $Id$ - * - * Error stack management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -#include "herr.ci" - -static HERR -_iodbcdm_popsqlerr (HERR herr) -{ - sqlerr_t *list = (sqlerr_t *) herr; - sqlerr_t *next; - - if (herr == SQL_NULL_HERR) - { - return herr; - } - - next = list->next; - - MEM_FREE (list); - - return next; -} - - -void -_iodbcdm_freesqlerrlist (HERR herrlist) -{ - HERR list; - - for (list = herrlist; list != 0;) - { - list = _iodbcdm_popsqlerr (list); - } -} - - -HERR -_iodbcdm_pushsqlerr ( - HERR herr, - sqlstcode_t code, - char *msg) -{ - sqlerr_t *ebuf; - sqlerr_t *perr = (sqlerr_t *) herr; - int idx = 0; - - if (herr != SQL_NULL_HERR) - { - idx = perr->idx + 1; - } - - if (idx == 64) - /* over wirte the top entry to prevent error stack blow out */ - { - perr->code = code; - perr->msg = msg; - - return herr; - } - - ebuf = (sqlerr_t *) MEM_ALLOC (sizeof (sqlerr_t)); - - if (ebuf == NULL) - { - return NULL; - } - - ebuf->msg = msg; - ebuf->code = code; - ebuf->idx = idx; - ebuf->next = (sqlerr_t *) herr; - - return (HERR) ebuf; -} - - -static char FAR * -_iodbcdm_getsqlstate ( - HERR herr, - void FAR * tab) -{ - sqlerr_t *perr = (sqlerr_t *) herr; - sqlerrmsg_t *ptr; - - if (herr == SQL_NULL_HERR || tab == NULL) - { - return (char FAR *) NULL; - } - - for (ptr = tab; - ptr->code != en_sqlstat_total; - ptr++) - { - if (ptr->code == perr->code) - { - return (char FAR *) (ptr->stat); - } - } - - return (char FAR *) NULL; -} - - -static char FAR * -_iodbcdm_getsqlerrmsg ( - HERR herr, - void FAR * errtab) -{ - sqlerr_t *perr = (sqlerr_t *) herr; - sqlerrmsg_t *ptr; - - if (herr == SQL_NULL_HERR) - { - return NULL; - } - - if (perr->msg == NULL && errtab == NULL) - { - return NULL; - } - - if (perr->msg != NULL) - { - return perr->msg; - } - - for (ptr = (sqlerrmsg_t *) errtab; - ptr->code != en_sqlstat_total; - ptr++) - { - if (ptr->code == perr->code) - { - return (char FAR *) ptr->msg; - } - } - - return (char FAR *) NULL; -} - - -RETCODE SQL_API -SQLError ( - HENV henv, - HDBC hdbc, - HSTMT hstmt, - UCHAR FAR * szSqlstate, - SDWORD FAR * pfNativeError, - UCHAR FAR * szErrorMsg, - SWORD cbErrorMsgMax, - SWORD FAR * pcbErrorMsg) -{ - GENV_t FAR *genv = (GENV_t FAR *) henv; - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HDBC thdbc; - - HENV dhenv = SQL_NULL_HENV; - HDBC dhdbc = SQL_NULL_HDBC; - HSTMT dhstmt = SQL_NULL_HSTMT; - - HERR herr = SQL_NULL_HERR; - HPROC hproc = SQL_NULL_HPROC; - - char FAR *errmsg = NULL; - char FAR *ststr = NULL; - - int handle = 0; - RETCODE retcode = SQL_SUCCESS; - - if (hstmt != SQL_NULL_HSTMT) /* retrive stmt err */ - { - herr = pstmt->herr; - thdbc = pstmt->hdbc; - - if (thdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - hproc = _iodbcdm_getproc (thdbc, en_Error); - dhstmt = pstmt->dhstmt; - handle = 3; - } - else if (hdbc != SQL_NULL_HDBC) /* retrive dbc err */ - { - herr = pdbc->herr; - thdbc = hdbc; - if (thdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - hproc = _iodbcdm_getproc (thdbc, en_Error); - dhdbc = pdbc->dhdbc; - handle = 2; - - if (herr == SQL_NULL_HERR - && pdbc->henv == SQL_NULL_HENV) - { - return SQL_NO_DATA_FOUND; - } - } - else if (henv != SQL_NULL_HENV) /* retrive env err */ - { - herr = genv->herr; - - /* Drivers shouldn't push error message - * on envoriment handle */ - - if (herr == SQL_NULL_HERR) - { - return SQL_NO_DATA_FOUND; - } - - handle = 1; - } - else - { - return SQL_INVALID_HANDLE; - } - - if (szErrorMsg != NULL) - { - if (cbErrorMsgMax < 0 - || cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1) - { - return SQL_ERROR; - /* SQLError() doesn't post error for itself */ - } - } - - if (herr == SQL_NULL_HERR) /* no err on drv mng */ - { - /* call driver */ - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (thdbc, retcode, hproc, en_Error, - (dhenv, dhdbc, dhstmt, szSqlstate, pfNativeError, szErrorMsg, - cbErrorMsgMax, pcbErrorMsg)) - - return retcode; - } - - if (szSqlstate != NULL) - { - int len; - - /* get sql state string */ - ststr = (char FAR *) _iodbcdm_getsqlstate (herr, - (void FAR *) sqlerrmsg_tab); - - if (ststr == NULL) - { - len = 0; - } - else - { - len = (int) STRLEN (ststr); - } - - STRNCPY (szSqlstate, ststr, len); - szSqlstate[len] = 0; - /* buffer size of szSqlstate is not checked. Applications - * suppose provide enough ( not less than 6 bytes ) buffer - * or NULL for it. - */ - } - - if (pfNativeError != NULL) - { - /* native error code is specific to data source */ - *pfNativeError = (SDWORD) 0L; - } - - if (szErrorMsg == NULL || cbErrorMsgMax == 0) - { - if (pcbErrorMsg != NULL) - { - *pcbErrorMsg = (SWORD) 0; - } - } - else - { - int len; - char msgbuf[256] = {'\0'}; - - /* get sql state message */ - errmsg = _iodbcdm_getsqlerrmsg (herr, (void FAR *) sqlerrmsg_tab); - - if (errmsg == NULL) - { - errmsg = (char FAR *) ""; - } - - sprintf (msgbuf, "%s%s", sqlerrhd, errmsg); - - len = STRLEN (msgbuf); - - if (len < cbErrorMsgMax - 1) - { - retcode = SQL_SUCCESS; - } - else - { - len = cbErrorMsgMax - 1; - retcode = SQL_SUCCESS_WITH_INFO; - /* and not posts error for itself */ - } - - STRNCPY ((char *) szErrorMsg, msgbuf, len); - szErrorMsg[len] = 0; - - if (pcbErrorMsg != NULL) - { - *pcbErrorMsg = (SWORD) len; - } - } - - switch (handle) /* free this err */ - { - case 1: - genv->herr = _iodbcdm_popsqlerr (genv->herr); - break; - - case 2: - pdbc->herr = _iodbcdm_popsqlerr (pdbc->herr); - break; - - case 3: - pstmt->herr = _iodbcdm_popsqlerr (pstmt->herr); - break; - - default: - break; - } - - return retcode; -} diff --git a/src/iodbc/herr.ci b/src/iodbc/herr.ci deleted file mode 100644 index c880c12a0d..0000000000 --- a/src/iodbc/herr.ci +++ /dev/null @@ -1,124 +0,0 @@ -/* - * herr.ci - * - * $Id$ - * - * Error messages - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -static const sqlerrmsg_t sqlerrmsg_tab[] = -{ - { en_00000, "00000", "" }, - { en_01000, "01000", "General warning" }, - { en_01002, "01002", "Disconnect error" }, - { en_01004, "01004", "Data truncated" }, - { en_01006, "01006", "Privilege not revoked" }, - { en_01S00, "01S00", "Invalid connection string attribute" }, - { en_01S01, "01S01", "Error in row" }, - { en_01S02, "01S02", "Optional value changed" }, - { en_01S03, "01S03", "No rows updated or deleted" }, - { en_01S04, "01S04", "More than one row updated or deleted" }, - { en_07001, "07001", "Wrong number of parameters" }, - { en_07006, "07006", "Restricted data type attribute violation" }, - { en_08001, "08001", "Unable to connect to data source" }, - { en_08002, "08002", "Connection in use" }, - { en_08003, "08003", "Connect not open" }, - { en_08004, "08004", "Data source rejected establishment of connection" }, - { en_08007, "08007", "Connection failure during transaction" }, - { en_08S01, "08S01", "Communication link failure" }, - { en_21S01, "21S01", "Insert value list does not match" }, - { en_21S02, "21S02", "Degree of derived table does not match column list" }, - { en_22001, "22001", "String data right truncation" }, - { en_22003, "22003", "Numeric value out of range" }, - { en_22005, "22005", "Error in assignment" }, - { en_22008, "22008", "Datetime field overflow" }, - { en_22012, "22012", "Division by zero" }, - { en_22026, "22026", "String data, length mismatch" }, - { en_23000, "23000", "Integrity constraint violation" }, - { en_24000, "24000", "Invalid cursor state" }, - { en_25000, "25000", "Invalid transaction state" }, - { en_28000, "28000", "Invalid authorization specification" }, - { en_34000, "34000", "Invalid cursor name" }, - { en_37000, "37000", "Syntex error or access violation" }, - { en_3C000, "3C000", "Duplicate cursor name" }, - { en_40001, "40001", "Serialization failure" }, - { en_42000, "42000", "Syntax error or access violation" }, - { en_70100, "70100", "Operation aborted" }, - { en_IM001, "IM001", "Driver does not support this function" }, - { en_IM002, "IM002", "Data source name not found and no default " - "driver specified. Driver could not be loaded" }, - { en_IM003, "IM003", "Specified driver could not be loaded" }, - { en_IM004, "IM004", "Driver's SQLAllocEnv() failed" }, - { en_IM005, "IM005", "Driver's SQLAllocConnect() failed" }, - { en_IM006, "IM006", "Driver's SQLSetConnectOption failed" }, - { en_IM007, "IM007", "No data source or driver specified, dialog prohibited" }, - { en_IM008, "IM008", "Dialog failed" }, - { en_IM009, "IM009", "Unable to load translation DLL" }, - { en_IM010, "IM010", "Data source name too long" }, - { en_IM011, "IM011", "Driver name too long" }, - { en_IM012, "IM012", "DRIVER keyword syntax error" }, - { en_IM013, "IM013", "Trace file error" }, - { en_IM014, "IM014", "Try to change tracing file while tracing is on" }, - { en_S0001, "S0001", "Base table or view already exists" }, - { en_S0002, "S0002", "Base table not found" }, - { en_S0011, "S0011", "Index already exists" }, - { en_S0012, "S0012", "Index not found" }, - { en_S0021, "S0021", "Column already exists" }, - { en_S0022, "S0022", "Column not found" }, - { en_S0023, "S0023", "No default for column" }, - { en_S1000, "S1000", "General error" }, - { en_S1001, "S1001", "Memory allocation failure" }, - { en_S1002, "S1002", "Invalid column number" }, - { en_S1003, "S1003", "Program type out of range" }, - { en_S1004, "S1004", "SQL data type out of range" }, - { en_S1008, "S1008", "Operation canceled" }, - { en_S1009, "S1009", "Invalid argument value" }, - { en_S1010, "S1010", "Function sequence error" }, - { en_S1011, "S1011", "Operation invalid at this time" }, - { en_S1012, "S1012", "Invalid transaction operation code specified" }, - { en_S1015, "S1015", "No cursor name available" }, - { en_S1090, "S1090", "Invalid string or buffer length" }, - { en_S1091, "S1091", "Descriptor type out of range" }, - { en_S1092, "S1092", "Option type out of range" }, - { en_S1093, "S1093", "Invalid parameter" }, - { en_S1094, "S1094", "Invalid scale value" }, - { en_S1095, "S1095", "Function type out of range" }, - { en_S1096, "S1096", "Information type out of range" }, - { en_S1097, "S1097", "Column type out of range" }, - { en_S1098, "S1098", "Scope type out of range" }, - { en_S1099, "S1099", "Nullable type out of range" }, - { en_S1100, "S1100", "Uniquenss option type out of range" }, - { en_S1101, "S1101", "Accuracy option type out of range" }, - { en_S1103, "S1103", "Direction option out of range" }, - { en_S1104, "S1104", "Invalid precision value" }, - { en_S1105, "S1105", "Invalid parameter type" }, - { en_S1106, "S1106", "Fetch type out of range" }, - { en_S1107, "S1107", "Row value out of range" }, - { en_S1108, "S1108", "Concurrency option out of range" }, - { en_S1109, "S1109", "Invalid cursor position" }, - { en_S1110, "S1110", "Invalid driver completion" }, - { en_S1111, "S1111", "Invalid bookmark value" }, - { en_S1C00, "S1C00", "Driver not capable" }, - { en_S1T00, "S1T00", "Timeout expired" }, - { en_sqlstat_total, NULL, NULL } -}; - -static char FAR* sqlerrhd = "[iODBC][Driver Manager]"; diff --git a/src/iodbc/herr.h b/src/iodbc/herr.h deleted file mode 100644 index 8355c012ad..0000000000 --- a/src/iodbc/herr.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * herr.h - * - * $Id$ - * - * Error stack management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _HERR_H -#define _HERR_H - -typedef enum - { - en_00000 = 0, - en_01000, - en_01002, - en_01004, - en_01006, - en_01S00, - en_01S01, - en_01S02, - en_01S03, - en_01S04, - en_07001, - en_07006, - en_08001, - en_08002, - en_08003, - en_08004, - en_08007, - en_08S01, - en_21S01, - en_21S02, - en_22001, - en_22003, - en_22005, - en_22008, - en_22012, - en_22026, - en_23000, - en_24000, - en_25000, - en_28000, - en_34000, - en_37000, - en_3C000, - en_40001, - en_42000, - en_70100, - en_IM001, - en_IM002, - en_IM003, - en_IM004, - en_IM005, - en_IM006, - en_IM007, - en_IM008, - en_IM009, - en_IM010, - en_IM011, - en_IM012, - en_IM013, - en_IM014, - en_S0001, - en_S0002, - en_S0011, - en_S0012, - en_S0021, - en_S0022, - en_S0023, - en_S1000, - en_S1001, - en_S1002, - en_S1003, - en_S1004, - en_S1008, - en_S1009, - en_S1010, - en_S1011, - en_S1012, - en_S1015, - en_S1090, - en_S1091, - en_S1092, - en_S1093, - en_S1094, - en_S1095, - en_S1096, - en_S1097, - en_S1098, - en_S1099, - en_S1100, - en_S1101, - en_S1103, - en_S1104, - en_S1105, - en_S1106, - en_S1107, - en_S1108, - en_S1109, - en_S1110, - en_S1111, - en_S1C00, - en_S1T00, - en_sqlstat_total - } -sqlstcode_t; - -typedef void FAR *HERR; -#define SQL_NULL_HERR ((HERR)NULL) - -typedef struct - { - sqlstcode_t code; - char FAR *stat; - char FAR *msg; - } -sqlerrmsg_t; - -typedef struct sqlerr - { - sqlstcode_t code; - int idx; - char FAR *msg; - struct sqlerr *next; - } -sqlerr_t; - -extern void _iodbcdm_freesqlerrlist (HERR herr); -extern HERR _iodbcdm_pushsqlerr (HERR list, sqlstcode_t code, char *sysmsg); - -#define PUSHSYSERR(list, msg) \ - list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg ) -#define PUSHSQLERR(list, code) \ - list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL ) -#endif /* _SQLERR_H */ diff --git a/src/iodbc/hstmt.c b/src/iodbc/hstmt.c deleted file mode 100644 index ccab2f4c40..0000000000 --- a/src/iodbc/hstmt.c +++ /dev/null @@ -1,600 +0,0 @@ -/* - * hstmt.c - * - * $Id$ - * - * Query statement object management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -RETCODE SQL_API -SQLAllocStmt ( - HDBC hdbc, - HSTMT FAR * phstmt) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - STMT_t FAR *pstmt = NULL; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode = SQL_SUCCESS; - -#if (ODBCVER >= 0x0300) - if (hdbc == SQL_NULL_HDBC || pdbc->type != SQL_HANDLE_DBC) -#else - if (hdbc == SQL_NULL_HDBC) -#endif - { - return SQL_INVALID_HANDLE; - } - - if (phstmt == NULL) - { - PUSHSQLERR (pdbc->herr, en_S1009); - - return SQL_ERROR; - } - - /* check state */ - switch (pdbc->state) - { - case en_dbc_connected: - case en_dbc_hstmt: - break; - - case en_dbc_allocated: - case en_dbc_needdata: - PUSHSQLERR (pdbc->herr, en_08003); - *phstmt = SQL_NULL_HSTMT; - return SQL_ERROR; - - default: - return SQL_INVALID_HANDLE; - } - - pstmt = (STMT_t FAR *) MEM_ALLOC (sizeof (STMT_t)); - - if (pstmt == NULL) - { - PUSHSQLERR (pdbc->herr, en_S1001); - *phstmt = SQL_NULL_HSTMT; - - return SQL_ERROR; - } - -#if (ODBCVER >= 0x0300) - pstmt->type = SQL_HANDLE_STMT; -#endif - - /* initiate the object */ - pstmt->herr = SQL_NULL_HERR; - pstmt->hdbc = hdbc; - pstmt->state = en_stmt_allocated; - pstmt->cursor_state = en_stmt_cursor_no; - pstmt->prep_state = 0; - pstmt->asyn_on = en_NullProc; - pstmt->need_on = en_NullProc; - - /* call driver's function */ - -#if (ODBCVER >= 0x0300) - hproc = _iodbcdm_getproc (hdbc, en_AllocHandle); - - if (hproc) - { - CALL_DRIVER (pstmt->hdbc, hdbc, retcode, hproc, en_AllocHandle, - (SQL_HANDLE_STMT, pdbc->dhdbc, &(pstmt->dhstmt))) - } - else -#endif - - { - hproc = _iodbcdm_getproc (hdbc, en_AllocStmt); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - *phstmt = SQL_NULL_HSTMT; - MEM_FREE (pstmt); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_AllocStmt, - (pdbc->dhdbc, &(pstmt->dhstmt))) - } - - if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - { - *phstmt = SQL_NULL_HSTMT; - MEM_FREE (pstmt); - - return retcode; - } - - /* insert into list */ - pstmt->next = pdbc->hstmt; - pdbc->hstmt = pstmt; - - *phstmt = (HSTMT) pstmt; - - /* state transition */ - pdbc->state = en_dbc_hstmt; - - return SQL_SUCCESS; -} - - -RETCODE -_iodbcdm_dropstmt (HSTMT hstmt) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - STMT_t FAR *tpstmt; - DBC_t FAR *pdbc; - - if (hstmt == SQL_NULL_HSTMT) - { - return SQL_INVALID_HANDLE; - } - - pdbc = (DBC_t FAR *) (pstmt->hdbc); - - for (tpstmt = (STMT_t FAR *) pdbc->hstmt; - tpstmt != NULL; - tpstmt = tpstmt->next) - { - if (tpstmt == pstmt) - { - pdbc->hstmt = (HSTMT) pstmt->next; - break; - } - - if (tpstmt->next == pstmt) - { - tpstmt->next = pstmt->next; - break; - } - } - - if (tpstmt == NULL) - { - return SQL_INVALID_HANDLE; - } - - _iodbcdm_freesqlerrlist (pstmt->herr); - MEM_FREE (hstmt); - - return SQL_SUCCESS; -} - - -RETCODE SQL_API -SQLFreeStmt ( - HSTMT hstmt, - UWORD fOption) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - STMT_t FAR *tpstmt; - DBC_t FAR *pdbc; - - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - pdbc = (DBC_t FAR *) (pstmt->hdbc); - - /* check option */ - switch (fOption) - { - case SQL_DROP: - case SQL_CLOSE: - case SQL_UNBIND: - case SQL_RESET_PARAMS: - break; - - default: - PUSHSQLERR (pstmt->herr, en_S1092); - return SQL_ERROR; - } - - /* check state */ - if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - hproc = SQL_NULL_HPROC; - -#if (ODBCVER >= 0x0300) - if (fOption == SQL_DROP) - { - hproc = _iodbcdm_getproc (pstmt->hdbc, en_FreeHandle); - - if (hproc) - { - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_FreeHandle, - (SQL_HANDLE_STMT, pstmt->dhstmt)) - } - } -#endif - - if (hproc == SQL_NULL_HPROC) - { - hproc = _iodbcdm_getproc (pstmt->hdbc, en_FreeStmt); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_FreeStmt, - (pstmt->dhstmt, fOption)) - } - - if (retcode != SQL_SUCCESS - && retcode != SQL_SUCCESS_WITH_INFO) - { - return retcode; - } - - /* state transition */ - switch (fOption) - { - case SQL_DROP: - /* delet this object (ignore return) */ - _iodbcdm_dropstmt (hstmt); - break; - - case SQL_CLOSE: - pstmt->cursor_state = en_stmt_cursor_no; - /* This means cursor name set by - * SQLSetCursorName() call will also - * be erased. - */ - - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - break; - - case en_stmt_executed: - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - if (pstmt->prep_state) - { - pstmt->state = - en_stmt_prepared; - } - else - { - pstmt->state = - en_stmt_allocated; - } - break; - - default: - break; - } - break; - - case SQL_UNBIND: - case SQL_RESET_PARAMS: - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLSetStmtOption ( - HSTMT hstmt, - UWORD fOption, - UDWORD vParam) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - int sqlstat = en_00000; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check option */ - if ( /* fOption < SQL_STMT_OPT_MIN || */ - fOption > SQL_STMT_OPT_MAX) - { - PUSHSQLERR (pstmt->herr, en_S1092); - - return SQL_ERROR; - } - - if (fOption == SQL_CONCURRENCY - || fOption == SQL_CURSOR_TYPE - || fOption == SQL_SIMULATE_CURSOR - || fOption == SQL_USE_BOOKMARKS) - { - if (pstmt->asyn_on != en_NullProc) - { - if (pstmt->prep_state) - { - sqlstat = en_S1011; - } - } - else - { - switch (pstmt->state) - { - case en_stmt_prepared: - sqlstat = en_S1011; - break; - - case en_stmt_executed: - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - sqlstat = en_24000; - break; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - if (pstmt->prep_state) - { - sqlstat = en_S1011; - } - break; - - default: - break; - } - } - } - else - { - if (pstmt->asyn_on != en_NullProc) - { - if (!pstmt->prep_state) - { - sqlstat = en_S1010; - } - } - else - { - if (pstmt->state >= en_stmt_needdata) - { - sqlstat = en_S1010; - } - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetStmtOption); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetStmtOption, - (pstmt->dhstmt, fOption, vParam)) - - return retcode; -} - - -RETCODE SQL_API -SQLGetStmtOption ( - HSTMT hstmt, - UWORD fOption, - PTR pvParam) -{ - STMT_t FAR *pstmt = (STMT_t *) hstmt; - HPROC hproc; - int sqlstat = en_00000; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check option */ - if ( /* fOption < SQL_STMT_OPT_MIN || */ - fOption > SQL_STMT_OPT_MAX) - { - PUSHSQLERR (pstmt->herr, en_S1092); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->state >= en_stmt_needdata - || pstmt->asyn_on != en_NullProc) - { - sqlstat = en_S1010; - } - else - { - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - case en_stmt_executed: - case en_stmt_cursoropen: - if (fOption == SQL_ROW_NUMBER || fOption == SQL_GET_BOOKMARK) - { - sqlstat = en_24000; - } - break; - - default: - break; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetStmtOption); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_GetStmtOption, - (pstmt->dhstmt, fOption, pvParam)) - - return retcode; -} - - -RETCODE SQL_API -SQLCancel (HSTMT hstmt) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - /* check state */ - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Cancel); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Cancel, - (pstmt->dhstmt)) - - /* state transition */ - if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - { - return retcode; - } - - switch (pstmt->state) - { - case en_stmt_allocated: - case en_stmt_prepared: - break; - - case en_stmt_executed: - if (pstmt->prep_state) - { - pstmt->state = en_stmt_prepared; - } - else - { - pstmt->state = en_stmt_allocated; - } - break; - - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - if (pstmt->prep_state) - { - pstmt->state = en_stmt_prepared; - } - else - { - pstmt->state = en_stmt_allocated; - } - break; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - switch (pstmt->need_on) - { - case en_ExecDirect: - pstmt->state = en_stmt_allocated; - break; - - case en_Execute: - pstmt->state = en_stmt_prepared; - break; - - case en_SetPos: - pstmt->state = en_stmt_xfetched; - break; - - default: - break; - } - pstmt->need_on = en_NullProc; - break; - - default: - break; - } - - return retcode; -} diff --git a/src/iodbc/hstmt.h b/src/iodbc/hstmt.h deleted file mode 100644 index 505200993a..0000000000 --- a/src/iodbc/hstmt.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * hstmt.h - * - * $Id$ - * - * Query statement object management functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _HSTMT_H -#define _HSTMT_H - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -typedef struct STMT - { - int type; /* must be 1st field */ - - struct STMT *next; - - HERR herr; - HDBC hdbc; /* back point to connection object */ - HSTMT dhstmt; /* driver's stmt handle */ - - int state; - int cursor_state; - int prep_state; - int asyn_on; /* async executing which odbc call */ - int need_on; /* which call return SQL_NEED_DATA */ - } -STMT_t; - -enum - { - en_stmt_allocated = 0, - en_stmt_prepared, - en_stmt_executed, - en_stmt_cursoropen, - en_stmt_fetched, - en_stmt_xfetched, - en_stmt_needdata, /* not call SQLParamData() yet */ - en_stmt_mustput, /* not call SQLPutData() yet */ - en_stmt_canput /* SQLPutData() called */ - }; /* for statement handle state */ - -enum - { - en_stmt_cursor_no = 0, - en_stmt_cursor_named, - en_stmt_cursor_opened, - en_stmt_cursor_fetched, - en_stmt_cursor_xfetched - }; /* for statement cursor state */ - -extern RETCODE _iodbcdm_dropstmt (); -#endif diff --git a/src/iodbc/info.c b/src/iodbc/info.c deleted file mode 100644 index f5efc7e3f7..0000000000 --- a/src/iodbc/info.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - * info.c - * - * $Id$ - * - * Information functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -#include -#include - -#define SECT1 "ODBC Data Sources" -#define SECT2 "Default" -#define MAX_ENTRIES 1024 - -extern char * _iodbcdm_getinifile (char *buf, int size); -extern char * _iodbcdm_getkeyvalbydsn (char *dsn, int dsnlen, char *keywd, char *value, int size); - -static int -stricmp (const char *s1, const char *s2) -{ - int cmp; - - while (*s1) - { - if ((cmp = toupper (*s1) - toupper (*s2)) != 0) - return cmp; - s1++; - s2++; - } - return (*s2) ? -1 : 0; -} - -static int -SectSorter (const void *p1, const void *p2) -{ - char **s1 = (char **) p1; - char **s2 = (char **) p2; - - return stricmp (*s1, *s2); -} - - -RETCODE SQL_API -SQLDataSources ( - HENV henv, - UWORD fDir, - UCHAR FAR * szDSN, - SWORD cbDSNMax, - SWORD FAR * pcbDSN, - UCHAR FAR * szDesc, - SWORD cbDescMax, - SWORD FAR * pcbDesc) -{ - GENV_t FAR *genv = (GENV_t FAR *) henv; - char *path; - char buf[1024]; - FILE *fp; - int i; - static int cur_entry = -1; - static int num_entries = 0; - static char **sect = NULL; - - if (henv == SQL_NULL_HENV) - { - return SQL_INVALID_HANDLE; - } - /* check argument */ - if (cbDSNMax < 0 || cbDescMax < 0) - { - PUSHSQLERR (genv->herr, en_S1090); - - return SQL_ERROR; - } - if (fDir != SQL_FETCH_FIRST - && fDir != SQL_FETCH_NEXT) - { - PUSHSQLERR (genv->herr, en_S1103); - - return SQL_ERROR; - } - if (cur_entry < 0 || fDir == SQL_FETCH_FIRST) - { - cur_entry = 0; - num_entries = 0; - - - /* - * Open the odbc.ini file - */ - path = (char *) _iodbcdm_getinifile (buf, sizeof (buf)); - if ((fp = fopen (path, "r")) == NULL) - { - return SQL_NO_DATA_FOUND; - } - /* - * Free old section list - */ - if (sect) - { - for (i = 0; i < MAX_ENTRIES; i++) - if (sect[i]) - free (sect[i]); - free (sect); - } - if ((sect = (char **) calloc (MAX_ENTRIES, sizeof (char *))) == NULL) - { - PUSHSQLERR (genv->herr, en_S1011); - - return SQL_ERROR; - } - /* - * Build a dynamic list of sections - */ - while (1) - { - char *str, *p; - - str = fgets (buf, sizeof (buf), fp); - - if (str == NULL) - break; - - if (*str == '[') - { - str++; - for (p = str; *p; p++) - if (*p == ']') - *p = '\0'; - - if (!strcmp (str, SECT1)) - continue; - if (!strcmp (str, SECT2)) - continue; - - /* - * Add this section to the comma separated list - */ - if (num_entries >= MAX_ENTRIES) - break; /* Skip the rest */ - - sect[num_entries++] = (char *) strdup (str); - } - } - - /* - * Sort all entries so we can present a nice list - */ - if (num_entries > 1) - qsort (sect, num_entries, sizeof (char *), SectSorter); - } - /* - * Try to get to the next item - */ - if (cur_entry >= num_entries) - { - cur_entry = 0; /* Next time, start all over again */ - return SQL_NO_DATA_FOUND; - } - /* - * Copy DSN information - */ - STRNCPY (szDSN, sect[cur_entry], cbDSNMax); -/* -glt??? pcbDSN = strlen(szDSN); -*/ - /* - * And find the description that goes with this entry - */ - _iodbcdm_getkeyvalbydsn (sect[cur_entry], strlen (sect[cur_entry]), - "Description", (char*) szDesc, cbDescMax); -/* -glt??? pcbDesc = strlen(szDesc); -*/ - /* - * Next record - */ - cur_entry++; - - return SQL_SUCCESS; -} - - -RETCODE SQL_API -SQLDrivers ( - HENV henv, - UWORD fDir, - UCHAR FAR * szDrvDesc, - SWORD cbDrvDescMax, - SWORD FAR * pcbDrvDesc, - UCHAR FAR * szDrvAttr, - SWORD cbDrvAttrMax, - SWORD FAR * pcbDrvAttr) -{ - GENV_t FAR *genv = (GENV_t FAR *) henv; - - if (henv == SQL_NULL_HENV) - { - return SQL_INVALID_HANDLE; - } - - if (cbDrvDescMax < 0 || cbDrvAttrMax < 0 || cbDrvAttrMax == 1) - { - PUSHSQLERR (genv->herr, en_S1090); - - return SQL_ERROR; - } - - if (fDir != SQL_FETCH_FIRST || fDir != SQL_FETCH_NEXT) - { - PUSHSQLERR (genv->herr, en_S1103); - - return SQL_ERROR; - } - -/*********************/ - return SQL_NO_DATA_FOUND; -} - - -RETCODE SQL_API -SQLGetInfo ( - HDBC hdbc, - UWORD fInfoType, - PTR rgbInfoValue, - SWORD cbInfoValueMax, - SWORD FAR * pcbInfoValue) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - ENV_t FAR *penv; - STMT_t FAR *pstmt = NULL; - STMT_t FAR *tpstmt; - HPROC hproc; - RETCODE retcode = SQL_SUCCESS; - - DWORD dword; - int size = 0, len = 0; - char buf[16] = {'\0'}; - - if (hdbc == SQL_NULL_HDBC || pdbc->henv == SQL_NULL_HENV) - { - return SQL_INVALID_HANDLE; - } - - if (cbInfoValueMax < 0) - { - PUSHSQLERR (pdbc->herr, en_S1090); - - return SQL_ERROR; - } - - if ( /* fInfoType < SQL_INFO_FIRST || */ - (fInfoType > SQL_INFO_LAST - && fInfoType < SQL_INFO_DRIVER_START)) - { - PUSHSQLERR (pdbc->herr, en_S1096); - - return SQL_ERROR; - } - - if (fInfoType == SQL_ODBC_VER) - { - sprintf (buf, "%02d.%02d", - (ODBCVER) >> 8, 0x00FF & (ODBCVER)); - - - if (rgbInfoValue != NULL - && cbInfoValueMax > 0) - { - len = STRLEN (buf); - - if (len < cbInfoValueMax - 1) - { - len = cbInfoValueMax - 1; - PUSHSQLERR (pdbc->herr, en_01004); - - retcode = SQL_SUCCESS_WITH_INFO; - } - - STRNCPY (rgbInfoValue, buf, len); - ((char FAR *) rgbInfoValue)[len] = '\0'; - } - - if (pcbInfoValue != NULL) - { - *pcbInfoValue = (SWORD) len; - } - - return retcode; - } - - if (pdbc->state == en_dbc_allocated || pdbc->state == en_dbc_needdata) - { - PUSHSQLERR (pdbc->herr, en_08003); - - return SQL_ERROR; - } - - switch (fInfoType) - { - case SQL_DRIVER_HDBC: - dword = (DWORD) (pdbc->dhdbc); - size = sizeof (dword); - break; - - case SQL_DRIVER_HENV: - penv = (ENV_t FAR *) (pdbc->henv); - dword = (DWORD) (penv->dhenv); - size = sizeof (dword); - break; - - case SQL_DRIVER_HLIB: - penv = (ENV_t FAR *) (pdbc->henv); - dword = (DWORD) (penv->hdll); - size = sizeof (dword); - break; - - case SQL_DRIVER_HSTMT: - if (rgbInfoValue != NULL) - { - pstmt = *((STMT_t FAR **) rgbInfoValue); - } - - for (tpstmt = (STMT_t FAR *) (pdbc->hstmt); - tpstmt != NULL; - tpstmt = tpstmt->next) - { - if (tpstmt == pstmt) - { - break; - } - } - - if (tpstmt == NULL) - { - PUSHSQLERR (pdbc->herr, en_S1009); - - return SQL_ERROR; - } - - dword = (DWORD) (pstmt->dhstmt); - size = sizeof (dword); - break; - - default: - break; - } - - if (size) - { - if (rgbInfoValue != NULL) - { - *((DWORD *) rgbInfoValue) = dword; - } - - if (pcbInfoValue != NULL) - { - *(pcbInfoValue) = (SWORD) size; - } - - return SQL_SUCCESS; - } - - hproc = _iodbcdm_getproc (hdbc, en_GetInfo); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pdbc->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (hdbc, retcode, hproc, en_GetInfo, - (pdbc->dhdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue)) - - if (retcode == SQL_ERROR - && fInfoType == SQL_DRIVER_ODBC_VER) - { - STRCPY (buf, "01.00"); - - if (rgbInfoValue != NULL - && cbInfoValueMax > 0) - { - len = STRLEN (buf); - - if (len < cbInfoValueMax - 1) - { - len = cbInfoValueMax - 1; - PUSHSQLERR (pdbc->herr, en_01004); - } - - STRNCPY (rgbInfoValue, buf, len); - ((char FAR *) rgbInfoValue)[len] = '\0'; - } - - if (pcbInfoValue != NULL) - { - *pcbInfoValue = (SWORD) len; - } - - /* what should we return in this case ???? */ - } - - return retcode; -} - - -RETCODE SQL_API -SQLGetFunctions ( - HDBC hdbc, - UWORD fFunc, - UWORD FAR * pfExists) -{ - DBC_t FAR *pdbc = (DBC_t FAR *) hdbc; - HPROC hproc; - RETCODE retcode; - - if (hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - if (fFunc > SQL_EXT_API_LAST) - { - PUSHSQLERR (pdbc->herr, en_S1095); - - return SQL_ERROR; - } - - if (pdbc->state == en_dbc_allocated - || pdbc->state == en_dbc_needdata) - { - PUSHSQLERR (pdbc->herr, en_S1010); - - return SQL_ERROR; - } - - if (pfExists == NULL) - { - return SQL_SUCCESS; - } - - hproc = _iodbcdm_getproc (hdbc, en_GetFunctions); - - if (hproc != SQL_NULL_HPROC) - { - CALL_DRIVER (hdbc, retcode, hproc, en_GetFunctions, - (pdbc->dhdbc, fFunc, pfExists)) - - return retcode; - } - - if (fFunc == SQL_API_SQLSETPARAM) - { - fFunc = SQL_API_SQLBINDPARAMETER; - } - - if (fFunc != SQL_API_ALL_FUNCTIONS) - { - hproc = _iodbcdm_getproc (hdbc, fFunc); - - if (hproc == SQL_NULL_HPROC) - { - *pfExists = (UWORD) 0; - } - else - { - *pfExists = (UWORD) 1; - } - - return SQL_SUCCESS; - } - - for (fFunc = 0; fFunc < 100; fFunc++) - { - hproc = _iodbcdm_getproc (hdbc, fFunc); - - if (hproc == SQL_NULL_HPROC) - { - pfExists[fFunc] = (UWORD) 0; - } - else - { - pfExists[fFunc] = (UWORD) 1; - } - } - - return SQL_SUCCESS; -} diff --git a/src/iodbc/iodbc.h b/src/iodbc/iodbc.h deleted file mode 100644 index e60123d0b2..0000000000 --- a/src/iodbc/iodbc.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef _CONFIG_H -#define _CONFIG_H - -# if !defined(WINDOWS) && !defined(WIN32_SYSTEM) -# define _UNIX_ - -# include -# include - -# define MEM_ALLOC(size) (malloc((size_t)(size))) -# define MEM_FREE(ptr) {if(ptr) free(ptr);} - -# define STRCPY(t, s) (strcpy((char*)(t), (char*)(s))) -# define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n))) -# define STRCAT(t, s) (strcat((char*)(t), (char*)(s))) -# define STRNCAT(t,s,n) (strncat((char*)(t), (char*)(s), (size_t)(n))) -# define STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0) -# define STRLEN(str) ((str)? strlen((char*)(str)):0) - -# define EXPORT -# define CALLBACK -# define FAR - - typedef signed short SSHOR; - typedef short WORD; - typedef long DWORD; - - typedef WORD WPARAM; - typedef DWORD LPARAM; - typedef void* HWND; - typedef int BOOL; - -# endif /* _UNIX_ */ - -# if defined(WINDOWS) || defined(WIN32_SYSTEM) - -# include -# include - -# ifdef _MSVC_ -# define MEM_ALLOC(size) (fmalloc((size_t)(size))) -# define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0)) -# define STRCPY(t, s) (fstrcpy((char FAR*)(t), (char FAR*)(s))) -# define STRNCPY(t,s,n) (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) -# define STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0) -# define STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) -# endif - -# ifdef _BORLAND_ -# define MEM_ALLOC(size) (farmalloc((unsigned long)(size)) -# define MEM_FREE(ptr) ((ptr)? farfree((void far*)(ptr)):0) -# define STRCPY(t, s) (_fstrcpy((char FAR*)(t), (char FAR*)(s))) -# define STRNCPY(t,s,n) (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n))) -# define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0) -# define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) -# endif - -# endif /* WINDOWS */ - -# define SYSERR (-1) - -# ifndef NULL -# define NULL ((void FAR*)0UL) -# endif - -#endif diff --git a/src/iodbc/isql.h b/src/iodbc/isql.h deleted file mode 100644 index 87b599b477..0000000000 --- a/src/iodbc/isql.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * isql.h - * - * $Id$ - * - * iODBC defines - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _ISQL_H -#define _ISQL_H - -#ifndef WIN16 -#ifdef WIN32 -#define SQL_API __stdcall -#else -#define FAR -#define EXPORT -#define CALLBACK -#define SQL_API EXPORT CALLBACK -#ifndef __EMX__ -typedef void *HWND; -#endif -#endif -#endif - -typedef void *SQLHWND; - -typedef unsigned char UCHAR; -typedef long int SDWORD; -typedef short int SWORD; -typedef unsigned long int UDWORD; -typedef unsigned short int UWORD; -typedef long SQLINTEGER; -typedef UDWORD SQLUINTEGER; - -typedef void FAR *PTR; -typedef void FAR *HENV; -typedef void FAR *HDBC; -typedef void FAR *HSTMT; - -typedef signed short RETCODE; -#define SQLRETURN RETCODE - - -#define ODBCVER 0x0250 - -#define SQL_MAX_MESSAGE_LENGTH 512 -#define SQL_MAX_DSN_LENGTH 32 - -/* - * Function return codes - */ -#define SQL_INVALID_HANDLE (-2) -#define SQL_ERROR (-1) -#define SQL_SUCCESS 0 -#define SQL_SUCCESS_WITH_INFO 1 -#define SQL_NO_DATA_FOUND 100 - -/* - * Standard SQL datatypes, using ANSI type numbering - */ -#define SQL_CHAR 1 -#define SQL_NUMERIC 2 -#define SQL_DECIMAL 3 -#define SQL_INTEGER 4 -#define SQL_SMALLINT 5 -#define SQL_FLOAT 6 -#define SQL_REAL 7 -#define SQL_DOUBLE 8 -#define SQL_VARCHAR 12 - -#define SQL_TYPE_MIN SQL_CHAR -#define SQL_TYPE_NULL 0 -#define SQL_TYPE_MAX SQL_VARCHAR - -/* - * C datatype to SQL datatype mapping - */ -#define SQL_C_CHAR SQL_CHAR -#define SQL_C_LONG SQL_INTEGER -#define SQL_C_SHORT SQL_SMALLINT -#define SQL_C_FLOAT SQL_REAL -#define SQL_C_DOUBLE SQL_DOUBLE -#define SQL_C_DEFAULT 99 - -/* - * NULL status constants. - */ -#define SQL_NO_NULLS 0 -#define SQL_NULLABLE 1 -#define SQL_NULLABLE_UNKNOWN 2 - -/* - * Special length values - */ -#define SQL_NULL_DATA (-1) -#define SQL_DATA_AT_EXEC (-2) -#define SQL_NTS (-3) - -/* - * SQLFreeStmt - */ -#define SQL_CLOSE 0 -#define SQL_DROP 1 -#define SQL_UNBIND 2 -#define SQL_RESET_PARAMS 3 - -/* - * SQLTransact - */ -#define SQL_COMMIT 0 -#define SQL_ROLLBACK 1 - -/* - * SQLColAttributes - */ -#define SQL_COLUMN_COUNT 0 -#define SQL_COLUMN_NAME 1 -#define SQL_COLUMN_TYPE 2 -#define SQL_COLUMN_LENGTH 3 -#define SQL_COLUMN_PRECISION 4 -#define SQL_COLUMN_SCALE 5 -#define SQL_COLUMN_DISPLAY_SIZE 6 -#define SQL_COLUMN_NULLABLE 7 -#define SQL_COLUMN_UNSIGNED 8 -#define SQL_COLUMN_MONEY 9 -#define SQL_COLUMN_UPDATABLE 10 -#define SQL_COLUMN_AUTO_INCREMENT 11 -#define SQL_COLUMN_CASE_SENSITIVE 12 -#define SQL_COLUMN_SEARCHABLE 13 -#define SQL_COLUMN_TYPE_NAME 14 -#define SQL_COLUMN_TABLE_NAME 15 -#define SQL_COLUMN_OWNER_NAME 16 -#define SQL_COLUMN_QUALIFIER_NAME 17 -#define SQL_COLUMN_LABEL 18 - -#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL -#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT -#define SQL_COLUMN_DRIVER_START 1000 - -/* - * SQLColAttributes : SQL_COLUMN_UPDATABLE - */ -#define SQL_ATTR_READONLY 0 -#define SQL_ATTR_WRITE 1 -#define SQL_ATTR_READWRITE_UNKNOWN 2 - -/* - * SQLColAttributes : SQL_COLUMN_SEARCHABLE - */ -#define SQL_UNSEARCHABLE 0 -#define SQL_LIKE_ONLY 1 -#define SQL_ALL_EXCEPT_LIKE 2 -#define SQL_SEARCHABLE 3 - -/* - * NULL Handles - */ -#define SQL_NULL_HENV 0 -#define SQL_NULL_HDBC 0 -#define SQL_NULL_HSTMT 0 - - -/* - * Function Prototypes - */ -#ifdef __cplusplus -extern "C" -{ -#endif - - RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc); - RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv); - RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt); - RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType, - PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue); - RETCODE SQL_API SQLCancel (HSTMT hstmt); - RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType, - PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc); - RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN, - UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr); - RETCODE SQL_API SQLDescribeCol (HSTMT hstmt, UWORD icol, - UCHAR FAR * szColName, SWORD cbColNameMax, SWORD FAR * pcbColName, - SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale, - SWORD FAR * pfNullable); - RETCODE SQL_API SQLDisconnect (HDBC hdbc); - RETCODE SQL_API SQLError (HENV henv, HDBC hdbc, HSTMT hstmt, - UCHAR FAR * szSqlState, SDWORD FAR * pfNativeError, UCHAR FAR * szErrorMsg, - SWORD cbErrorMsgMax, SWORD FAR * pcbErrorMsg); - RETCODE SQL_API SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr, - SDWORD cbSqlStr); - RETCODE SQL_API SQLExecute (HSTMT hstmt); - RETCODE SQL_API SQLFetch (HSTMT hstmt); - RETCODE SQL_API SQLFreeConnect (HDBC hdbc); - RETCODE SQL_API SQLFreeEnv (HENV henv); - RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption); - RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor, - SWORD cbCursorMax, SWORD FAR * pcbCursor); - RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol); - RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr, - SDWORD cbSqlStr); - RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow); - RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor, - SWORD cbCursor); - RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType); - -/* - * Deprecated ODBC 1.0 function - Use SQLBindParameter - */ - RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType, - SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue, - SDWORD FAR * pcbValue); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/iodbc/isqlext.h b/src/iodbc/isqlext.h deleted file mode 100644 index 7a8527a0e6..0000000000 --- a/src/iodbc/isqlext.h +++ /dev/null @@ -1,1177 +0,0 @@ -/* - * - * isqlext.h - * - * $Id$ - * - * iODBC defines (ext) - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _ISQLEXT_H -# define _ISQLEXT_H - -#include "isql.h" - -/* - * Generic constants - */ -#define SQL_MAX_OPTION_STRING_LENGTH 256 - -/* - * Additional return codes - */ -#define SQL_STILL_EXECUTING 2 -#define SQL_NEED_DATA 99 - -/* - * SQL extended datatypes - */ -#define SQL_DATE 9 -#define SQL_TIME 10 -#define SQL_TIMESTAMP 11 -#define SQL_LONGVARCHAR (-1) -#define SQL_BINARY (-2) -#define SQL_VARBINARY (-3) -#define SQL_LONGVARBINARY (-4) -#define SQL_BIGINT (-5) -#define SQL_TINYINT (-6) -#define SQL_BIT (-7) - -#define SQL_INTERVAL_YEAR (-80) -#define SQL_INTERVAL_MONTH (-81) -#define SQL_INTERVAL_YEAR_TO_MONTH (-82) -#define SQL_INTERVAL_DAY (-83) -#define SQL_INTERVAL_HOUR (-84) -#define SQL_INTERVAL_MINUTE (-85) -#define SQL_INTERVAL_SECOND (-86) -#define SQL_INTERVAL_DAY_TO_HOUR (-87) -#define SQL_INTERVAL_DAY_TO_MINUTE (-88) -#define SQL_INTERVAL_DAY_TO_SECOND (-89) -#define SQL_INTERVAL_HOUR_TO_MINUTE (-90) -#define SQL_INTERVAL_HOUR_TO_SECOND (-91) -#define SQL_INTERVAL_MINUTE_TO_SECOND (-92) -#define SQL_UNICODE (-95) - -#define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR -#define SQL_TYPE_DRIVER_END SQL_UNICODE - -#define SQL_SIGNED_OFFSET (-20) -#define SQL_UNSIGNED_OFFSET (-22) - -/* - * C datatype to SQL datatype mapping - */ -#define SQL_C_DATE SQL_DATE -#define SQL_C_TIME SQL_TIME -#define SQL_C_TIMESTAMP SQL_TIMESTAMP -#define SQL_C_BINARY SQL_BINARY -#define SQL_C_BIT SQL_BIT -#define SQL_C_TINYINT SQL_TINYINT -#define SQL_C_SLONG SQL_C_LONG+SQL_SIGNED_OFFSET -#define SQL_C_SSHORT SQL_C_SHORT+SQL_SIGNED_OFFSET -#define SQL_C_STINYINT SQL_TINYINT+SQL_SIGNED_OFFSET -#define SQL_C_ULONG SQL_C_LONG+SQL_UNSIGNED_OFFSET -#define SQL_C_USHORT SQL_C_SHORT+SQL_UNSIGNED_OFFSET -#define SQL_C_UTINYINT SQL_TINYINT+SQL_UNSIGNED_OFFSET -#define SQL_C_BOOKMARK SQL_C_ULONG - -/* - * Extended data types override sql.h defined - */ -#undef SQL_TYPE_MIN -#define SQL_TYPE_MIN SQL_BIT -#define SQL_ALL_TYPES 0 - -/* - * SQL portable types for C - DATE, TIME, TIMESTAMP - */ -typedef struct _DATE_STRUCT - { - SWORD year; - UWORD month; - UWORD day; - } -DATE_STRUCT; - -typedef struct _TIME_STRUCT - { - UWORD hour; - UWORD minute; - UWORD second; - } -TIME_STRUCT; - -typedef struct _TIMESTAMP_STRUCT - { - SWORD year; - UWORD month; - UWORD day; - UWORD hour; - UWORD minute; - UWORD second; - UDWORD fraction; - } -TIMESTAMP_STRUCT; - -typedef unsigned long int BOOKMARK; - -/* - * ---------------------------------------------------------------------- - * Level 1 Functions - * ---------------------------------------------------------------------- - */ - -/* - * SQLDriverConnect - */ -#define SQL_DRIVER_NOPROMPT 0 -#define SQL_DRIVER_COMPLETE 1 -#define SQL_DRIVER_PROMPT 2 -#define SQL_DRIVER_COMPLETE_REQUIRED 3 - -/* - * SQLGetData - */ -#define SQL_NO_TOTAL (-4) - -/* - * SQLBindParameter - */ -#define SQL_DEFAULT_PARAM (-5) -#define SQL_IGNORE (-6) -#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100) -#define SQL_LEN_DATA_AT_EXEC(length) (-length+SQL_LEN_DATA_AT_EXEC_OFFSET) - -/* - * SQLGetFunctions - */ -#define SQL_API_SQLALLOCCONNECT 1 /* Core Functions */ -#define SQL_API_SQLALLOCENV 2 -#define SQL_API_SQLALLOCSTMT 3 -#define SQL_API_SQLBINDCOL 4 -#define SQL_API_SQLCANCEL 5 -#define SQL_API_SQLCOLATTRIBUTES 6 -#define SQL_API_SQLCONNECT 7 -#define SQL_API_SQLDESCRIBECOL 8 -#define SQL_API_SQLDISCONNECT 9 -#define SQL_API_SQLERROR 10 -#define SQL_API_SQLEXECDIRECT 11 -#define SQL_API_SQLEXECUTE 12 -#define SQL_API_SQLFETCH 13 -#define SQL_API_SQLFREECONNECT 14 -#define SQL_API_SQLFREEENV 15 -#define SQL_API_SQLFREESTMT 16 -#define SQL_API_SQLGETCURSORNAME 17 -#define SQL_API_SQLNUMRESULTCOLS 18 -#define SQL_API_SQLPREPARE 19 -#define SQL_API_SQLROWCOUNT 20 -#define SQL_API_SQLSETCURSORNAME 21 -#define SQL_API_SQLSETPARAM 22 -#define SQL_API_SQLTRANSACT 23 - -#define SQL_NUM_FUNCTIONS 23 - -#define SQL_EXT_API_START 40 - -#define SQL_API_SQLCOLUMNS 40 /* Level 1 Functions */ -#define SQL_API_SQLDRIVERCONNECT 41 -#define SQL_API_SQLGETCONNECTOPTION 42 -#define SQL_API_SQLGETDATA 43 -#define SQL_API_SQLGETFUNCTIONS 44 -#define SQL_API_SQLGETINFO 45 -#define SQL_API_SQLGETSTMTOPTION 46 -#define SQL_API_SQLGETTYPEINFO 47 -#define SQL_API_SQLPARAMDATA 48 -#define SQL_API_SQLPUTDATA 49 -#define SQL_API_SQLSETCONNECTOPTION 50 -#define SQL_API_SQLSETSTMTOPTION 51 -#define SQL_API_SQLSPECIALCOLUMNS 52 -#define SQL_API_SQLSTATISTICS 53 -#define SQL_API_SQLTABLES 54 - -#define SQL_API_SQLBROWSECONNECT 55 /* Level 2 Functions */ -#define SQL_API_SQLCOLUMNPRIVILEGES 56 -#define SQL_API_SQLDATASOURCES 57 -#define SQL_API_SQLDESCRIBEPARAM 58 -#define SQL_API_SQLEXTENDEDFETCH 59 -#define SQL_API_SQLFOREIGNKEYS 60 -#define SQL_API_SQLMORERESULTS 61 -#define SQL_API_SQLNATIVESQL 62 -#define SQL_API_SQLNUMPARAMS 63 -#define SQL_API_SQLPARAMOPTIONS 64 -#define SQL_API_SQLPRIMARYKEYS 65 -#define SQL_API_SQLPROCEDURECOLUMNS 66 -#define SQL_API_SQLPROCEDURES 67 -#define SQL_API_SQLSETPOS 68 -#define SQL_API_SQLSETSCROLLOPTIONS 69 -#define SQL_API_SQLTABLEPRIVILEGES 70 - -#define SQL_API_SQLDRIVERS 71 -#define SQL_API_SQLBINDPARAMETER 72 -#define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER - -#define SQL_API_ALL_FUNCTIONS 0 - -#define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1) - -/* - * SQLGetInfo - */ -#define SQL_INFO_FIRST 0 -#define SQL_ACTIVE_CONNECTIONS 0 -#define SQL_ACTIVE_STATEMENTS 1 -#define SQL_DATA_SOURCE_NAME 2 -#define SQL_DRIVER_HDBC 3 -#define SQL_DRIVER_HENV 4 -#define SQL_DRIVER_HSTMT 5 -#define SQL_DRIVER_NAME 6 -#define SQL_DRIVER_VER 7 -#define SQL_FETCH_DIRECTION 8 -#define SQL_ODBC_API_CONFORMANCE 9 -#define SQL_ODBC_VER 10 -#define SQL_ROW_UPDATES 11 -#define SQL_ODBC_SAG_CLI_CONFORMANCE 12 -#define SQL_SERVER_NAME 13 -#define SQL_SEARCH_PATTERN_ESCAPE 14 -#define SQL_ODBC_SQL_CONFORMANCE 15 -#define SQL_DBMS_NAME 17 -#define SQL_DBMS_VER 18 -#define SQL_ACCESSIBLE_TABLES 19 -#define SQL_ACCESSIBLE_PROCEDURES 20 -#define SQL_PROCEDURES 21 -#define SQL_CONCAT_NULL_BEHAVIOR 22 -#define SQL_CURSOR_COMMIT_BEHAVIOR 23 -#define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 -#define SQL_DATA_SOURCE_READ_ONLY 25 -#define SQL_DEFAULT_TXN_ISOLATION 26 -#define SQL_EXPRESSIONS_IN_ORDERBY 27 -#define SQL_IDENTIFIER_CASE 28 -#define SQL_IDENTIFIER_QUOTE_CHAR 29 -#define SQL_MAX_COLUMN_NAME_LEN 30 -#define SQL_MAX_CURSOR_NAME_LEN 31 -#define SQL_MAX_OWNER_NAME_LEN 32 -#define SQL_MAX_PROCEDURE_NAME_LEN 33 -#define SQL_MAX_QUALIFIER_NAME_LEN 34 -#define SQL_MAX_TABLE_NAME_LEN 35 -#define SQL_MULT_RESULT_SETS 36 -#define SQL_MULTIPLE_ACTIVE_TXN 37 -#define SQL_OUTER_JOINS 38 -#define SQL_OWNER_TERM 39 -#define SQL_PROCEDURE_TERM 40 -#define SQL_QUALIFIER_NAME_SEPARATOR 41 -#define SQL_QUALIFIER_TERM 42 -#define SQL_SCROLL_CONCURRENCY 43 -#define SQL_SCROLL_OPTIONS 44 -#define SQL_TABLE_TERM 45 -#define SQL_TXN_CAPABLE 46 -#define SQL_USER_NAME 47 -#define SQL_CONVERT_FUNCTIONS 48 -#define SQL_NUMERIC_FUNCTIONS 49 -#define SQL_STRING_FUNCTIONS 50 -#define SQL_SYSTEM_FUNCTIONS 51 -#define SQL_TIMEDATE_FUNCTIONS 52 -#define SQL_CONVERT_BIGINT 53 -#define SQL_CONVERT_BINARY 54 -#define SQL_CONVERT_BIT 55 -#define SQL_CONVERT_CHAR 56 -#define SQL_CONVERT_DATE 57 -#define SQL_CONVERT_DECIMAL 58 -#define SQL_CONVERT_DOUBLE 59 -#define SQL_CONVERT_FLOAT 60 -#define SQL_CONVERT_INTEGER 61 -#define SQL_CONVERT_LONGVARCHAR 62 -#define SQL_CONVERT_NUMERIC 63 -#define SQL_CONVERT_REAL 64 -#define SQL_CONVERT_SMALLINT 65 -#define SQL_CONVERT_TIME 66 -#define SQL_CONVERT_TIMESTAMP 67 -#define SQL_CONVERT_TINYINT 68 -#define SQL_CONVERT_VARBINARY 69 -#define SQL_CONVERT_VARCHAR 70 -#define SQL_CONVERT_LONGVARBINARY 71 -#define SQL_TXN_ISOLATION_OPTION 72 -#define SQL_ODBC_SQL_OPT_IEF 73 - -/* - * ODBC SDK 1.0 Additions - */ -#define SQL_CORRELATION_NAME 74 -#define SQL_NON_NULLABLE_COLUMNS 75 - -/* - * ODBC SDK 2.0 Additions - */ -#define SQL_DRIVER_HLIB 76 -#define SQL_DRIVER_ODBC_VER 77 -#define SQL_LOCK_TYPES 78 -#define SQL_POS_OPERATIONS 79 -#define SQL_POSITIONED_STATEMENTS 80 -#define SQL_GETDATA_EXTENSIONS 81 -#define SQL_BOOKMARK_PERSISTENCE 82 -#define SQL_STATIC_SENSITIVITY 83 -#define SQL_FILE_USAGE 84 -#define SQL_NULL_COLLATION 85 -#define SQL_ALTER_TABLE 86 -#define SQL_COLUMN_ALIAS 87 -#define SQL_GROUP_BY 88 -#define SQL_KEYWORDS 89 -#define SQL_ORDER_BY_COLUMNS_IN_SELECT 90 -#define SQL_OWNER_USAGE 91 -#define SQL_QUALIFIER_USAGE 92 -#define SQL_QUOTED_IDENTIFIER_CASE 93 -#define SQL_SPECIAL_CHARACTERS 94 -#define SQL_SUBQUERIES 95 -#define SQL_UNION 96 -#define SQL_MAX_COLUMNS_IN_GROUP_BY 97 -#define SQL_MAX_COLUMNS_IN_INDEX 98 -#define SQL_MAX_COLUMNS_IN_ORDER_BY 99 -#define SQL_MAX_COLUMNS_IN_SELECT 100 -#define SQL_MAX_COLUMNS_IN_TABLE 101 -#define SQL_MAX_INDEX_SIZE 102 -#define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103 -#define SQL_MAX_ROW_SIZE 104 -#define SQL_MAX_STATEMENT_LEN 105 -#define SQL_MAX_TABLES_IN_SELECT 106 -#define SQL_MAX_USER_NAME_LEN 107 -#define SQL_MAX_CHAR_LITERAL_LEN 108 -#define SQL_TIMEDATE_ADD_INTERVALS 109 -#define SQL_TIMEDATE_DIFF_INTERVALS 110 -#define SQL_NEED_LONG_DATA_LEN 111 -#define SQL_MAX_BINARY_LITERAL_LEN 112 -#define SQL_LIKE_ESCAPE_CLAUSE 113 -#define SQL_QUALIFIER_LOCATION 114 - -/* - * ODBC SDK 2.01 Additions - */ -#define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */ - -#define SQL_INFO_LAST SQL_QUALIFIER_LOCATION -#define SQL_INFO_DRIVER_START 1000 - - -/* - * SQL_CONVERT_* bitmask values - */ -#define SQL_CVT_CHAR 0x00000001L -#define SQL_CVT_NUMERIC 0x00000002L -#define SQL_CVT_DECIMAL 0x00000004L -#define SQL_CVT_INTEGER 0x00000008L -#define SQL_CVT_SMALLINT 0x00000010L -#define SQL_CVT_FLOAT 0x00000020L -#define SQL_CVT_REAL 0x00000040L -#define SQL_CVT_DOUBLE 0x00000080L -#define SQL_CVT_VARCHAR 0x00000100L -#define SQL_CVT_LONGVARCHAR 0x00000200L -#define SQL_CVT_BINARY 0x00000400L -#define SQL_CVT_VARBINARY 0x00000800L -#define SQL_CVT_BIT 0x00001000L -#define SQL_CVT_TINYINT 0x00002000L -#define SQL_CVT_BIGINT 0x00004000L -#define SQL_CVT_DATE 0x00008000L -#define SQL_CVT_TIME 0x00010000L -#define SQL_CVT_TIMESTAMP 0x00020000L -#define SQL_CVT_LONGVARBINARY 0x00040000L - -/* - * SQL_CONVERT_FUNCTIONS - */ -#define SQL_FN_CVT_CONVERT 0x00000001L - -/* - * SQL_STRING_FUNCTIONS - */ -#define SQL_FN_STR_CONCAT 0x00000001L -#define SQL_FN_STR_INSERT 0x00000002L -#define SQL_FN_STR_LEFT 0x00000004L -#define SQL_FN_STR_LTRIM 0x00000008L -#define SQL_FN_STR_LENGTH 0x00000010L -#define SQL_FN_STR_LOCATE 0x00000020L -#define SQL_FN_STR_LCASE 0x00000040L -#define SQL_FN_STR_REPEAT 0x00000080L -#define SQL_FN_STR_REPLACE 0x00000100L -#define SQL_FN_STR_RIGHT 0x00000200L -#define SQL_FN_STR_RTRIM 0x00000400L -#define SQL_FN_STR_SUBSTRING 0x00000800L -#define SQL_FN_STR_UCASE 0x00001000L -#define SQL_FN_STR_ASCII 0x00002000L -#define SQL_FN_STR_CHAR 0x00004000L -#define SQL_FN_STR_DIFFERENCE 0x00008000L -#define SQL_FN_STR_LOCATE_2 0x00010000L -#define SQL_FN_STR_SOUNDEX 0x00020000L -#define SQL_FN_STR_SPACE 0x00040000L - -/* - * SQL_NUMERIC_FUNCTIONS - */ -#define SQL_FN_NUM_ABS 0x00000001L -#define SQL_FN_NUM_ACOS 0x00000002L -#define SQL_FN_NUM_ASIN 0x00000004L -#define SQL_FN_NUM_ATAN 0x00000008L -#define SQL_FN_NUM_ATAN2 0x00000010L -#define SQL_FN_NUM_CEILING 0x00000020L -#define SQL_FN_NUM_COS 0x00000040L -#define SQL_FN_NUM_COT 0x00000080L -#define SQL_FN_NUM_EXP 0x00000100L -#define SQL_FN_NUM_FLOOR 0x00000200L -#define SQL_FN_NUM_LOG 0x00000400L -#define SQL_FN_NUM_MOD 0x00000800L -#define SQL_FN_NUM_SIGN 0x00001000L -#define SQL_FN_NUM_SIN 0x00002000L -#define SQL_FN_NUM_SQRT 0x00004000L -#define SQL_FN_NUM_TAN 0x00008000L -#define SQL_FN_NUM_PI 0x00010000L -#define SQL_FN_NUM_RAND 0x00020000L -#define SQL_FN_NUM_DEGREES 0x00040000L -#define SQL_FN_NUM_LOG10 0x00080000L -#define SQL_FN_NUM_POWER 0x00100000L -#define SQL_FN_NUM_RADIANS 0x00200000L -#define SQL_FN_NUM_ROUND 0x00400000L -#define SQL_FN_NUM_TRUNCATE 0x00800000L - -/* - * SQL_TIMEDATE_FUNCTIONS - */ -#define SQL_FN_TD_NOW 0x00000001L -#define SQL_FN_TD_CURDATE 0x00000002L -#define SQL_FN_TD_DAYOFMONTH 0x00000004L -#define SQL_FN_TD_DAYOFWEEK 0x00000008L -#define SQL_FN_TD_DAYOFYEAR 0x00000010L -#define SQL_FN_TD_MONTH 0x00000020L -#define SQL_FN_TD_QUARTER 0x00000040L -#define SQL_FN_TD_WEEK 0x00000080L -#define SQL_FN_TD_YEAR 0x00000100L -#define SQL_FN_TD_CURTIME 0x00000200L -#define SQL_FN_TD_HOUR 0x00000400L -#define SQL_FN_TD_MINUTE 0x00000800L -#define SQL_FN_TD_SECOND 0x00001000L -#define SQL_FN_TD_TIMESTAMPADD 0x00002000L -#define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L -#define SQL_FN_TD_DAYNAME 0x00008000L -#define SQL_FN_TD_MONTHNAME 0x00010000L - -/* - * SQL_SYSTEM_FUNCTIONS - */ -#define SQL_FN_SYS_USERNAME 0x00000001L -#define SQL_FN_SYS_DBNAME 0x00000002L -#define SQL_FN_SYS_IFNULL 0x00000004L - -/* - * SQL_TIMEDATE_ADD_INTERVALS - * SQL_TIMEDATE_DIFF_INTERVALS - */ -#define SQL_FN_TSI_FRAC_SECOND 0x00000001L -#define SQL_FN_TSI_SECOND 0x00000002L -#define SQL_FN_TSI_MINUTE 0x00000004L -#define SQL_FN_TSI_HOUR 0x00000008L -#define SQL_FN_TSI_DAY 0x00000010L -#define SQL_FN_TSI_WEEK 0x00000020L -#define SQL_FN_TSI_MONTH 0x00000040L -#define SQL_FN_TSI_QUARTER 0x00000080L -#define SQL_FN_TSI_YEAR 0x00000100L - -/* - * SQL_ODBC_API_CONFORMANCE - */ -#define SQL_OAC_NONE 0x0000 -#define SQL_OAC_LEVEL1 0x0001 -#define SQL_OAC_LEVEL2 0x0002 - -/* - * SQL_ODBC_SAG_CLI_CONFORMANCE - */ -#define SQL_OSCC_NOT_COMPLIANT 0x0000 -#define SQL_OSCC_COMPLIANT 0x0001 - -/* - * SQL_ODBC_SQL_CONFORMANCE - */ -#define SQL_OSC_MINIMUM 0x0000 -#define SQL_OSC_CORE 0x0001 -#define SQL_OSC_EXTENDED 0x0002 - -/* - * SQL_CONCAT_NULL_BEHAVIOR - */ -#define SQL_CB_NULL 0x0000 -#define SQL_CB_NON_NULL 0x0001 - -/* - * SQL_CURSOR_COMMIT_BEHAVIOR - * SQL_CURSOR_ROLLBACK_BEHAVIOR - */ -#define SQL_CB_DELETE 0x0000 -#define SQL_CB_CLOSE 0x0001 -#define SQL_CB_PRESERVE 0x0002 - -/* - * SQL_IDENTIFIER_CASE - */ -#define SQL_IC_UPPER 0x0001 -#define SQL_IC_LOWER 0x0002 -#define SQL_IC_SENSITIVE 0x0003 -#define SQL_IC_MIXED 0x0004 - -/* - * SQL_TXN_CAPABLE - */ -#define SQL_TC_NONE 0x0000 -#define SQL_TC_DML 0x0001 -#define SQL_TC_ALL 0x0002 -#define SQL_TC_DDL_COMMIT 0x0003 -#define SQL_TC_DDL_IGNORE 0x0004 - -/* - * SQL_SCROLL_OPTIONS - */ -#define SQL_SO_FORWARD_ONLY 0x00000001L -#define SQL_SO_KEYSET_DRIVEN 0x00000002L -#define SQL_SO_DYNAMIC 0x00000004L -#define SQL_SO_MIXED 0x00000008L -#define SQL_SO_STATIC 0x00000010L - -/* - * SQL_SCROLL_CONCURRENCY - */ -#define SQL_SCCO_READ_ONLY 0x00000001L -#define SQL_SCCO_LOCK 0x00000002L -#define SQL_SCCO_OPT_ROWVER 0x00000004L -#define SQL_SCCO_OPT_VALUES 0x00000008L - -/* - * SQL_FETCH_DIRECTION - */ -#define SQL_FD_FETCH_NEXT 0x00000001L -#define SQL_FD_FETCH_FIRST 0x00000002L -#define SQL_FD_FETCH_LAST 0x00000004L -#define SQL_FD_FETCH_PRIOR 0x00000008L -#define SQL_FD_FETCH_ABSOLUTE 0x00000010L -#define SQL_FD_FETCH_RELATIVE 0x00000020L -#define SQL_FD_FETCH_RESUME 0x00000040L -#define SQL_FD_FETCH_BOOKMARK 0x00000080L - -/* - * SQL_TXN_ISOLATION_OPTION - */ -#define SQL_TXN_READ_UNCOMMITTED 0x00000001L -#define SQL_TXN_READ_COMMITTED 0x00000002L -#define SQL_TXN_REPEATABLE_READ 0x00000004L -#define SQL_TXN_SERIALIZABLE 0x00000008L -#define SQL_TXN_VERSIONING 0x00000010L - -/* - * SQL_CORRELATION_NAME - */ -#define SQL_CN_NONE 0x0000 -#define SQL_CN_DIFFERENT 0x0001 -#define SQL_CN_ANY 0x0002 - -/* - * SQL_NON_NULLABLE_COLUMNS - */ -#define SQL_NNC_NULL 0x0000 -#define SQL_NNC_NON_NULL 0x0001 - -/* - * SQL_NULL_COLLATION - */ -#define SQL_NC_HIGH 0x0000 -#define SQL_NC_LOW 0x0001 -#define SQL_NC_START 0x0002 -#define SQL_NC_END 0x0004 - -/* - * SQL_FILE_USAGE - */ -#define SQL_FILE_NOT_SUPPORTED 0x0000 -#define SQL_FILE_TABLE 0x0001 -#define SQL_FILE_QUALIFIER 0x0002 - -/* - * SQL_GETDATA_EXTENSIONS - */ -#define SQL_GD_ANY_COLUMN 0x00000001L -#define SQL_GD_ANY_ORDER 0x00000002L -#define SQL_GD_BLOCK 0x00000004L -#define SQL_GD_BOUND 0x00000008L - -/* - * SQL_ALTER_TABLE - */ -#define SQL_AT_ADD_COLUMN 0x00000001L -#define SQL_AT_DROP_COLUMN 0x00000002L - -/* - * SQL_POSITIONED_STATEMENTS - */ -#define SQL_PS_POSITIONED_DELETE 0x00000001L -#define SQL_PS_POSITIONED_UPDATE 0x00000002L -#define SQL_PS_SELECT_FOR_UPDATE 0x00000004L - -/* - * SQL_GROUP_BY - */ -#define SQL_GB_NOT_SUPPORTED 0x0000 -#define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001 -#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002 -#define SQL_GB_NO_RELATION 0x0003 - -/* - * SQL_OWNER_USAGE - */ -#define SQL_OU_DML_STATEMENTS 0x00000001L -#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L -#define SQL_OU_TABLE_DEFINITION 0x00000004L -#define SQL_OU_INDEX_DEFINITION 0x00000008L -#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L - -/* - * SQL_QUALIFIER_USAGE - */ -#define SQL_QU_DML_STATEMENTS 0x00000001L -#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L -#define SQL_QU_TABLE_DEFINITION 0x00000004L -#define SQL_QU_INDEX_DEFINITION 0x00000008L -#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L - -/* - * SQL_SUBQUERIES - */ -#define SQL_SQ_COMPARISON 0x00000001L -#define SQL_SQ_EXISTS 0x00000002L -#define SQL_SQ_IN 0x00000004L -#define SQL_SQ_QUANTIFIED 0x00000008L -#define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L - -/* - * SQL_UNION - */ -#define SQL_U_UNION 0x00000001L -#define SQL_U_UNION_ALL 0x00000002L - -/* - * SQL_BOOKMARK_PERSISTENCE - */ -#define SQL_BP_CLOSE 0x00000001L -#define SQL_BP_DELETE 0x00000002L -#define SQL_BP_DROP 0x00000004L -#define SQL_BP_TRANSACTION 0x00000008L -#define SQL_BP_UPDATE 0x00000010L -#define SQL_BP_OTHER_HSTMT 0x00000020L -#define SQL_BP_SCROLL 0x00000040L - -/* - * SQL_STATIC_SENSITIVITY - */ -#define SQL_SS_ADDITIONS 0x00000001L -#define SQL_SS_DELETIONS 0x00000002L -#define SQL_SS_UPDATES 0x00000004L - -/* - * SQL_LOCK_TYPES - */ -#define SQL_LCK_NO_CHANGE 0x00000001L -#define SQL_LCK_EXCLUSIVE 0x00000002L -#define SQL_LCK_UNLOCK 0x00000004L - -/* - * SQL_POS_OPERATIONS - */ -#define SQL_POS_POSITION 0x00000001L -#define SQL_POS_REFRESH 0x00000002L -#define SQL_POS_UPDATE 0x00000004L -#define SQL_POS_DELETE 0x00000008L -#define SQL_POS_ADD 0x00000010L - -/* - * SQL_QUALIFIER_LOCATION - */ -#define SQL_QL_START 0x0001L -#define SQL_QL_END 0x0002L - -/* - * SQL_OJ_CAPABILITIES - */ -#define SQL_OJ_LEFT 0x00000001L -#define SQL_OJ_RIGHT 0x00000002L -#define SQL_OJ_FULL 0x00000004L -#define SQL_OJ_NESTED 0x00000008L -#define SQL_OJ_NOT_ORDERED 0x00000010L -#define SQL_OJ_INNER 0x00000020L -#define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L - -/* - * SQLGetStmtOption/SQLSetStmtOption - */ -#define SQL_QUERY_TIMEOUT 0 -#define SQL_MAX_ROWS 1 -#define SQL_NOSCAN 2 -#define SQL_MAX_LENGTH 3 -#define SQL_ASYNC_ENABLE 4 -#define SQL_BIND_TYPE 5 -#define SQL_CURSOR_TYPE 6 -#define SQL_CONCURRENCY 7 -#define SQL_KEYSET_SIZE 8 -#define SQL_ROWSET_SIZE 9 -#define SQL_SIMULATE_CURSOR 10 -#define SQL_RETRIEVE_DATA 11 -#define SQL_USE_BOOKMARKS 12 -#define SQL_GET_BOOKMARK 13 -#define SQL_ROW_NUMBER 14 - -#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT -#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER - - -/* - * SQL_QUERY_TIMEOUT - */ -#define SQL_QUERY_TIMEOUT_DEFAULT 0UL - -/* - * SQL_MAX_ROWS - */ -#define SQL_MAX_ROWS_DEFAULT 0UL - -/* - * SQL_NOSCAN - */ -#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */ -#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */ -#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF - -/* - * SQL_MAX_LENGTH - */ -#define SQL_MAX_LENGTH_DEFAULT 0UL - -/* - * SQL_ASYNC_ENABLE - */ -#define SQL_ASYNC_ENABLE_OFF 0UL -#define SQL_ASYNC_ENABLE_ON 1UL -#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF - -/* - * SQL_BIND_TYPE - */ -#define SQL_BIND_BY_COLUMN 0UL -#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN - -/* - * SQL_CONCURRENCY - */ -#define SQL_CONCUR_READ_ONLY 1 -#define SQL_CONCUR_LOCK 2 -#define SQL_CONCUR_ROWVER 3 -#define SQL_CONCUR_VALUES 4 -#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY - -/* - * SQL_CURSOR_TYPE - */ -#define SQL_CURSOR_FORWARD_ONLY 0UL -#define SQL_CURSOR_KEYSET_DRIVEN 1UL -#define SQL_CURSOR_DYNAMIC 2UL -#define SQL_CURSOR_STATIC 3UL -#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY - -/* - * SQL_ROWSET_SIZE - */ -#define SQL_ROWSET_SIZE_DEFAULT 1UL - -/* - * SQL_KEYSET_SIZE - */ -#define SQL_KEYSET_SIZE_DEFAULT 0UL - -/* - * SQL_SIMULATE_CURSOR - */ -#define SQL_SC_NON_UNIQUE 0UL -#define SQL_SC_TRY_UNIQUE 1UL -#define SQL_SC_UNIQUE 2UL - -/* - * SQL_RETRIEVE_DATA - */ -#define SQL_RD_OFF 0UL -#define SQL_RD_ON 1UL -#define SQL_RD_DEFAULT SQL_RD_ON - -/* - * SQL_USE_BOOKMARKS - */ -#define SQL_UB_OFF 0UL -#define SQL_UB_ON 1UL -#define SQL_UB_DEFAULT SQL_UB_OFF - -/* - * SQLSetConnectOption/SQLGetConnectOption - */ -#define SQL_ACCESS_MODE 101 -#define SQL_AUTOCOMMIT 102 -#define SQL_LOGIN_TIMEOUT 103 -#define SQL_OPT_TRACE 104 -#define SQL_OPT_TRACEFILE 105 -#define SQL_TRANSLATE_DLL 106 -#define SQL_TRANSLATE_OPTION 107 -#define SQL_TXN_ISOLATION 108 -#define SQL_CURRENT_QUALIFIER 109 -#define SQL_ODBC_CURSORS 110 -#define SQL_QUIET_MODE 111 -#define SQL_PACKET_SIZE 112 - -#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE -#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE -#define SQL_CONNECT_OPT_DRVR_START 1000 - - -/* - * SQL_ACCESS_MODE - */ -#define SQL_MODE_READ_WRITE 0UL -#define SQL_MODE_READ_ONLY 1UL -#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE - -/* - * SQL_AUTOCOMMIT - */ -#define SQL_AUTOCOMMIT_OFF 0UL -#define SQL_AUTOCOMMIT_ON 1UL -#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON - -/* - * SQL_LOGIN_TIMEOUT - */ -#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL - -/* - * SQL_OPT_TRACE - */ -#define SQL_OPT_TRACE_OFF 0UL -#define SQL_OPT_TRACE_ON 1UL -#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF -#define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log" - -/* - * SQL_ODBC_CURSORS - */ -#define SQL_CUR_USE_IF_NEEDED 0UL -#define SQL_CUR_USE_ODBC 1UL -#define SQL_CUR_USE_DRIVER 2UL -#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER - -/* - * SQLSpecialColumns - Column types and scopes - */ -#define SQL_BEST_ROWID 1 -#define SQL_ROWVER 2 - -#define SQL_SCOPE_CURROW 0 -#define SQL_SCOPE_TRANSACTION 1 -#define SQL_SCOPE_SESSION 2 - -/* - * SQLSetPos - */ -#define SQL_ENTIRE_ROWSET 0 - -/* - * SQLSetPos - */ -#define SQL_POSITION 0 -#define SQL_REFRESH 1 -#define SQL_UPDATE 2 -#define SQL_DELETE 3 -#define SQL_ADD 4 - -/* - * SQLSetPos - */ -#define SQL_LOCK_NO_CHANGE 0 -#define SQL_LOCK_EXCLUSIVE 1 -#define SQL_LOCK_UNLOCK 2 - -/* - * SQLSetPos - */ -#define SQL_POSITION_TO(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE) -#define SQL_LOCK_RECORD(hstmt,irow,fLock) \ - SQLSetPos(hstmt,irow,SQL_POSITION,fLock) -#define SQL_REFRESH_RECORD(hstmt,irow,fLock) \ - SQLSetPos(hstmt,irow,SQL_REFRESH,fLock) -#define SQL_UPDATE_RECORD(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE) -#define SQL_DELETE_RECORD(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE) -#define SQL_ADD_RECORD(hstmt,irow) \ - SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE) - -/* - * All the ODBC keywords - */ -#define SQL_ODBC_KEYWORDS \ -"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\ -"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\ -"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\ -"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\ -"COBOL,COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\ -"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\ -"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\ -"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\ -"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\ -"DISTINCT,DOMAIN,DOUBLE,DROP,"\ -"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\ -"EXISTS,EXTERNAL,EXTRACT,"\ -"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\ -"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\ -"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\ -"INPUT,INSENSITIVE,INSERT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\ -"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\ -"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,MUMPS,"\ -"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\ -"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\ -"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\ -"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\ -"REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS,"\ -"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SEQUENCE,SESSION,SESSION_USER,SET,SIZE,"\ -"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\ -"SUBSTRING,SUM,SYSTEM_USER,"\ -"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\ -"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\ -"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\ -"VALUE,,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,YEAR" - -/* - * ---------------------------------------------------------------------- - * Level 2 Functions - * ---------------------------------------------------------------------- - */ - -/* - * SQLExtendedFetch - fFetchType - */ -#define SQL_FETCH_NEXT 1 -#define SQL_FETCH_FIRST 2 -#define SQL_FETCH_LAST 3 -#define SQL_FETCH_PRIOR 4 -#define SQL_FETCH_ABSOLUTE 5 -#define SQL_FETCH_RELATIVE 6 -#define SQL_FETCH_BOOKMARK 8 - -/* - * SQLExtendedFetch - rgfRowStatus - */ -#define SQL_ROW_SUCCESS 0 -#define SQL_ROW_DELETED 1 -#define SQL_ROW_UPDATED 2 -#define SQL_ROW_NOROW 3 -#define SQL_ROW_ADDED 4 -#define SQL_ROW_ERROR 5 - -/* - * SQLForeignKeys - UPDATE_RULE/DELETE_RULE - */ -#define SQL_CASCADE 0 -#define SQL_RESTRICT 1 -#define SQL_SET_NULL 2 - -/* - * SQLBindParameter - fParamType - * SQLProcedureColumns - COLUMN_TYPE - */ -#define SQL_PARAM_TYPE_UNKNOWN 0 -#define SQL_PARAM_INPUT 1 -#define SQL_PARAM_INPUT_OUTPUT 2 -#define SQL_RESULT_COL 3 -#define SQL_PARAM_OUTPUT 4 -#define SQL_RETURN_VALUE 5 - -/* - * SQLSetParam to SQLBindParameter conversion - */ -#define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT -#define SQL_SETPARAM_VALUE_MAX (-1L) - -/* - * SQLStatistics - fUnique - */ -#define SQL_INDEX_UNIQUE 0 -#define SQL_INDEX_ALL 1 - -/* - * SQLStatistics - fAccuracy - */ -#define SQL_QUICK 0 -#define SQL_ENSURE 1 - -/* - * SQLStatistics - TYPE - */ -#define SQL_TABLE_STAT 0 -#define SQL_INDEX_CLUSTERED 1 -#define SQL_INDEX_HASHED 2 -#define SQL_INDEX_OTHER 3 - -/* - * SQLProcedures - PROCEDURE_TYPE - */ -#define SQL_PT_UNKNOWN 0 -#define SQL_PT_PROCEDURE 1 -#define SQL_PT_FUNCTION 2 - -/* - * SQLSpecialColumns - PSEUDO_COLUMN - */ -#define SQL_PC_UNKNOWN 0 -#define SQL_PC_NOT_PSEUDO 1 -#define SQL_PC_PSEUDO 2 - -/* - * Deprecated defines from prior versions of ODBC - */ -#define SQL_DATABASE_NAME 16 -#define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR -#define SQL_FETCH_PREV SQL_FETCH_PRIOR -#define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER -#define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER -#define SQL_CC_DELETE SQL_CB_DELETE -#define SQL_CR_DELETE SQL_CB_DELETE -#define SQL_CC_CLOSE SQL_CB_CLOSE -#define SQL_CR_CLOSE SQL_CB_CLOSE -#define SQL_CC_PRESERVE SQL_CB_PRESERVE -#define SQL_CR_PRESERVE SQL_CB_PRESERVE -#define SQL_FETCH_RESUME 7 -#define SQL_SCROLL_FORWARD_ONLY 0L -#define SQL_SCROLL_KEYSET_DRIVEN (-1L) -#define SQL_SCROLL_DYNAMIC (-2L) -#define SQL_SCROLL_STATIC (-3L) -#define SQL_PC_NON_PSEUDO SQL_PC_NOT_PSEUDO - -#ifdef __cplusplus -extern "C" { -#endif -/* - * Level 1 function prototypes - */ -RETCODE SQL_API SQLColumns (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName, UCHAR FAR * szColumnName, - SWORD cbColumnName); -RETCODE SQL_API SQLDriverConnect (HDBC hdbc, SQLHWND hwnd, - UCHAR FAR * szConnStrIn, SWORD cbConnStrIn, UCHAR FAR * szConnStrOut, - SWORD cbConnStrOutMax, SWORD FAR * pcbConnStrOut, UWORD fDriverCompletion); -RETCODE SQL_API SQLGetConnectOption (HDBC hdbc, UWORD fOption, PTR pvParam); -RETCODE SQL_API SQLGetData (HSTMT hstmt, UWORD icol, SWORD fCType, - PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue); -RETCODE SQL_API SQLGetFunctions (HDBC hdbc, UWORD fFunction, - UWORD FAR * pfExists); -RETCODE SQL_API SQLGetInfo (HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue, - SWORD cbInfoValueMax, SWORD FAR * pcbInfoValue); -RETCODE SQL_API SQLGetStmtOption (HSTMT hstmt, UWORD fOption, PTR pvParam); -RETCODE SQL_API SQLGetTypeInfo (HSTMT hstmt, SWORD fSqlType); -RETCODE SQL_API SQLParamData (HSTMT hstmt, PTR FAR * prgbValue); -RETCODE SQL_API SQLPutData (HSTMT hstmt, PTR rgbValue, SDWORD cbValue); -RETCODE SQL_API SQLSetConnectOption (HDBC hdbc, UWORD fOption, UDWORD vParam); -RETCODE SQL_API SQLSetStmtOption (HSTMT hstmt, UWORD fOption, UDWORD vParam); -RETCODE SQL_API SQLSpecialColumns (HSTMT hstmt, UWORD fColType, - UCHAR FAR * szTableQualifier, SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, SWORD cbTableOwner, UCHAR FAR * szTableName, - SWORD cbTableName, UWORD fScope, UWORD fNullable); -RETCODE SQL_API SQLStatistics (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName, UWORD fUnique, UWORD fAccuracy); -RETCODE SQL_API SQLTables (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName, UCHAR FAR * szTableType, - SWORD cbTableType); - -/* - * Level 2 function prototypes - */ -RETCODE SQL_API SQLBrowseConnect (HDBC hdbc, - UCHAR FAR * szConnStrIn, SWORD cbConnStrIn, UCHAR FAR * szConnStrOut, - SWORD cbConnStrOutMax, SWORD FAR * pcbConnStrOut); -RETCODE SQL_API SQLColumnPrivileges (HSTMT hstmt, - UCHAR FAR * szTableQualifier, SWORD cbTableQualifier, - UCHAR FAR * szTableOwner, SWORD cbTableOwner, UCHAR FAR * szTableName, - SWORD cbTableName, UCHAR FAR * szColumnName, SWORD cbColumnName); -RETCODE SQL_API SQLDataSources (HENV henv, UWORD fDirection, - UCHAR FAR * szDSN, SWORD cbDSNMax, SWORD FAR * pcbDSN, - UCHAR FAR * szDescription, SWORD cbDescriptionMax, - SWORD FAR * pcbDescription); -RETCODE SQL_API SQLDescribeParam (HSTMT hstmt, UWORD ipar, - SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale, - SWORD FAR * pfNullable); -RETCODE SQL_API SQLExtendedFetch (HSTMT hstmt, UWORD fFetchType, SDWORD irow, - UDWORD FAR * pcrow, UWORD FAR * rgfRowStatus); -RETCODE SQL_API SQLForeignKeys (HSTMT hstmt, UCHAR FAR * szPkTableQualifier, - SWORD cbPkTableQualifier, UCHAR FAR * szPkTableOwner, SWORD cbPkTableOwner, - UCHAR FAR * szPkTableName, SWORD cbPkTableName, - UCHAR FAR * szFkTableQualifier, SWORD cbFkTableQualifier, - UCHAR FAR * szFkTableOwner, SWORD cbFkTableOwner, UCHAR FAR * szFkTableName, - SWORD cbFkTableName); -RETCODE SQL_API SQLMoreResults (HSTMT hstmt); -RETCODE SQL_API SQLNativeSql (HDBC hdbc, UCHAR FAR * szSqlStrIn, - SDWORD cbSqlStrIn, UCHAR FAR * szSqlStr, SDWORD cbSqlStrMax, - SDWORD FAR * pcbSqlStr); -RETCODE SQL_API SQLNumParams (HSTMT hstmt, SWORD FAR * pcpar); -RETCODE SQL_API SQLParamOptions (HSTMT hstmt, UDWORD crow, UDWORD FAR * pirow); -RETCODE SQL_API SQLPrimaryKeys (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName); -RETCODE SQL_API SQLProcedureColumns (HSTMT hstmt, UCHAR FAR * szProcQualifier, - SWORD cbProcQualifier, UCHAR FAR * szProcOwner, SWORD cbProcOwner, - UCHAR FAR * szProcName, SWORD cbProcName, UCHAR FAR * szColumnName, - SWORD cbColumnName); -RETCODE SQL_API SQLProcedures (HSTMT hstmt, UCHAR FAR * szProcQualifier, - SWORD cbProcQualifier, UCHAR FAR * szProcOwner, SWORD cbProcOwner, - UCHAR FAR * szProcName, SWORD cbProcName); -RETCODE SQL_API SQLSetPos (HSTMT hstmt, UWORD irow, UWORD fOption, UWORD fLock); -RETCODE SQL_API SQLTablePrivileges (HSTMT hstmt, UCHAR FAR * szTableQualifier, - SWORD cbTableQualifier, UCHAR FAR * szTableOwner, SWORD cbTableOwner, - UCHAR FAR * szTableName, SWORD cbTableName); - -/* - * SDK 2.0 Additional function prototypes - */ -RETCODE SQL_API SQLDrivers (HENV henv, UWORD fDirection, - UCHAR FAR * szDriverDesc, SWORD cbDriverDescMax, SWORD FAR * pcbDriverDesc, - UCHAR FAR * szDriverAttributes, SWORD cbDrvrAttrMax, - SWORD FAR * pcbDrvrAttr); -RETCODE SQL_API SQLBindParameter (HSTMT hstmt, UWORD ipar, SWORD fParamType, - SWORD fCType, SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue, - SDWORD cbValueMax, SDWORD FAR * pcbValue); - -/* - * Deprecated - use SQLSetStmtOptions - */ -RETCODE SQL_API SQLSetScrollOptions (HSTMT hstmt, UWORD fConcurrency, - SDWORD crowKeyset, UWORD crowRowset); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/iodbc/itrace.c b/src/iodbc/itrace.c deleted file mode 100644 index 7b64169838..0000000000 --- a/src/iodbc/itrace.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * itrace.c - * - * $Id$ - * - * Trace functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "itrace.h" - -#include "herr.h" -#include "henv.h" -#include "henv.ci" - -#include - -static int -printreturn (void FAR * istm, int ret) -{ - FILE FAR *stm = (FILE FAR *) istm; - char FAR *ptr = "Invalid return value"; - - switch (ret) - { - case SQL_SUCCESS: - ptr = "SQL_SUCCESS"; - break; - - case SQL_SUCCESS_WITH_INFO: - ptr = "SQL_SUCCESS_WITH_INFO"; - break; - - case SQL_NO_DATA_FOUND: - ptr = "SQL_NO_DATA_FOUND"; - break; - - case SQL_NEED_DATA: - ptr = "SQL_NEED_DATA"; - break; - - case SQL_INVALID_HANDLE: - ptr = "SQL_INVALID_HANDLE"; - break; - - case SQL_ERROR: - ptr = "SQL_ERROR"; - break; - - case SQL_STILL_EXECUTING: - ptr = "SQL_STILL_EXECUTING"; - break; - - default: - break; - } - - fprintf (stm, "%s\n", ptr); - fflush (stm); - - return 0; -} - - -HPROC -_iodbcdm_gettrproc (void FAR * istm, int procid, int type) -{ - FILE FAR *stm = (FILE FAR *) istm; - - if (type == TRACE_TYPE_DM2DRV) - { - int i, j = 0; - - for (i = 0; j != en_NullProc; i++) - { - j = odbcapi_symtab[i].en_idx; - - if (j == procid) - { - fprintf (stm, "\n%s ( ... )\n", odbcapi_symtab[i].symbol); - - fflush (stm); - } - } - } - - if (type == TRACE_TYPE_RETURN) - { - return (HPROC) printreturn; - } - - return SQL_NULL_HPROC; -} diff --git a/src/iodbc/itrace.h b/src/iodbc/itrace.h deleted file mode 100644 index 61ba072ec8..0000000000 --- a/src/iodbc/itrace.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * itrace.h - * - * $Id$ - * - * Trace functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _ITRACE_H -#define _ITRACE_H - -#ifdef DEBUG - -#ifndef NO_TRACE -#define NO_TRACE -#endif - -#endif - -#define TRACE_TYPE_APP2DM 1 -#define TRACE_TYPE_DM2DRV 2 -#define TRACE_TYPE_DRV2DM 3 - -#define TRACE_TYPE_RETURN 4 - -extern HPROC _iodbcdm_gettrproc (void FAR * stm, int procid, int type); - -#ifdef NO_TRACE -#define TRACE_CALL( stm, trace_on, procid, plist ) -#else -#define TRACE_CALL( stm, trace_on, plist )\ - {\ - if( trace_on)\ - {\ - HPROC hproc;\ -\ - hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\ -\ - if( hproc )\ - hproc plist;\ - }\ - } -#endif - -#ifdef NO_TRACE -#define TRACE_DM2DRV( stm, procid, plist ) -#else -#define TRACE_DM2DRV( stm, procid, plist )\ - {\ - HPROC hproc;\ -\ - hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\ -\ - if( hproc )\ - hproc plist;\ - } -#endif - -#ifdef NO_TRACE -#define TRACE_DRV2DM( stm, procid, plist ) -#else -#define TRACE_DRV2DM( stm, procid, plist ) \ - {\ - HPROC hproc;\ -\ - hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\ -\ - if( hproc )\ - hproc plist;\ - } -#endif - -#ifdef NO_TRACE -#define TRACE_RETURN( stm, trace_on, ret ) -#else -#define TRACE_RETURN( stm, trace_on, ret )\ - {\ - if( trace_on ) {\ - HPROC hproc;\ -\ - hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\ -\ - if( hproc )\ - hproc( stm, ret );\ - }\ - } -#endif - -#ifdef NO_TRACE -#define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; } -#else -#define CALL_DRIVER( hdbc, ret, proc, procid, plist )\ - {\ - DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\ -\ - if( pdbc->trace ) {\ - TRACE_DM2DRV( pdbc->tstm, procid, plist )\ - ret = proc plist;\ - TRACE_DRV2DM( pdbc->tstm, procid, plist )\ - TRACE_RETURN( pdbc->tstm, 1, ret )\ - }\ - else\ - ret = proc plist;\ - } -#endif - -#endif diff --git a/src/iodbc/misc.c b/src/iodbc/misc.c deleted file mode 100644 index a31cee6cc6..0000000000 --- a/src/iodbc/misc.c +++ /dev/null @@ -1,413 +0,0 @@ -/* - * misc.c - * - * $Id$ - * - * Miscellaneous functions - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include -#include - -static int -upper_strneq ( - char *s1, - char *s2, - int n) -{ - int i; - char c1, c2; - - for (i = 1; i < n; i++) - { - c1 = s1[i]; - c2 = s2[i]; - - if (c1 >= 'a' && c1 <= 'z') - { - c1 += ('A' - 'a'); - } - else if (c1 == '\n') - { - c1 = '\0'; - } - - if (c2 >= 'a' && c2 <= 'z') - { - c2 += ('A' - 'a'); - } - else if (c2 == '\n') - { - c2 = '\0'; - } - - if ((c1 - c2) || !c1 || !c2) - { - break; - } - } - - return (int) !(c1 - c2); -} - -static char * /* return new position in input str */ -readtoken ( - char *istr, /* old position in input buf */ - char *obuf) /* token string ( if "\0", then finished ) */ -{ - char *start = obuf; - - /* Skip leading white space */ - while (*istr == ' ' || *istr == '\t') - istr++; - - for (; *istr && *istr != '\n'; istr++) - { - char c, nx; - - c = *(istr); - nx = *(istr + 1); - - if (c == ';') - { - for (; *istr && *istr != '\n'; istr++); - break; - } - *obuf = c; - obuf++; - - if (nx == ';' || nx == '=' || c == '=') - { - istr++; - break; - } - } - *obuf = '\0'; - - /* Trim end of token */ - for (; obuf > start && (*(obuf - 1) == ' ' || *(obuf - 1) == '\t');) - *--obuf = '\0'; - - return istr; -} - -#if !defined(WINDOWS) && !defined(WIN32) && !defined(OS2) -# include -# define UNIX_PWD -#endif - -char * -_iodbcdm_getinifile (char *buf, int size) -{ - int i, j; - char *ptr; - - j = STRLEN ("/odbc.ini") + 1; - - if (size < j) - { - return NULL; - } - -#if !defined(UNIX_PWD) - - i = GetWindowsDirectory ((LPSTR) buf, size); - - if (i == 0 || i > size - j) - { - return NULL; - } - - sprintf (buf + i, "/odbc.ini"); - - return buf; -#else - if ((ptr = getenv ("ODBCINI")) != NULL) - { - strcpy (buf, ptr); - return buf; - } - - if ((ptr = getenv ("IODBCINI")) != NULL) - { - strcpy (buf, ptr); - return buf; - } - - if ((ptr = getenv ("HOME")) == NULL) - { - ptr = (char *) getpwuid (getuid ()); - - if (ptr == NULL) - { - return NULL; - } - - ptr = ((struct passwd *) ptr)->pw_dir; - } - - if (ptr == NULL || *ptr == '\0') - { - ptr = "/home"; - } - - if (size < STRLEN (ptr) + j) - { - return NULL; - } - - sprintf (buf, "%s%s", ptr, "/.odbc.ini"); - /* i.e. searching ~/.odbc.ini */ -#endif - - return buf; -} - - -/* - * read odbc init file to resolve the value of specified - * key from named or defaulted dsn section - */ -char * -_iodbcdm_getkeyvalbydsn ( - char *dsn, - int dsnlen, - char *keywd, - char *value, - int size) -{ - char buf[1024]; - char dsntk[SQL_MAX_DSN_LENGTH + 3] = {'[', '\0'}; - char token[1024]; /* large enough */ - FILE *file; - char pathbuf[1024]; - char *path; - -#define DSN_NOMATCH 0 -#define DSN_NAMED 1 -#define DSN_DEFAULT 2 - - int dsnid = DSN_NOMATCH; - int defaultdsn = DSN_NOMATCH; - - if (dsn == NULL || *dsn == 0) - { - dsn = "default"; - dsnlen = STRLEN (dsn); - } - - if (dsnlen == SQL_NTS) - { - dsnlen = STRLEN (dsn); - } - - if (dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0) - { - return NULL; - } - - if (dsnlen > sizeof (dsntk) - 2) - { - return NULL; - } - - value[0] = '\0'; - - STRNCAT (dsntk, dsn, dsnlen); - STRCAT (dsntk, "]"); - - dsnlen = dsnlen + 2; - - path = _iodbcdm_getinifile (pathbuf, sizeof (pathbuf)); - - if (path == NULL) - { - return NULL; - } - - file = (FILE *) fopen (path, "r"); - - if (file == NULL) - { - return NULL; - } - - for (;;) - { - char *str; - - str = fgets (buf, sizeof (buf), file); - - if (str == NULL) - { - break; - } - - if (*str == '[') - { - if (upper_strneq (str, "[default]", STRLEN ("[default]"))) - { - /* we only read first dsn default dsn - * section (as well as named dsn). - */ - if (defaultdsn == DSN_NOMATCH) - { - dsnid = DSN_DEFAULT; - defaultdsn = DSN_DEFAULT; - } - else - { - dsnid = DSN_NOMATCH; - } - - continue; - } - else if (upper_strneq (str, dsntk, dsnlen)) - { - dsnid = DSN_NAMED; - } - else - { - dsnid = DSN_NOMATCH; - } - - continue; - } - else if (dsnid == DSN_NOMATCH) - { - continue; - } - - str = readtoken (str, token); - - if (upper_strneq (keywd, token, STRLEN (keywd))) - { - str = readtoken (str, token); - - if (!STREQ (token, "=")) - /* something other than = */ - { - continue; - } - - str = readtoken (str, token); - - if (STRLEN (token) > size - 1) - { - break; - } - - STRNCPY (value, token, size); - /* copy the value(i.e. next token) to buf */ - - if (dsnid != DSN_DEFAULT) - { - break; - } - } - } - - fclose (file); - - return (*value) ? value : NULL; -} - - -char * -_iodbcdm_getkeyvalinstr ( - char *cnstr, - int cnlen, - char *keywd, - char *value, - int size) -{ - char token[1024] = {'\0'}; - int flag = 0; - - if (cnstr == NULL || value == NULL - || keywd == NULL || size < 1) - { - return NULL; - } - - if (cnlen == SQL_NTS) - { - cnlen = STRLEN (cnstr); - } - - if (cnlen <= 0) - { - return NULL; - } - - for (;;) - { - cnstr = readtoken (cnstr, token); - - if (*token == '\0') - { - break; - } - - if (STREQ (token, ";")) - { - flag = 0; - continue; - } - - switch (flag) - { - case 0: - if (upper_strneq (token, keywd, strlen (keywd))) - { - flag = 1; - } - break; - - case 1: - if (STREQ (token, "=")) - { - flag = 2; - } - break; - - case 2: - if (size < strlen (token) + 1) - { - return NULL; - } - - STRNCPY (value, token, size); - - return value; - - default: - break; - } - } - - return NULL; -} diff --git a/src/iodbc/prepare.c b/src/iodbc/prepare.c deleted file mode 100644 index 59aa4de13a..0000000000 --- a/src/iodbc/prepare.c +++ /dev/null @@ -1,525 +0,0 @@ -/* - * prepare.c - * - * $Id$ - * - * Prepare a query - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -#include - -RETCODE SQL_API -SQLPrepare ( - HSTMT hstmt, - UCHAR FAR * szSqlStr, - SDWORD cbSqlStr) -{ - STMT_t FAR *pstmt = (STMT_t *) hstmt; - - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode = SQL_SUCCESS; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - /* not on asyn state */ - switch (pstmt->state) - { - case en_stmt_fetched: - case en_stmt_xfetched: - sqlstat = en_24000; - break; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - default: - break; - } - } - else if (pstmt->asyn_on != en_Prepare) - { - /* asyn on other */ - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - if (szSqlStr == NULL) - { - PUSHSQLERR (pstmt->herr, en_S1009); - - return SQL_ERROR; - } - - if (cbSqlStr < 0 && cbSqlStr != SQL_NTS) - { - PUSHSQLERR (pstmt->herr, en_S1090); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_Prepare); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Prepare, - (pstmt->dhstmt, szSqlStr, cbSqlStr)) - - /* stmt state transition */ - if (pstmt->asyn_on == en_Prepare) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - return retcode; - - case SQL_STILL_EXECUTING: - default: - return retcode; - } - } - - switch (retcode) - { - case SQL_STILL_EXECUTING: - pstmt->asyn_on = en_Prepare; - break; - - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - pstmt->state = en_stmt_prepared; - pstmt->prep_state = 1; - break; - - case SQL_ERROR: - switch (pstmt->state) - { - case en_stmt_prepared: - case en_stmt_executed: - pstmt->state = en_stmt_allocated; - pstmt->prep_state = 0; - break; - - default: - break; - } - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLSetCursorName ( - HSTMT hstmt, - UCHAR FAR * szCursor, - SWORD cbCursor) -{ - STMT_t FAR *pstmt = (STMT_t *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - - RETCODE retcode = SQL_SUCCESS; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - if (szCursor == NULL) - { - PUSHSQLERR (pstmt->herr, en_S1009); - - return SQL_ERROR; - } - - if (cbCursor < 0 && cbCursor != SQL_NTS) - { - PUSHSQLERR (pstmt->herr, en_S1090); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on != en_NullProc) - { - sqlstat = en_S1010; - } - else - { - switch (pstmt->state) - { - case en_stmt_executed: - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - sqlstat = en_24000; - break; - - case en_stmt_needdata: - case en_stmt_mustput: - case en_stmt_canput: - sqlstat = en_S1010; - break; - - default: - break; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetCursorName); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetCursorName, - (pstmt->dhstmt, szCursor, cbCursor)) - - if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) - { - pstmt->cursor_state = en_stmt_cursor_named; - } - - return retcode; -} - - -RETCODE SQL_API -SQLBindParameter ( - HSTMT hstmt, - UWORD ipar, - SWORD fParamType, - SWORD fCType, - SWORD fSqlType, - UDWORD cbColDef, - SWORD ibScale, - PTR rgbValue, - SDWORD cbValueMax, - SDWORD FAR * pcbValue) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - - int sqlstat = en_00000; - RETCODE retcode = SQL_SUCCESS; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check param */ - if (fSqlType > SQL_TYPE_MAX || - (fSqlType < SQL_TYPE_MIN && fSqlType > SQL_TYPE_DRIVER_START)) - /* Note: SQL_TYPE_DRIVER_START is a nagtive number - * So, we use ">" */ - { - sqlstat = en_S1004; - } - else if (ipar < 1) - { - sqlstat = en_S1093; - } - else if ((rgbValue == NULL && pcbValue == NULL) - && fParamType != SQL_PARAM_OUTPUT) - { - sqlstat = en_S1009; - /* This means, I allow output to nowhere - * (i.e. * junk output result). But I can't - * allow input from nowhere. - */ - } -/********** - else if( cbValueMax < 0L && cbValueMax != SQL_SETPARAM_VALUE_MAX ) - { - sqlstat = en_S1090; - } -**********/ - else if (fParamType != SQL_PARAM_INPUT - && fParamType != SQL_PARAM_OUTPUT - && fParamType != SQL_PARAM_INPUT_OUTPUT) - { - sqlstat = en_S1105; - } - else - { - switch (fCType) - { - case SQL_C_DEFAULT: - case SQL_C_CHAR: - case SQL_C_BINARY: - case SQL_C_BIT: - case SQL_C_TINYINT: - case SQL_C_STINYINT: - case SQL_C_UTINYINT: - case SQL_C_SHORT: - case SQL_C_SSHORT: - case SQL_C_USHORT: - case SQL_C_LONG: - case SQL_C_SLONG: - case SQL_C_ULONG: - case SQL_C_FLOAT: - case SQL_C_DOUBLE: - case SQL_C_DATE: - case SQL_C_TIME: - case SQL_C_TIMESTAMP: - break; - - default: - sqlstat = en_S1003; - break; - } - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - retcode = SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_BindParameter); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_BindParameter, - (pstmt->dhstmt, ipar, fParamType, fCType, fSqlType, cbColDef, - ibScale, rgbValue, cbValueMax, pcbValue)) - - return retcode; -} - - -RETCODE SQL_API -SQLParamOptions ( - HSTMT hstmt, - UDWORD crow, - UDWORD FAR * pirow) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - if (crow == (UDWORD) 0UL) - { - PUSHSQLERR (pstmt->herr, en_S1107); - - return SQL_ERROR; - } - - if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ParamOptions); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ParamOptions, - (pstmt->dhstmt, crow, pirow)) - - return retcode; -} - - -RETCODE SQL_API -SQLSetScrollOptions ( - HSTMT hstmt, - UWORD fConcurrency, - SDWORD crowKeyset, - UWORD crowRowset) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - int sqlstat = en_00000; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - for (;;) - { - if (crowRowset == (UWORD) 0) - { - sqlstat = en_S1107; - break; - } - - if (crowKeyset > (SDWORD) 0L && crowKeyset < (SDWORD) crowRowset) - { - sqlstat = en_S1107; - break; - } - - if (crowKeyset < 1) - { - if (crowKeyset != SQL_SCROLL_FORWARD_ONLY - && crowKeyset != SQL_SCROLL_STATIC - && crowKeyset != SQL_SCROLL_KEYSET_DRIVEN - && crowKeyset != SQL_SCROLL_DYNAMIC) - { - sqlstat = en_S1107; - break; - } - } - - if (fConcurrency != SQL_CONCUR_READ_ONLY - && fConcurrency != SQL_CONCUR_LOCK - && fConcurrency != SQL_CONCUR_ROWVER - && fConcurrency != SQL_CONCUR_VALUES) - { - sqlstat = en_S1108; - break; - } - - if (pstmt->state != en_stmt_allocated) - { - sqlstat = en_S1010; - break; - } - - hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetScrollOptions); - - if (hproc == SQL_NULL_HPROC) - { - sqlstat = en_IM001; - break; - } - - sqlstat = en_00000; - if (1) /* turn off solaris warning message */ - break; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetScrollOptions, - (pstmt->dhstmt, fConcurrency, crowKeyset, crowRowset)) - - return retcode; -} - - -RETCODE SQL_API -SQLSetParam ( - HSTMT hstmt, - UWORD ipar, - SWORD fCType, - SWORD fSqlType, - UDWORD cbColDef, - SWORD ibScale, - PTR rgbValue, - SDWORD FAR * pcbValue) -{ - return SQLBindParameter (hstmt, - ipar, - (SWORD) SQL_PARAM_INPUT_OUTPUT, - fCType, - fSqlType, - cbColDef, - ibScale, - rgbValue, - SQL_SETPARAM_VALUE_MAX, - pcbValue); -} diff --git a/src/iodbc/result.c b/src/iodbc/result.c deleted file mode 100644 index 99dd7bf7f3..0000000000 --- a/src/iodbc/result.c +++ /dev/null @@ -1,523 +0,0 @@ -/* - * result.c - * - * $Id$ - * - * Prepare for getting query result - * - * The iODBC driver manager. - * - * Copyright (C) 1995 by Ke Jin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include "isql.h" -#include "isqlext.h" - -#include "dlproc.h" - -#include "herr.h" -#include "henv.h" -#include "hdbc.h" -#include "hstmt.h" - -#include "itrace.h" - -RETCODE SQL_API -SQLBindCol ( - HSTMT hstmt, - UWORD icol, - SWORD fCType, - PTR rgbValue, - SDWORD cbValueMax, - SDWORD FAR * pcbValue) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc = SQL_NULL_HPROC; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - switch (fCType) - { - case SQL_C_DEFAULT: - case SQL_C_CHAR: - case SQL_C_BINARY: - case SQL_C_BIT: - case SQL_C_TINYINT: - case SQL_C_STINYINT: - case SQL_C_UTINYINT: - case SQL_C_SHORT: - case SQL_C_SSHORT: - case SQL_C_USHORT: - case SQL_C_LONG: - case SQL_C_SLONG: - case SQL_C_ULONG: - case SQL_C_FLOAT: - case SQL_C_DOUBLE: - case SQL_C_DATE: - case SQL_C_TIME: - case SQL_C_TIMESTAMP: - break; - - default: - PUSHSQLERR (pstmt->herr, en_S1003); - return SQL_ERROR; - } - - if (cbValueMax < 0) - { - PUSHSQLERR (pstmt->herr, en_S1090); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->state > en_stmt_needdata || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - } - - /* call driver's function */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_BindCol); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_BindCol, - (pstmt->dhstmt, icol, fCType, rgbValue, cbValueMax, pcbValue)) - - return retcode; -} - - -RETCODE SQL_API -SQLGetCursorName ( - HSTMT hstmt, - UCHAR FAR * szCursor, - SWORD cbCursorMax, - SWORD FAR * pcbCursor) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check argument */ - if (cbCursorMax < (SWORD) 0) - { - PUSHSQLERR (pstmt->herr, en_S1090); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - if (pstmt->state < en_stmt_cursoropen - && pstmt->cursor_state == en_stmt_cursor_no) - { - PUSHSQLERR (pstmt->herr, en_S1015); - - return SQL_ERROR; - } - - /* call driver's function */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetCursorName); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_GetCursorName, - (pstmt->dhstmt, szCursor, cbCursorMax, pcbCursor)) - - return retcode; -} - - -RETCODE SQL_API -SQLRowCount ( - HSTMT hstmt, - SDWORD FAR * pcrow) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pstmt->state >= en_stmt_needdata - || pstmt->state <= en_stmt_prepared - || pstmt->asyn_on != en_NullProc) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_RowCount); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_RowCount, - (pstmt->dhstmt, pcrow)) - - return retcode; -} - - -RETCODE SQL_API -SQLNumResultCols ( - HSTMT hstmt, - SWORD FAR * pccol) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - SWORD ccol; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - if (pstmt->state == en_stmt_allocated - || pstmt->state >= en_stmt_needdata) - { - PUSHSQLERR (pstmt->herr, en_S1010); - return SQL_ERROR; - } - } - else if (pstmt->asyn_on != en_NumResultCols) - { - PUSHSQLERR (pstmt->herr, en_S1010); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_NumResultCols); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_NumResultCols, - (pstmt->dhstmt, &ccol)) - - /* state transition */ - if (pstmt->asyn_on == en_NumResultCols) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - - case SQL_STILL_EXECUTING: - default: - break; - } - } - - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - break; - - case SQL_STILL_EXECUTING: - ccol = 0; - pstmt->asyn_on = en_NumResultCols; - break; - - default: - ccol = 0; - break; - } - - if (pccol) - { - *pccol = ccol; - } - - return retcode; -} - - -RETCODE SQL_API -SQLDescribeCol ( - HSTMT hstmt, - UWORD icol, - UCHAR FAR * szColName, - SWORD cbColNameMax, - SWORD FAR * pcbColName, - SWORD FAR * pfSqlType, - UDWORD FAR * pcbColDef, - SWORD FAR * pibScale, - SWORD FAR * pfNullable) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT - || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check arguments */ - if (icol == 0) - { - sqlstat = en_S1002; - } - else if (cbColNameMax < 0) - { - sqlstat = en_S1090; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - if (pstmt->asyn_on == en_stmt_allocated - || pstmt->asyn_on >= en_stmt_needdata) - { - sqlstat = en_S1010; - } - } - else if (pstmt->asyn_on != en_DescribeCol) - { - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_DescribeCol); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_DescribeCol, - (pstmt->dhstmt, icol, szColName, cbColNameMax, pcbColName, - pfSqlType, pcbColDef, pibScale, pfNullable)) - - /* state transition */ - if (pstmt->asyn_on == en_DescribeCol) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_prepared: - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_DescribeCol; - } - break; - - default: - break; - } - - return retcode; -} - - -RETCODE SQL_API -SQLColAttributes ( - HSTMT hstmt, - UWORD icol, - UWORD fDescType, - PTR rgbDesc, - SWORD cbDescMax, - SWORD FAR * pcbDesc, - SDWORD FAR * pfDesc) -{ - STMT_t FAR *pstmt = (STMT_t FAR *) hstmt; - HPROC hproc; - RETCODE retcode; - int sqlstat = en_00000; - - if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC) - { - return SQL_INVALID_HANDLE; - } - - /* check arguments */ - if (icol == 0 && fDescType != SQL_COLUMN_COUNT) - { - sqlstat = en_S1002; - } - else if (cbDescMax < 0) - { - sqlstat = en_S1090; - } - else if ( /* fDescType < SQL_COLATT_OPT_MIN || *//* turnoff warning */ - (fDescType > SQL_COLATT_OPT_MAX - && fDescType < SQL_COLUMN_DRIVER_START)) - { - sqlstat = en_S1091; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* check state */ - if (pstmt->asyn_on == en_NullProc) - { - if (pstmt->asyn_on == en_stmt_allocated - || pstmt->asyn_on >= en_stmt_needdata) - { - sqlstat = en_S1010; - } - } - else if (pstmt->asyn_on != en_ColAttributes) - { - sqlstat = en_S1010; - } - - if (sqlstat != en_00000) - { - PUSHSQLERR (pstmt->herr, sqlstat); - - return SQL_ERROR; - } - - /* call driver */ - hproc = _iodbcdm_getproc (pstmt->hdbc, en_ColAttributes); - - if (hproc == SQL_NULL_HPROC) - { - PUSHSQLERR (pstmt->herr, en_IM001); - - return SQL_ERROR; - } - - CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ColAttributes, - (pstmt->dhstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc)) - - /* state transition */ - if (pstmt->asyn_on == en_ColAttributes) - { - switch (retcode) - { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - case SQL_ERROR: - pstmt->asyn_on = en_NullProc; - break; - - default: - return retcode; - } - } - - switch (pstmt->state) - { - case en_stmt_prepared: - case en_stmt_cursoropen: - case en_stmt_fetched: - case en_stmt_xfetched: - if (retcode == SQL_STILL_EXECUTING) - { - pstmt->asyn_on = en_ColAttributes; - } - break; - - default: - break; - } - - return retcode; -} diff --git a/src/iodbc/shrsub.exp b/src/iodbc/shrsub.exp deleted file mode 100644 index 1fe3ec7de9..0000000000 --- a/src/iodbc/shrsub.exp +++ /dev/null @@ -1,64 +0,0 @@ -SQLAllocEnv -SQLAllocConnect -SQLConnect -SQLDriverConnect -SQLBrowseConnect - -SQLDataSources -SQLDrivers -SQLGetInfo -SQLGetFunctions -SQLGetTypeInfo - -SQLSetConnectOption -SQLGetConnectOption -SQLSetStmtOption -SQLGetStmtOption - -SQLAllocStmt -SQLPrepare -SQLBindParameter -SQLParamOptions -SQLGetCursorName -SQLSetCursorName -SQLSetScrollOptions -SQLSetParam - -SQLExecute -SQLExecDirect -SQLNativeSql -SQLDescribeParam -SQLNumParams -SQLParamData -SQLPutData - -SQLRowCount -SQLNumResultCols -SQLDescribeCol -SQLColAttributes -SQLBindCol -SQLFetch -SQLExtendedFetch -SQLGetData -SQLSetPos -SQLMoreResults -SQLError - -SQLColumnPrivileges -SQLColumns -SQLForeignKeys -SQLPrimaryKeys -SQLProcedureColumns -SQLProcedures -SQLSpecialColumns -SQLStatistics -SQLTablePrivileges -SQLTables - -SQLFreeStmt -SQLCancel -SQLTransact - -SQLDisconnect -SQLFreeConnect -SQLFreeEnv