KBSODBCDriver - Support Home Page
Transcription
KBSODBCDriver - Support Home Page
KBSODBCDriver Table Of Contents KB_SQL ODBC Driver...................................................................................................... 1 What's New? ....................................................................................................................... 3 Understanding ODBC......................................................................................................... 7 Driver Installation and Setup .............................................................................................. 9 Server and Network Configuration................................................................................... 13 Server Info .................................................................................................................... 13 Network Configuration ................................................................................................. 15 TroubleShooting ........................................................................................................... 17 Starting the Server......................................................................................................... 19 Starting the Server..................................................................................................... 19 Stopping the Server....................................................................................................... 21 Stopping the Server................................................................................................... 21 Simulating ODBC with QUICK^SQL.............................................................................. 23 Managing ODBC Data Sources ........................................................................................ 25 Data Sources ................................................................................................................. 25 Tracing ODBC Calls..................................................................................................... 26 Tracing_on_the_Client ............................................................................................. 26 Tracing_on_the_Server............................................................................................. 28 Connection Pooling....................................................................................................... 30 Windows Applications...................................................................................................... 33 Programming Considerations............................................................................................ 35 ODBC API Calls........................................................................................................... 38 iii KBSODBCDriver M Programming ............................................................................................................ 41 ActiveX Data Objects (ADO)....................................................................................... 70 Appendixes ....................................................................................................................... 71 A - Escape Sequences ................................................................................................... 71 B - Connection Options ................................................................................................ 76 C - Error Messages........................................................................................................ 79 D - Info Types............................................................................................................... 84 E - Data Types .............................................................................................................. 91 Index ................................................................................................................................. 93 iv KB_SQL ODBC Driver KB_SQL ODBC Driver The KB_SQL ODBC Driver allows you to connect your M database to a world of applications. This document describes the ODBC solution in the context of the KB_SQL Server product provided by Knowledge Based Systems, Inc. For more information about ODBC, please see the Microsoft documentation available at www.microsoft.com/data For questions about KB_SQL, please see the documentation available at www.knowledgebasedsys.com To report a problem, or to get technical support, licensed users should have their database administrator contact KBS technical support at [email protected]. 1 What's New? Changes in this Release The KB_SQL ODBC Driver for KB_SQL Version 4 is a completely new and updated driver designed to work with the latest applications from Microsoft, including Microsoft Office97 and Office2000. ODBC SDK 3.51 Driver and server compatibility File data source names Silent configuration options Connection pooling Safe threads Multi-row fetch Custom network support Character set translation ODBC SDK 3.51 The version 4.0 KB_SQL ODBC driver has been updated to be compliant with Microsoft’s latest SDK for 32-bit ODBC Drivers. Numerous performance and flexibility improvements have been made to the driver. Connection pooling Connection pooling enables an application to use a connection from a pool of established connections. If a connection has already been created and placed in a pool, an application can use that connection without performing the entire connection process. Re-using connections from the pool can increase performance since applications can save the overhead involved in making a connection. This is especially significant for middle-tier applications that connect over a network or in a situation where the application repeatedly connects and disconnects (e.g. Internet applications). Enabling Connection Pooling Connection pooling can be used by an ODBC application if the application calls SQLSetEnvAttr with the SQL_ATTR_CONNECTION_POOLING attribute. In order to enable connection pooling with KB_SQL’s ODBC driver, it will be necessary to enable 3 KBSODBCDriver the feature and set the timeout value via the ODBC administrator. This timeout value determines the period of time which an inactive connection is removed from the pool. Driver and server compatibility We will continue to support older versions of the KB_SQL ODBC Driver that work in the ODBC version 2.x mode. This has been accomplished by physically separating the two versions of the Server API code, including the stored procedures for catalog functions. Please note that the older version of the stored procedures and SQL catalogue tables have been renamed. Version 2.x stored procedures and SQL catalogue tables all end with “A” (for example, SQL_SP_COLUMNSA). Please note that although older drivers can be used with the new server, using the older drivers will prohibit the use of new server features (for example, the LONG data type). In addition, because KBS will not be providing bug fixes for older releases, we strongly urge upgrading to the latest driver. Special Note About the 16-bit Driver Please note that no new development has been performed on the 16-bit ODBC driver. The 16-bit driver is currently in maintenance mode using Microsoft ODBC SDK 2.10. Although applications using the 16-bit ODBC driver will continue to work, they will not be able to take advantage of any new features. File data source names We now support the dynamic creation of file data source names from the ODBC Administrator and Microsoft Office applications. Previous versions of the product required that file data source names be created manually. File DSNs can be shared on network drives and can simplify workstation configuration. Silent configuration options The product now supports DSN-less connections. This feature provides the ability to connect to a remote data source without having to create a data source in the ODBC Administrator, thus simplifying application distribution. Safe threads For customers that are using, or are interested in using multi-threaded applications such as Microsoft Transaction Server, Internet Information Server, and Java, version 4.0 fully supports safe threads. KB_SQL version 4.0 fully supports safe threads so that applications can use the same handle on more than one thread. In a multi-threaded environment, it is possible for each thread to have independent data. However, it is also possible for multiple threads to share data. In this situation, the different threads must cooperate in accessing the data. Multi-row fetch 4 What's New? We now support SQLExtendedFetch and SQLFetchScroll. In ODBC 3.0, SQLFetchScroll has replaced SQLExtendedFetch. These calls allow an application to retrieve multiple records at one time thus reducing the number of calls between the application and the driver. Custom network support Version 4 separates the client, network, and setup API functions so that each can be developed independently. Because the components are separated, customers have the option to develop custom network interface modules based on their networking or security conventions. Contact KBS technical support for more information on how you could implement a custom network module. Character set translation Prior to this release, ANSI to OEM character translation was performed on the server side by specifying the translation rules in the site global. With version 4.0, character set translation is performed on the driver side. To implement the character set translation, it will be necessary to specify the appropriate translation DLL for the data source name via the ODBC Administrator. 5 Understanding ODBC What is ODBC? ODBC (Open Database Connectivity) is a standard interface developed by Microsoft for accessing data from different kinds of SQL database management systems. See www.microsoft.com/data for additional information. What does this mean to the M Community? • • • This means that you can use many of the Windows applications already on your desktop to get to your M data. With the KB_SQL Server together with the KB_SQL ODBC Driver, you can now use the Microsoft Office programs including Excel, Word, and Access or any ODBC-compliant Windows application to access your M data. You have many more choices for data access and reporting of your M application data. How does it work? The KB_SQL ODBC Architecture consists of six main components: • • • • • • your Windows application programs the ODBC Driver Manager the KB_SQL ODBC Driver networking software (TCP/IP) the KB_SQL Server Interface the KB_SQL Engine and relational data dictionary The KB_SQL ODBC Architecture • • • • Resident on your workstation, the client side, you need your Windows applications, the ODBC Driver Manager, the KB_SQL ODBC Driver, and the networking software. Your Windows applications can be any ODBC-compliant Windows application. They can be commercial off-the-shelf products like Microsoft’s Excel and Visual Basic or custom applications. Microsoft provides The ODBC Driver Manager component. Its primary function is to load the driver. If it is not resident on your system at the time you install the KB_SQL ODBC Driver, the setup program, on your installation disk, will install it for you. The KB_SQL ODBC Driver enables any ODBC-compliant Windows application to access data from your KB_SQL RDBMS. The driver must be accessible to each workstation that wants to use Windows applications to access the KB_SQL Server. You can install the driver on as many workstations as you like. Access to 7 KBSODBCDriver • • • your M data is limited only by your KB_SQL license, which determines the number of concurrent users. Networking software is necessary to communicate between the Driver and Server. The KB_SQL ODBC Driver requires TCP/IP networking software. On your server, you need to install KB_SQL Server and you need to have your M globals mapped as SQL tables into a SQL data dictionary. If you have any previous version of KB_SQL, this has already been done. The KB_SQL Server Interface encapsulates the Server API and Network Library M, and exposes the KB_SQL Engine to the client. Benefits of KB_SQL ODBC • • • • 8 You are free to select the application that is most appropriate for the task at hand. At any point in time, you can choose to use either the EZQ or SQL Editors that come packaged with KB_SQL, or you can select from many ODBC-compliant Windows applications. You can continue to access your M data from a terminal or choose a workstation that has access to a KB_SQL ODBC Driver. KB_SQL ODBC simplifies application development. You can write a single application that can be used to extract data from many different databases, permitting maximum interoperability and portability of the application. With KB_SQL ODBC, accessing M is like accessing any other RDBMS. Actually, the fact that you may be accessing different types of databases concurrently is transparent to you. Driver Installation and Setup Before you begin Before installing the KB_SQL ODBC Driver, there are a couple of items to note. • • • • Is the Server installed and configured? Do you know the Server configuration parameters for the Hostname (or IP address), and listening port? Can you ping the Server using the Hostname (or IP address)? If running WindowsNT, do you have Administrator privileges? Driver Installation Step 1: Launch the KB_SQL ODBC Driver Installer. Step 2: Accept the terms of the license agreement. After accepting the terms, the installer will update your system with the KB_SQL ODBC Driver and other ODBC Components. 9 KBSODBCDriver Create a Default Data Source The installer continues, allowing you to create a Data Source as part of the installation. Step 4: Give the Data Source a name and description. Step 5: Specify the Network parameters. 10 Driver Installation and Setup Step 6: Specify a Code Page Translator Step 7: Congratulations! 11 KBSODBCDriver 12 Server and Network Configuration Server Info ServerInfo Prefix for stored query routines Maximum number of stored queries Allow connections Trace API calls Edit network configuration Server initial execute Server user initial execute Prefix for stored query routines Assign a name to the holding place for the last x number of queries run. For example, if you enter XA, the Server API allocates routine names starting with XA1 up to the maximum number of stored queries specified. Maximum number of stored queries 13 KBSODBCDriver Enter the number of queries that you want held in the stored queries buffer on the server. The value you supply is a matter of storage space versus processor resources. Assigning a large number requires more storage capacity but less processing time. Conversely, assigning a smaller number requires less space to store queries, but causes more processing by the SQL engine. Here’s why: As the Server API receives each SQL command, it checks the stored queries buffer for the command’s corresponding M routine. If it finds the M routine, it simply runs it. If it doesn’t, it has to use the SQL engine to translate the command into one or more M routines. The M routine and corresponding SQL command are then stored and assigned a routine name using the base routine prefix. If you specify a large number, say 999, many commands can be processed before having to reuse a stored query for another command. When the maximum number has been reached, KB_SQL reuses the oldest stored query to store the next query’s M routine and corresponding SQL command. You may clear the stored queries buffer of all routine names by invoking the RL^SQL tag. Allow connections Answer YES to accept connections to the server. Answer NO if you want to refuse connections. Note that the server will not start if the system lock is set. (Refer to the UTILITIES\LOCK STATUS option.) If the server is running and you want to stop allowing connections, first invoke the STOP^SQL0SVR function. Then set this prompt to NO. Regardless of the setting of this prompt, the server can always be run in foreground— useful for testing purposes when you don’t want the server to be started in background. If the server is not running when you set this value to YES, you still have to start the server. It is not automatically started. To start the server, see the instructions for starting and stopping the KB_SQL Server later in this chapter. Trace API calls Answer YES if you want to track information about the dialog between the server and clients. This creates a log that you can view by using the SQL Editor to run the SQL_API_SERVER_TRACE query, or by using the tag VIEW^SQL0SVR. Edit network configuration Answer YES if you want to edit TCP/IP defaults or host information. The TCP/IP Defaults window will appear. A discussion of this process begins on the next page. Server initial execute 14 Server and Network Configuration Enter the M code that will instantiate any variables that are required by your application during the runtime execution of queries. Server user initial execute Enter the M code that will validate and/or establish the username (SQLUNAME) and password (SQLUAUTH) variables referenced during the connection to the server. Network Configuration NetworkInfo n general, the network information you are required to provide consists of the TCP/IP host and port information. Depending on your M implementation type, you might be required to provide alternate ports. TCP/IP Defaults TCP/IP Host Definition TCP/IP Port Defintion TCP/IP Defaults 15 KBSODBCDriver Timeout for read Enter the number of seconds after which a READ command should timeout and check error status (default = No timeout) commands Maximum length Enter the maximum size of an M string value in this implementation (default = 511). of M string Output buffer size Enter the output buffer size in bytes (default = 2048). Enter the input buffer size in bytes (default = 2048). Input buffer size TCP/IP Host Definition Host name Enter the TCP/IP hostname for the server. IP address Enter the internet protocol address for the server. If your system uses dynamic ip address allocation, enter the host name in this field. Description Enter a brief description of this server. Local host? Enter YES if you are describing the server on which KB_SQL is running. Enter NO if you are documenting another server. TCP/IP Port Definition 16 Server and Network Configuration Port number Port server? The port number is expected to be in the range of 5000-65535. Answer YES if this is the published port for connecting to this server. Answer NO if this is an alternate port to be used internally. TroubleShooting Network Troubleshooting Troubleshooting network connections can be challenging due to complex configurations. However, we've found that most of the errors related to KB_SQL have been incorrectly configured servers. It is easy to check the configuration of your server using our built-in testing tool, TEST^SQL0TCP. In general, we try to include useful information in error message displays. As for networking errors, we try to include the Windows Sockets (WinSock) error code as part of the message. If you see 10061 - Connection Refused, you probably need to check that your server is started. If you receive the error 10065 - No Route to Host, you might have specified a host address incorrectly. Using TEST^SQL0TCP VMS Cluster Issues Using TEST^SQL0TCP There are low-level TCP/IP testing tools available through KBS technical support. If you think you are having network trouble, please call us. 17 KBSODBCDriver Starting with KB_SQL v3.6, we provide a simple utility to test the configuration of your Server and Network. The TEST^SQL0TCP utility will attempt connections from your Server back to itself, and keep trying connections until it fails. For example: >D TEST^SQL0TCP KB_SQL Server Connect Test Server Name or Address: 127.0.0.1// Port Number : 6500// UserName : DBA PassWord : Connecting to 127.0.0.1 (6500) Error in connect: 0579: TCP/IP Timeout in Open As the error message implies, the attempt to connect has timed out. The most likely cause is that the server is not started. >D START^SQL0SVR >W $D(SQLERR) 0 This attempt to start the server is successful, as it does not return an error in the SQLERR variable. Now, try the connect test again. >D TEST^SQL0TCP KB_SQL Server Connect Test Server Name or Address: 127.0.0.1// Port Number : 6500// UserName : DBA PassWord : Connecting to 127.0.0.1 (6500) Connected to #1: |TCP|5~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #2: |TCP|6~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #3: |TCP|7~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #4: |TCP|8~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #5: |TCP|9~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #6: |TCP|10~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #7: |TCP|11~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Connected to #8: |TCP|12~127.0.0.1~6500 ... Connecting to 127.0.0.1 (6500) Error in connect: [S1000] (139): [Knowledge Based Systems, Inc.][Server API][V4.0]SQLConnect: Exceeded KB_SQL V4.0 license limit 18 Server and Network Configuration Disconnecting #8: |TCP|12~127.0.0.1~6500 ... Disconnecting #7: |TCP|11~127.0.0.1~6500 ... Disconnecting #6: |TCP|10~127.0.0.1~6500 ... Disconnecting #5: |TCP|9~127.0.0.1~6500 ... Disconnecting #4: |TCP|8~127.0.0.1~6500 ... Disconnecting #3: |TCP|7~127.0.0.1~6500 ... Disconnecting #2: |TCP|6~127.0.0.1~6500 ... Disconnecting #1: |TCP|5~127.0.0.1~6500 ... Notice that it gets 8 connections before it encounters an error. It shows that this attempt to connect is rejected because it would exceed the current limit of your license. This is the error that you want to get in this context. It ensures that everything is working. If you get other errors, it is helpful to pass on the information to our technical support. Currently, the most common problem with connecting is that the Server is not started. We recommend adding START^SQL to your system startup logic. The second most common problem is for those M types that require alternate ports (ISM, DSM, and others), that not enough are configured. We always recommend configuring at least as many ports as you have connections on your license. Configuring more doesn't hurt either. VMS Cluster issues On VMS clusters, it gets very tricky when starting an M process to “listen” for connections. The M database has a single definition of the local host. One or more nodes can access the database. Starting the “listener” from a node other than the one identified in the local host setting can have confusing consequences. One way of preventing this problem is to disable the auto startup feature using Site Edit. Another way is to add code to the Server StartUp Execute to test whether the current node matches the local host definition. If it doesn't, then the Server should not be allowed to start. Simply return an error in SQLERR. Starting the Server Starting the Server There are several methods available for starting the KB_SQL Server. You may start it either in the foreground for analysis and debugging purposes or in the background for a multi-user production environment. Foreground Options Background Options Foreground You may run the KB_SQL Server in foreground during configuration until you are satisfied that you are able to connect and process client requests. The following foreground options are available: 19 KBSODBCDriver 1. Output to Screen Command: >D ^SQL0SVR Description: This command is for general configuration, analysis and debugging. Sample Output: Waiting for client connection ... KBSGetInfoShort("1010","23") = (0,"2") KBSGetInfoShort("1010","24") = (0,"2") SQLAllocStmt("1010") = (0,"2007") SQLPrepare("2007","select * from employees") = (0,"1") SQLNumResultCols("2007") = (0,"4") SQLDescribeCol("2007","1") = (0,"EMP_SSN","12","11","0","0") SQLDescribeCol("2007","2") = (0,"NAME","12","15","0","0") SQLDescribeCol("2007","3") = (0,"SALARY","2","5","2","1") SQLDescribeCol("2007","4") = (0,"MANAGER","12","11","0","1") SQLExecute("2007") = (0) KBSRowsetFrame("2007","1","20480") = (100,"48","102-443545","JOHNSON","9","416-82-6316",... SQLFreeStmt("2007","0") = (0) SQLFreeStmt("2007","0") = (0) SQLDisconnect("1010") = (0) 2. Output to File Command: >D FILE^SQL0SVR("[FILE NAME]") Example: >D FILE^SQL0SVR("c:\temp\svrtrace.log") Description: This command is used to capture the output from a client/KB_SQL Server interaction for analysis, debugging, or submittal to KBS Technical Support. 3. Output to Printer Command: >OPEN %DEV USE %DEV DO ^SQL0SVR CLOSE %DEV Example: >O 3 U 3 D ^SQL0SVR C 3 Description: This command is used to capture output from a client/KB_SQL Server interaction for analysis, debugging, or submittal to KBSs Technical Support. 4. Without Error Trapping Command: DO NOTRAP^SQL0SVR Description: This option turns off KB_SQL error trapping. When a hard M error is 20 Server and Network Configuration encountered, the server will stop and the error will be displayed in the native format for your M implementation Note: The foreground server options are intended only for analysis or debugging purposes. As it allows only a single connection, it is not appropriate for a multi-user environment. Background If you have answered Yes to Allow Connections? in Site Edit/Server Info and your KB_SQL Server is properly configured, you may start the server simply by logging into KB_SQL as a DBA or System Manager. You may also type: >D START^SQL0SVR at the M prompt. This command line option allows you to start KB_SQL Server during the startup of your M system or other times without the requirement to log into KB_SQL. If, for some reason, the Server fails to start, the variable SQLERR may be trapped and be used to determine the reason for failure. Stopping the Server Stopping the Server You may need to stop the KB_SQL Server for various reasons (shutting down M, system maintenance, etc.) You may stop the KB_SQL Server with the following command: D STOP^SQL0SVR This command may be called from procedures such as Shutdown, etc. Note: It is important to understand that this command does not affect current connections to the KB_SQL Server. It does, however, prevent any new connections from being established. As some applications require multiple database connections for operation, it is best to ensure that everyone is logged off before stopping the KB_SQL Server. You may check current connection status by choosing Connections on the System Status menu. 21 Simulating ODBC with QUICK^SQL Using QUICK^SQL The Quick SQL Editor (QUICK^SQL) is a KB_SQL query interface that lets you use Windows Notepad to enter your SQL statements, save the statements as a text file, and execute the file from the QUICK utility. Queries executed from this interface take the same path as a query created from an ODBC application. Because of this you can use this editor to simulate queries from ODBC applications. The Quick SQL Editor is also a valuable tool for testing stored procedures and parameterized queries. >D QUICK^SQL Password: Enter SQL Command GO Execute command STOP Exit RESET Clear command CALL procedure() Call stored procedure @file Read commands from file -->SELECT NAME, PROJECT FROM PROJECTS -->GO NAME PROJECT GREEN PHARMACY ROBERTS LABORATORY ROBERTS MEDICAL RECORDS GREEN ACCOUNTING (4 rows) 23 Managing ODBC Data Sources Data Sources Data Source Types There are two types of data sources: machine data sources and file data sources. Although both contain similar information about the source of the data, they differ in the way this information is stored. Because of these differences, they are used in somewhat different manners. Data Description source User These are local to a computer, and can only be used by the current user. User DSN data sources are registered in the HKEY_CURRENT_USER registry subtree. System These are local to a computer, rather than dedicated to a user. The system, or DSN any user having privileges, can use a data source set up with a system data source. System DSNs are registered in the HKEY_LOCAL_MACHINE registry subtree. File These are file-based sources that can be shared between all users that have the DSN same drivers installed, and so have access to the database. These data sources need not be dedicated to a user or local to a computer. File data sources do not have a data source name, as user or system data sources do; they are identified by a file name with a DSN extension. User and system data sources are collectively known as machine data sources because they are local to a computer. Each of these data sources has a tab in the ODBC Administrator that is dedicated to that type. File DSN File data sources are stored in a file and allow connection information to be used repeatedly by a single user or shared among several users. When a File DSN is used, the Driver Manager makes the connection to the data source using the information in a .dsn file. This file can be manipulated like any other file. A File DSN does not have a data source name, as does a machine data source, and is not registered to any one user or machine. A File DSN streamlines the connection process, because the .dsn file contains the connection string that would otherwise have to be built for a call to the SQLDriverConnect function. Another advantage of the .dsn file is that it can be copied to any machine, so that identical data sources can be used by many machines as long as they have the appropriate driver installed. A File DSN can also be shared by applications. 25 KBSODBCDriver A shareable File DSN can be placed on a network and used simultaneously by multiple applications. A file DSN can also be unshareable. An unshareable .dsn file resides on a single machine and points to a machine data source. Unshareable File data sources exist mainly to allow the easy conversion of machine data sources to File DSN so that an application can be designed to work solely with File DSNs. When the Driver Manager is sent the information in an unshareable File DSN, it connects as necessary to the machine data source that the .dsn file points to. Example Here is an example of a File DSN for a KB_SQL connection. Note that the file is typically stored in the default path provided by Microsoft, but the file can be stored anywhere including on a networked drive. C:\Program Files\Common Files\ODBC\Data Sources\KBSQL.DSN [ODBC] DRIVER=KB_SQL ODBC 32-bit Driver UID=DBA SERVER=KB_SQL MaximumString=220 CommunicationBuffer=20 Network=C:\WINNT\System32\kbnet32.dll Setup=C:\WINNT\System32\kbset32.dll TCP_PORT=6500 HOST=192.9.90.36 Tracing ODBC Calls Tracing API Calls One of the best ways to understand what is going on when an application uses an ODBC connection to a remote data source is to trace the conversations. There are several conversations going on. The client-side-trace refers to the tracing of the conversation between the application and the ODBC Driver Manager. The server-side-trace refers to the tracing of the conversation between the KB_SQL ODBC Driver and the KB_SQL Server. In general, the server-side trace is the most useful to KBS support and is also the easiest to interpret. The client-side trace is a secondary source of information. It can be challenging to interpret -- let us help you. Tracing_on_the_Client Tracing on the Client The ODBC Driver Manager has a trace facility that allows the sequence of function calls made by an ODBC application to be recorded and transcribed into a log file. Tracing is 26 Managing ODBC Data Sources performed by a trace DLL that captures calls between the application and the Driver Manager, and the Driver Manager and the driver. This method of tracing replaces the tracing performed by the ODBC 2.x Driver Manager and the tracing performed in ODBC 2.x by ODBC Spy. Enabling tracing Certain situations call for examination of the conversational exchange between the application and the driver manager. This can be accomplished using the tracing option provided by Microsoft. Sample trace output The trace file can be large and its contents are not intuitive. However, these details are invaluable to KBS technical support representatives when trying to diagnose application 27 KBSODBCDriver behaviors. Tracing_on_the_Server Tracing on the Server In developing your own custom Windows applications for use with your KB_SQL database, you may find it necessary from time to time to view the interaction between your application and the KB_SQL Server. All communication between ODBC-compliant applications and KB_SQL occurs in sequences of function calls. These function calls may be recorded and reported on for both informative and debugging purposes. The following sections will describe the enabling of the API Trace feature and the viewing of the output of an API Trace session. Enabling the API Trace Feature Viewing the API Trace Interpreting the API Trace Enabling the API Trace Feature 1. Sign on to KB_SQL as DBA or System Administrator. 2. Choose SYSTEM STATUS. 28 Managing ODBC Data Sources 3. Choose SERVER INFO. 4. Choose TRACE OPTIONS. 5. Select ENABLE TRACING. Caution: The API Trace feature is intended for informative and debugging purposes only. It is not intended to be run in a production environment. If it is necessary to use the trace, we recommend turning it on right before you use it and turning it off immediately afterwards. Viewing the API Trace 1. 2. 3. 4. 5. Sign on to KB_SQL. Choose SYSTEM STATUS. Choose SERVER INFO. Choose TRACE OPTIONS. Select VIEW TRACE. 29 KBSODBCDriver Interpreting the API Trace Upon running the SQL_API_SERVER_TRACE query, you will see a screen describing the connection information for the most recent KB_SQL Server connection. Following this information is the sequence of function calls from the client application to the KB_SQL Server, ordered from earliest to last. There are a number of sources you may use in helping you to determine the functionality behind each of these function calls: • • • The online query SQL_API_LIST. This query lists all ODBC API functions supported by KB_SQL with a brief description of each. See ServerAPI functions for an overview of the KB_SQL ODBC Architecture as well as a detailed description of all currently supported function calls. The Microsoft ODBC 2.0 Programmer’s Reference and SDK Guide. This is the definitive work on the ODBC specification. KBS recommends this book to anyone involved in developing and deploying ODBC-compliant applications. Connection Pooling Connection pooling Connection pooling enables an application to use a connection from a pool of established connections. If a connection has already been created and placed in a pool, an application can use that connection without performing the entire connection process. Re-using 30 Managing ODBC Data Sources connections from the pool can increase performance since applications can save the overhead involved in making a connection. This is especially significant for middle-tier applications that connect over a network or in a situation where the application repeatedly connects and disconnects (e.g. Internet applications). Enabling Connection Pooling Connection pooling can be used by an ODBC application if the application calls SQLSetEnvAttr with the SQL_ATTR_CONNECTION_POOLING attribute. In order to enable connection pooling with KB_SQL’s ODBC driver, it will be necessary to enable the feature and set the timeout value via the ODBC administrator. This timeout value determines the period of time which an inactive connection is removed from the pool. 31 Windows Applications Overview of Windows Applications Using Windows Applications with KB_SQL is just as it is for using Windows applications with any other SQL Data Source. See the documentation for the specific Windows application for more information about working with SQL Data Sources. Microsoft Access Connecting Connecting from Microsoft Access to your M system is easy using the KB_SQL ODBC Driver. The connection will be attempted based on a decision made within Access, typically during the file linking process. You are able to use any of the connection types and you will be expected to log in with your KB_SQL username and password. Save password During the connection process, you will have the option of saving your username and password with the Access database information. This would allow you to reopen the database and reconnect to the server without having to reenter your username and password information. Note also that this capability can be disabled by correctly configuring the MsysConf table on the server. Contact KB Systems technical support for more information. Should I import or link a table? Microsoft Access provides two choices for using data from an external source: • • Import the M data into a new Microsoft Access table in the current database. Leave the data in the M database and use it in its current format without importing it -- this is called linking. If you know you will use your data only in Microsoft Access, you should import it. Microsoft Access generally works faster with its own tables, and if you need to, you can modify the imported table to meet your needs just like any other table created in Microsoft Access. One of the key considerations here is the volume of data and the security issues related to removing a copy from the server. These issues should be considered with your application vendor or information systems department representative. If the data you want to use is also being updated by a program other than Microsoft Access, you should link it. Using this approach, the current methods of updating, managing, and sharing the data can remain in place, and you can use Microsoft Access to work with the data as well. For example, you can create queries, forms, and reports that use the external data, combine external data with the data in Microsoft Access tables, and even view and edit the external data while others are using it in the original program. Recordsets: Dynasets and Snapshots 33 KBSODBCDriver Microsoft Access uses the JET (Joint Exchange Technology) Engine to manage database interactions. The JET Engine is a powerful query processor with many features, including the intelligence to perform distributed queries across multiple data sources. The results of queries run through JET are stored in record sets. These record sets can be of two types: Dynasets or Snapshots. For the most part, you will probably want snapshots as these are designed purely for retrieval and reporting purposes. If you are doing updates, dynasets will allow you to update rows on the remote data source. Data types Microsoft Access has its own set of data types. These types are mapped onto the ODBC types which are themselves mapped on to the data types supported on the data source. This can lead to confusion. The documentation for Microsoft Access is your best guide to understanding why the data appears different in an Access database than it does when you look at the same data on the server. Microsoft Query Connecting Connecting from Microsoft Query to your M system is easy using the KB_SQL ODBC Driver. As of Microsoft Office97, MSQuery was biased towards the use of file DSNs. This limitation is removed with Microsoft Office97 Service Pack #2. You are able to use any of the connection types and you will be expected to log in with your KB_SQL username and password. GetExternalData The option to use MSQuery from Excel and Word is dependent on your installation. The MSQuery component is not installed by default. If it is not available to you, check with your system administrator. Return Data to Excel Assuming you have the option installed for getting external data, the obvious next step is to return the data to Excel. The rules for saving the data, query, and password information are all controlled by the Microsoft applications. Please check with the application documentation if you have questions about how data is returned. Data types Microsoft Query has its own set of data types. These types are mapped onto the ODBC types which are also mapped to the data types supported on the data source. This can lead to confusion. The documentation for Microsoft Query, Excel, or Word is your best guide to understanding why the data appears different in a Microsoft Office application than it does when you look at the same data on the server. 34 Programming Considerations Architecture Accessing the KB_SQL Engine from Windows The KB_SQL Client API can be accessed as a dynamic link library (DLL) from Windows via C or Visual Basic. A Windows programming paradigm, the DLL allows one copy of a set of functions to be accessed by multiple applications. In Visual Basic, the Server API is accessed directly through the KB_SQL ODBC Driver. The ODBC Driver Manager is not involved. Again, TCP/IP provides your connection to the Server API. Expectations: • Experience with Windows programming, DLLs, Windows applications, and gateways Statement Execution The KB_SQL API supports two methods of statement execution: the direct method (using the SQLExecDirect function) and the prepare/execute method (using the SQLPrepare and SQLExecute functions). When an SQL statement is prepared it is sent to the server, parsed, and optimized. This is the ideal method for statements that are executed repeatedly, each time with different parameter values. An application should prepare a statement for execution if any of the following are true: • • The application will repeatedly execute the statement. The application needs information about the result set before executing the statement. An application can execute a statement directly if both are true: • • The application will execute the statement only once. The application does not need information about the result set before executing the statement Parameters An application can send parameters at statement execution time by calling the following functions: SQLBindParameter specifies the SQL data type of the parameters and reserves storage location for each parameter. SQLPutData sends data value for the parameter to the driver. 35 KBSODBCDriver Using data-at-execution parameters is useful for applications handling long data. See also Parameter_Markers Parameter Markers Parameter markers in a prepared SQL statement are placeholders for parameter values that are supplied by an application. Parameter markers are delimited by question marks. Using parameter markers in an SQL statement lets you execute the statement repeatedly with different values. This is a more efficient alternative to coding literal values in an application, and changing the application each time the parameters change. To use parameter markers, the application must first call the SQLBindParameter function to bind a storage area to a parameter marker. Then the application must place the parameter’s value in the storage location. Examples of using parameter markers are found in the Stored Procedures section of this chapter. See also Parameters Stored Procedures The KB_SQL Server API supports the use of stored procedures as a collection of precompiled SQL statements residing on the server. An application can call a procedure in place of an SQL statement. Stored procedures help to increase performance and consistency when performing repetitive tasks because they are compiled the first time they are executed. When executed again, subsequent run time is much shorter than for the equivalent set of stand-alone statements. Stored procedures simplify application development because you can repeatedly change them without modifying and compiling the application. Stored procedures can be created for permanent or temporary use. Temporary Stored Procedures KB_SQL creates a stored procedure for every set of SQL statements that are submitted from client applications. These procedures are available for use by all server queries for as long as the procedure is in the buffer of stored queries on the server. The query text is stored under a name like @SERVER_nnn, where nnn represents the number of the query relative to the number of stored queries allowed. IMPORTANT: DBA users can copy the definition of a server query into a new query, but server queries should not be modified in any way. Permanent Stored Procedures KB_SQL can make any stored procedure permanent so that it will always be available regardless of the size of the stored query buffer. This type of procedure is desirable for use within custom applications. It allows the application to be developed independently of the server-side SQL statements. Only the calling parameters and result set must stay constant. Otherwise, the stored procedure can be modified as needed without affecting the client application. Steps to create a permanent stored procedure 1. Create a query that returns a result set in the ODBC format. SET CLIENT=ODBC 36 Programming Considerations This parameter is automatically inserted into SQL statement buffers sent from client applications. Setting STORED_PROCEDURE implicitly sets the CLIENT type. 2. Indicate that the procedure is permanent. SET STORED_PROCEDURE=YES This makes the query take on the characteristics of a stored procedure until you remove the setting. This query will appear in the result set for the SQLProcedures function. 3. Give names to input parameters (optional). SET PARAMETERS='name,city,state' You can choose to specify names for parameter markers in any query. This acts as documentation, and is accessible in the result of the SQLProcedureColumns function. Note that setting PARAMETERS implicitly sets the CLIENT type and STORED_PROCEDURE indicators. Running a stored procedure Replace the SQL statements in your application with the ODBC escape clause syntax for calling a stored procedure. Syntax {call procedure-name[(parameter[,parameter...])]} Example Replace: Select Name, Position, Salary, Comments From Employees Where EmpDept = ? With: {call DeptEmps(?)} The ‘?’ represents a parameter marker, in this case used to receive the department identifier. Rules • • • • Users must have SELECT privileges on the stored procedure query. The stored procedure query must be compiled in order to show in SQLProcedures, SQLProcedureColumns, or to be executed. The server will require that the number of parameters in the reference must match the number in the procedure definition. Parameter values can be specified as all literals, or all parameter markers, but not a mix. For example: Legal {call xyzProc(?,?)} {call xyzProc('abc','123') Illegal {call xyzProc(?)} -- 2 parameters required {call xyzProc('abc',?)} -- Cannot mix types 37 KBSODBCDriver • If the parameters or the result set changes, you would have to respecify your application. Otherwise, changes can be made to the logic on the server side by editing and recompiling the query. Testing stored procedures You may test stored procedures by using the sample routine SQLJ13. This program will let you enter the ODBC syntax for calling the procedure. Example >{call xyzProc(?,?)} >go Use the Execute SQL option in MSQuery to invoke a stored procedure. Note that this interface does not have a mechanism for collecting input parameters, so you must supply the values as string literals. Example {call xyzProc('abc','123')} ODBC API Calls Functions KB_SQL API Function Summary Below are the KB_SQL API functions, grouped by type of task, including a brief description of the purpose of each function. For more information about the syntax and semantics of each function, consult the alphabetical reference section of this chapter. Task Function Name Purpose SQLAllocEnv Obtains an environment handle. Connecting to a data An environment handle can be used for source one or more connections. SQLAllocConnect Obtains a connection handle. A connection handle can be used for one or more statements. SQLConnect Connects to a specific driver by data source name, user ID, and password. SQLDriverConnect* Connects to a specific driver by connection string or invokes driver display connection dialog boxes. Obtaining information SQLGetInfo Returns information about a specific about a driver and data driver and data source. source SQLGetTypeInfo Returns information about supported 38 Programming Considerations Setting and retrieving driver options data types. SQLGetFunctions Returns supported driver functions. SQLSetConnectOption Sets a connection option. SQLGetConnectOption Returns the value of a connection option. SQLSetStmtOption Sets a statement option. SQLGetStmtOption Returns the value of a statement option. Preparing SQL requests Submitting requests KBSStatement Inserts partial SQL statements. SQLAllocStmt Allocates a statement handle. SQLPrepare Prepares an SQL statement for later execution. SQLBindParameter Assigns storage for a parameter in an SQL statement. SQLGetCursorName Returns the cursor name associated with a statement handle. SQLSetCursorName Specifies a cursor name. SQLDescribeParam Returns the description of a parameter marker associated with a prepared SQL statement. SQLExecute Executes a prepared statement. SQLExecDirect Executes a statement. SQLNativeSql Returns the SQL command text as translated by the server. SQLNumParams Returns the number of parameters in an SQL statement. SQLParamData* Used in conjunction with SQLPutData to supply parameter data at execution time. SQLPutData Send part or all of a data value for a parameter. Retrieving Results SQLRowCount and information about results SQLNumResultCols SQLDescribeCol SQLColAttributes SQLBindCol Returns the number of rows affected by an insert, update, or delete request. Returns the number of columns in the result set. Describes a column in the result set. Describes attributes of a column in the result set. Assigns storage for a result column and 39 KBSODBCDriver SQLFetch SQLGetData specifies the data type. Returns a result row. Returns a specific column value from a statement cursor. Returns additional error or status information. Retrieving Results SQLError and information about results (continued) Obtaining information SQLColumnPrivileges Returns a list of columns and associated about the data privileges for the specified table. source’s system tables (catalog functions) SQLColumns Returns a list of column names in specified tables. SQLForeignKeys Returns information about the foreign keys for a table. SQLPrimaryKeys Returns the list of column name(s) that comprise the primary key for a table. SQLProcedures Returns the list of procedure names stored in a specific data source. SQLSpecialColumns Returns information about the optimal set of columns that uniquely identifies a row in a specified table, or the columns that are automatically updated when any value in the row is updated by a transaction. SQLStatistics Returns statistics about a single table and the list of indexes associated with the table. SQLTablePrivileges Returns a list of tables and the privileges associated with each table. SQLTables Returns the list of table names stored in a specific data source. Terminating a SQLFreeStmt Ends statement processing and closes any statement associated cursors, discarding pending results, and optionally, frees all resources associated with the statement handle. SQLCancel Cancels an SQL statement. SQLTransact Commits or rolls back a transaction. SQLDisconnect Closes the connection. Terminating a connection SQLFreeConnect Releases the connection handle. SQLFreeEnv Releases the environment handle. 40 Programming Considerations For information on using the ODBC API functions from other programming languages, see the Microsoft ODBC Software Development Kit and Programmer's Reference. M Programming Overview_M_Programming KB_SQL API Function Reference The following pages describe each KB_ SQL API function in alphabetic order. Each function is defined as an M programming language function. Descriptions may include some or all of the following items: • • • • • • • • Arguments Returns Syntax Examples Notes Options Result set Related functions Add SQL access to your M routines. KB_SQL provides SQL access to M data. You can choose to leverage this power for reporting, data browsing, updating, or any combination. With the KB_SQL API functions, you can encapsulate your SQL references in your M programs. This combination allows you to leverage your M programming skills with a well-defined, controlled interface to the data using SQL. A Word about Variable Names. Variable names shown in the following functions are used for illustrative purposes only. KB_SQL reserves the letters “SQL” for use as the first three letters of our variable names. We suggest you use variable name conventions suitable to your operation. KBSStatement Inserts part of an SQL command into the SQL input buffer. Arguments Statement handle [SQLHSTMT] SQL command [SQLTEXT] Returns Return code [SQLCODE] Syntax SQLCODE=$$KS^SQLOS(SQLHSTMT,SQLTEXT) Example 41 KBSODBCDriver S SQLCODE=$$KS^SQLOS(SQLHSTMT, SQLTEXT) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • This function can be used to insert partial SQL commands to the SQL server. Its purpose is to support SQLPrepare. Splits should occur on a space or punctuation character. A special subroutine, SPLIT^SQLK4, may be invoked to automate this process For example, suppose X contains a long line (375 characters), thus exceeding the default limitation of 255 bytes M imposes on strings. X SELECT COL1, COL2, COL3, COL4, COL5, COL6, COL7, COL8, COL9, COL10, COL11, COL12, COL13, COL14, COL15, COL16, COL17, COL18, COL19, COL20, COL21, COL22, COL23, COL24, COL25, COL26, COL27, COL28, COL29, COL30, COL31, COL32, COL33, COL34, COL35, COL36, COL37, COL38, COL39, COL40 FROM TABLE WHERE COL1 = 100 AND (COL2 = 200) ORDER BY COL3 You can invoke the SPLIT^SQLK4 subroutine to decompose the line into smaller segments. It attempts to split first on a space boundary, followed by one of several punctuation characters. >D SPLIT^SQLK4 X(0) 7 X(1) SELECT COL1, COL2, COL3, COL4, COL5, COL6, COL7, X(2) COL8, COL9, COL10, COL11, COL12, COL13, COL14, X(3) COL15, COL16, COL17, COL18, COL19, COL20, COL21, X(4) COL22, COL23, COL24, COL25, COL26, COL27, COL28, X(5) COL29, COL30, COL31, COL32, COL33, COL34, COL35, X(6) COL36, COL37, COL38, COL39, COL40 FROM TABLE WHERE X(7) COL1 = 100 AND (COL2 = 200) ORDER BY COL3 Now, you simply call KBSStatement for each entry in X(n). When using this function, you must still invoke the SQLPrepare function. Typically, this invocation occurs in the last segment of the SQL command text. For example, assume X is very long. Below you see a sequence of typical statements from the subroutine’s point of entry through the call to SQLPrepare. >D SPLIT^SQLK4 >S N=X(0) Note: X(0) contains the count of elements. >F I=1:1:N-1 DO > . SQLCODE=$$KS^SQLOS(SQLHSTMT,X(I)) I SQLCODE'=0 G Error >S SQLCODE=$$P^SQLOS(SQLHSTMT,X(N)) Note: If you perform your own split logic, make sure you adhere to all of the rules observed by the SPLIT^SQLKI subroutine. SQLAllocConnect 42 Programming Considerations Allocates a connection handle. Arguments Environment handle [SQLHENV] Returns Return code [SQLCODE] Connection handle [SQLHDBC] Syntax SQLCODE=$$AC^SQLOS(SQLHENV,.SQLHDBC) Example S SQLCODE=$$AC^SQLOS(SQLHENV,.SQLHDBC) I SQLCODE'=0 D Error Q Notes • • • • This function requires a valid environment handle (SQLHENV). A valid connection handle (SQLHDBC) is returned by the function. You need a connection handle to store information about the connection. A connection can contain multiple statement handles. SQLAllocEnv Allocates an environment handle. Arguments None Returns Return code [SQLCODE] Environment handle [SQLHENV] Syntax SQLCODE=$$AE^SQLOS(.SQLHENV) Example S SQLCODE=$$AE^SQLOS(.SQLHENV) I SQLCODE'=0 D Error Q Notes • • • A valid environment handle (SQLHENV) is returned by the function. You need an environment handle to store information about the environment. An environment can contain multiple connection handles. SQLAllocStmt Allocates a statement handle. Arguments Connection handle [SQLHDBC] Returns Return code [SQLCODE] Statement handle [SQLHSTMT] Syntax SQLCODE=$$AS^SQLOS(SQLHDBC,.SQLHSTMT) Example 43 KBSODBCDriver S SQLCODE=$$AS^SQLOS(SQLHDBC,.SQLHSTMT) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • This function requires a valid connection handle (SQLHDBC). A valid statement handle (SQLHSTMT) is returned by the function. You need a statement handle to prepare and execute an SQL command. SQLBindCol Binds a select expression to a host variable. Arguments Statement handle [SQLHSTMT] Column sequence [SQLCOL] Column name [NAME] Returns Return code [SQLCODE] Syntax SQLCODE=$$BC^SQLOS(SQLHSTMT,SQLCOL,NAME) Example S SQLCODE=$$BC^SQLOS(SQLHSTMT,2,"CNAME") I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • This function cannot occur prior to statement preparation. The SQLFetch function places data into the host variable. If a column sequence is 0, all columns in the array are bound by the name parameter and sequenced by the actual column number. Consider $$BC^SQLOS(SQLHSTMT, 0, "XYZ"). Each fetch operation returns the local array XYZ populated with all columns from the result set. For example, SELECT NAME, SEX, DOB FROM PATIENT yields: XYZ(1) = name XYZ(2) = sex XYZ(3) = dob SQLBindParameter Declares the data type for a parameter. Arguments Statement handle [SQLHSTMT] Parameter sequence [SEQ] ODBC data type [TYPE] Returns Return code [SQLCODE] Syntax 44 Programming Considerations SQLCODE=$$BP^SQLOS(SQLHSTMT,SEQ,TYPE) Example S SQLCODE=$$BP^SQLOS(SQLHSTMT,1,1) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • This function is equivalent to the SQLSetParam function from ODBC V1.0. The data type is the numeric value of the ODBC data type. Run the on-line query SQL_API_DATATYPE to generate a list of supported data types. SQLCancel Cancels a statement. Arguments Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Syntax SQLCODE=$$CS^SQLOS(SQLHSTMT) Example S SQLCODE=$$CS^SQLOS(SQLHSTMT) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • This function is primarily useful when asynchronous processing is enabled. SQLColAttributes Returns information on a particular feature of a column. Arguments Statement handle [SQLHSTMT] Column sequence [SQLCOL] Descriptor type [SQLDESC] Returns Return code [SQLCODE] Descriptor value [VALUE] Syntax SQLCODE=$$CA^SQLOS(SQLHSTMT,SQLCOL,SQLDESC,.VALUE) Example S SQLCODE=$$CA^SQLOS(SQLHSTMT,3,1,.NAME) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • This function provides more information than SQLDescribeCol. See SQLColAttributes Descriptor SQL_COLUMN_COUNT Code 0 45 KBSODBCDriver SQL_COLUMN_NAME 1. SQL_COLUMN_TYPE 2. SQL_COLUMN_LENGTH 3. SQL_COLUMN_PRECISION 4. SQL_COLUMN_SCALE 5. SQL_COLUMN_DISPLAY_SIZE 6. SQL_COLUMN_UNSIGNED 8 SQL_COLUMN_MONEY 9 SQL_COLUMN_UPDATABLE 10 SQL_COLUMN_AUTO_INCREMENT 11 SQL_COLUMN_CASE_SENSITIVE 12 SQL_COLUMN_SEARCHABLE 13 SQL_COLUMN_TYPE_NAME 14 SQL_COLUMN_TABLE_NAME 15 SQL_COLUMN_OWNER_NAME 16 SQL_COLUMN_QUALIFIER_NAME 17 SQL_COLUMN_COLUMN_LABEL 18 SQLColumnPrivileges SQLColumnPrivileges returns a list of columns and associated privileges for the specified table. Note: This function is implemented but not yet supported. Arguments Statement handle [SQLHSTMT] TableQualifier [QUAL] TableOwner [OWNER] TableName [TABLE] ColumnName [COLUMN] Returns Return code [SQLCODE] Syntax S SQLCODE=$$CM^SQLOS(SQLHSTMT,QUAL,OWNER,TABLE,COLUMN) Notes 46 Programming Considerations • • The ColumnName argument accepts a search pattern. This function will return an empty result set until the product supports columnlevel privileges within the KB_SQL Engine. SQLColumns Returns the list of column names in specified tables. Arguments Statement handle [SQLHSTMT] Table qualifier [QUAL] Table owner [OWNER] Table name [TABLE] Column name [COLUMN] Returns Return code [SQLCODE] Syntax SQLCODE=$$CM^SQLOS(SQLHSTMT,QUAL,OWNER,TABLE,COLUMN) Example S SQLCODE=$$CM^SQLOS(SQLHSTMT,"","SQL_TEST","EMPLOYEES","%" ) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • SQLColumns does not return columns for an index table. Use the SQLStatistics function to return the columns of an index table. This function returns a result set (see the next page) that can be processed like any other query result. SQLConnect Connects to KB_SQL server. Arguments Data source name [SQLDATAS] User name [SQLUNAME] Authorization [SQLUAUTH] Returns Return code [SQLCODE] Connection handle [SQLHDBC] Syntax SQLCODE=$$C^SQLOS(SQLDATAS,SQLUNAME,SQLUAUTH,.SQLHDBC) Example S SQLCODE=$$C^SQLOS("M","DBA","SHARK",.SQLHDBC) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes 47 KBSODBCDriver • • • The data source name parameter is not currently validated by the Server API. If you are using the API for M, set the data source name parameter to "M". If you are using the API for C, the data source name parameter takes the value of the entry in the ODBC.INI configuration file. SQLDescribeCol Gets basic metadata on a column. Arguments Statement handle [SQLHSTMT] Column sequence [SQLCOL] Returns Return code [SQLCODE] Column name [NAME] ODBC data type [TYPE] Precision [PRECISION] Scale [SCALE] Nullable [NULLABLE] Syntax SQLCODE=$$DC^SQLOS(SQLHSTMT,SQLCOL,.NAME,.TYPE,.PREC,.SCALE ,.NULLABLE) Example S COL=3 S SQLCODE=$$DCSQLOS(SQLHSTMT,COL,.NAME,.TYPE,.PREC,.SCALE,.NUL LABLE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • The example uses the variable COL to get column data dictionary information for the third column in the result set. Note that COL is a number where 1 <= COL <= NumResultCols. This function is an easier form of the more complete SQLColAttributes function. SQLDescribeParam SQLDescribeParam returns the description of a parameter marker associated with a prepared SQL statement. Arguments Statement handle [SQLHSTMT] Parameter sequence [PARSEQ] SqlType [TYPE] Precision [PREC] Scale [SCALE] Nullable [NULLABLE] SQL_NO_NULLS(0) The parameter does not allow NULL values. (This is the default value). SQL_NULLABLE(1) 48 Programming Considerations The parameter allows NULL values. SQL_NULLABLE_UNKNOWN(2) The driver cannot determine if the parameter allows NULL values. Syntax S SQLCODE=$$DP^SQLOS(SQLHSTMT,PARSEQ,.TYPE,.PREC,.SCALE, .NULLABLE) SQLDisconnect Disconnects from KB_SQL Server. Arguments Connection handle [SQLHDBC] Returns Return code [SQLCODE] Syntax SQLCODE=$$D^SQLOS(SQLHDBC) Example DISCON S SQLCODE=$$D^SQLOS(SQLHDBC) I SQLCODE'=0 D Error Notes • • All connection statement handles are dropped. In the KB_SQL API for C, this function causes a network disconnect. SQLError Returns error information. Arguments Connection handle [SQLHDBC] Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Sqlstate [SQLSTATE] Native code [SQLNC] Native error text [SQLNT] Syntax SQLCODE=$$ER^SQLOS(SQLHDBC,SQLHSTMT,.SQLSTATE,.SQLNC,.SQLN T) Example ER ; SQLError 3. I SQLCODE=99!(SQLCODE=100) Q 49 KBSODBCDriver W !,"SQLCODE= ",SQLCODE,! N SQLCODE,K65,ERS,ERC,ERT I '$G(SQLHDBC) S SQLHDBC=0 I '$G(SQLHSTMT) S SQLHSTMT=0 4. S SQLCODE=$$ER^SQLOS(SQLHDBC,SQLHSTMT,.ERS,.ERC,.ERT) I SQLCODE<0 Q I SQLCODE=100 Q W "SQLSTATE= ",ERS I ERS="" G 5 S K65=$O(^SQL(65,-1,ERS,0)) W " ",^SQL(65,K65,2) 5. W !,"Error Code= ",ERC,!,"Error Text= ",ERT,! G 4 6. Q SQLExecDirect Prepares and executes an SQL command. Arguments Statement handle [SQLHSTMT] SQL command [SQLTEXT] Returns Return code [SQLCODE] Syntax SQLCODE=$$ED^SQLOS(SQLHSTMT,SQLTEXT) Example S SQLCODE=$$ED^SQLOS(SQLHSTMT,"SELECT * FROM SQL_TEST.EMPLOYEES") I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • This function can be used in place of SQLPrepare and SQLExecute. SQLExecute Executes a previously prepared SQL command. Arguments Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Syntax SQLCODE=$$E^SQLOS(SQLHSTMT) Example S SQLCODE=$$E^SQLOS(SQLHSTMT) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes 50 Programming Considerations • If your query includes parameters, the SQLExecute function can return "SQLCODE=99," which indicates that data needs to be provided for parameters. At this point, you would invoke SQLPutData until SQLCODE is not equal to 99. Refer to the illustration in the Error Processing section earlier in this chapter. SQLFetch Advances the cursor position for a statement. Arguments Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Syntax SQLCODE=$$F^SQLOS(SQLHSTMT) Example 1. S SQLCODE=$$F^SQLOS(SQLHSTMT) I SQLCODE'=0 D Error G:SQLCODE<0 Discon I SQLCODE=100 G 2 . . . G1 2. . Notes • This function automatically populates all bound columns for each row. SQLForeignKeys SQLForeignKeys can return: • • A list of foreign keys in the specified table (columns in the specified table that refer to primary keys in other tables). A list of foreign keys in other tables that refer to the primary key in the specified table. Arguments Statement handle [SQLHSTMT] PkTableQualifier [PKQUAL] PkTableOwner [PKOWNER] PkTableName [PKTABLE] 51 KBSODBCDriver FkTableQualifier [FKQUAL] FkTableOwner [FKOWNER] FkTableName [FKTABLE] Syntax S SQLCODE=$$FK^SQLOS(SQLHSTMT,PKQUAL,PKOWNER,PKTABLE, FKQUAL,FKOWNER,FKTABLE) Notes • If PkTableName contains a table name, SQLForeignKeys returns a result set containing the primary key of the specified table and all of the foreign keys that refer to it. The result set is ordered by PKTABLE_QUALIFIER, PKTABLE_OWNER, PKTABLE_NAME, and KEY_SEQ. Example: To obtain a list of foreign keys that refer to the PATIENT table. S SQLCODE=$$FK^SQLOS(SQLHSTMT,””,””,”PATIENT”,””,””,””) • If FkTableName contains a table name, SQLForeignKeys returns a result set containing all of the foreign keys in the specified table and the primary keys (in other tables) to which they refer. The result set is ordered by FKTABLE_QUALIFIER, FKTABLE_OWNER, FKTABLE_NAME, and KEY_SEQ. Example: To obtain a list of foreign keys stored in the PATIENT table. S SQLCODE=$$FK^SQLOS(SQLHSTMT,””,””,””,””,””,”PATIENT”) • If both PkTableName and FkTableName contain table names, SQLForeignKeys returns the foreign keys in the table specified in FkTableName that refer to the primary key of the table specified in PkTableName. Example: To obtain a list of the one foreign key that joins the PATIENT and VISIT tables. S SQLCODE=$$FK^SQLOS(SQLHSTMT,””,””,”PATIENT”,””,””,”VISIT”) Result Set Column Name Description PKTABLE_QUALIFIER Primary key table qualifier identifier. PKTABLE_OWNER Primary key table owner identifier. PKTABLE_NAME Primary key table identifier. PKCOLUMN_NAME Primary key column identifier. FKTABLE_QUALIFIER Foreign key table qualifier identifier. FKTABLE_OWNER Foreign key table owner identifier. FKTABLE_NAME Foreign key table identifier. FKCOLUMN_NAME Foreign key column identifier. KEY_SEQ Column sequence number in key (starting with 1). UPDATE_RULE Action to be applied to the foreign key on UPDATE. 52 Programming Considerations DELETE_RULE FK_NAME PK_NAME Related Functions Sample routine SQLJ16. SQLFreeConnect SQL_CASCADE SQL_RESTRICT SQL_SET_NULL NULL Action to be applied to the foreign key on DELETE. SQL_CASCADE SQL_RESTRICT SQL_SET_NULL NULL if not applicable Foreign key identifier. Primary key identifier. Frees the connection handle and all associated statement handles. Arguments Connection handle [SQLHDBC] Returns Return code [SQLCODE] Syntax SQLCODE=$$FC^SQLOS(SQLHDBC) Example S SQLCODE=$$FC^SQLOS(SQLHDBC) I SQLCODE'=0 D Error Q Note • This function effectively closes all active statements and drops the connection. SQLFreeEnv Frees the environment handle and all associated connection and statement handles. Arguments Environment handle [SQLHENV] Returns Return code [SQLCODE] Syntax SQLCODE=$$FE^SQLOS(SQLHENV) Example S SQLCODE=$$FE^SQLOS(SQLHENV) I SQLCODE'=0 D Error Q Notes 53 KBSODBCDriver • This function effectively closes all active statements and active connections and drops the environment. SQLFreeStmt Stops processing of a statement, closes any open cursors associated with that statement, and discards results. Arguments Statement handle [SQLHSTMT] Option [SQLTYPE] Returns Return code [SQLCODE] Syntax SQLCODE=$$FS^SQLOS(SQLHSTMT,SQLTYPE) Example S SQLCODE=$$FS^SQLOS(SQLHSTMT,1) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Options SQLFreeStmt Option Code SQL_CLOSE 0 SQL_DROP 1. SQL_UNBIND 2. SQL_RESET_PARAMS 3. SQLGetConnectOption Returns the current setting of a connection option. Arguments Connection handle [SQLHDBC] Option type [TYPE] Returns Return code [SQLCODE] Option value [VALUE] Syntax SQLCODE=$$GCO^SQLOS(SQLHDBC,TYPE,.VALUE) Example S OPTION=101 S SQLCODE=$$GCO^SQLOS(SQLHDBC,OPTION,.VALUE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • 54 The example uses the variable OPTION to get information about the SQL_ACCESS_MODE state for the connection referenced by the variable SQLHDBC. Programming Considerations • • See SQLSetConnectOption for a list of statement options for this function. Run SQL_API_CONNECT_OPTION to generate a list of connection options. SQLGetCursorName Returns the name of a cursor associated with a statement. Arguments Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Cursor name [NAME] Syntax SQLCODE=$$GCN^SQLOS(SQLHSTMT,.NAME) Example S SQLCODE=$$GCN^SQLOS(SQLHSTMT,.NAME) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • The only statements that use a cursor name are the positioned UPDATE and DELETE (for example, UPDATE table-name...WHERE CURRENT OF cursorname). If the application does not call SQLSetCursorName, the SQL engine allocates a default cursor name. This function returns the name of a cursor regardless of whether it was created explicitly or implicitly. SQLGetData Returns a specific column value from a statement cursor. Arguments Statement handle [SQLHSTMT] Column sequence [SQLCOL] Returns Return code [SQLCODE] Column value [VALUE] Syntax SQLCODE=$$GD^SQLOS(SQLHSTMT,SQLCOL,.VALUE) Example S SEQ=3 S SQLCODE=$$GD^SQLOS(SQLHSTMT,SEQ,.VALUE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • The example gets the value of the result set’s third column, (SEQ), for the statement referenced by the variable SQLHSTMT. Note that SEQ is a number where 1<= SEQ <= NumResultCols. See also SQLBindCol. We recommend SQLFetch for better performance. 55 KBSODBCDriver SQLGetInfo Returns general information about the driver and data source. Arguments Connection handle [SQLHDBC] Info type [TYPE] Returns Return code [SQLCODE] Info value [VALUE] Syntax SQLCODE=$$GI^SQLOS(SQLHDBC,TYPE,.VALUE) Example S SQLCODE=$$GI^SQLOS(SQLHDBC,TYPE,.VALUE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • • • • Run the on-line query, SQL_API_INFO_OPTION, to generate a list of the SQLGetInfo options and their respective codes. See sample routine SQLJ10 for an illustration of how to use SQLGetInfo. The ODBC specification reserves the range of 0-999 for information types. KBS reserves values greater than 1000 for data source specific information. A returned value is always a simple string of numbers or characters. A bitmask requires special handling. Two subroutines, UNMASK ^SQLK4 and MASK^SQLK4, are provided to assist in this process. For example, suppose you receive a BitMask value of 1431655765. The following code demonstrates the effect of the two subroutines: ; Convert Number to BitString S X=65535 D MASK^SQLK4 W X ; Returns "00000000000000001111111111111111" ; Convert BitString to Number S X="00000000000000001111111111111111" D UNMASK^SQLK4 W X ; Returns 65535 SQLGetStmtOption Returns the current settings of a statement option. Arguments Statement handle [SQLHSTMT] Statement option [OPTION] Returns Return code [SQLCODE] Option value [VALUE] 56 Programming Considerations Syntax SQLCODE=$$GSO^SQLOS(SQLHSTMT,OPTION,.VALUE) Example S TYPE=0 S SQLCODE=$$GSO^SQLOS(SQLHSTMT,TYPE,.VALUE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • The example uses the variable TYPE to get information about the statement option for the statement referenced by the variable SQLHSTMT. For a list of valid statement options, run the on-line query SQL_API_STATEMENT_OPTION or see the SQLSetStmtOption function. SQLGetTypeInfo Returns information on supported data types. Arguments Statement handle [SQLHSTMT] ODBC data type [TYPE] Returns Return code [SQLCODE] Syntax SQLCODE=$$GTI^SQLOS(SQLHSTMT,TYPE) Example S TYPE=-7 S SQLCODE=$$GTI^SQLOS(SQLHSTMT,TYPE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • • • The example produces a result set of information about the SQL_BIT(FLAG) data type. If the TYPE variable is zero (0), the result set contains information about all supported types. Otherwise, the result set is specific to the one type referenced by the TYPE variable. Run the on-line query, SQL_API_DATATYPE, to generate a list of supported data types. See sample routine SQLJ6 for a demonstration of SQLGetTypeInfo. SQLMoreResults SQLMoreResults determines whether there are more results available on an hstmt containing SELECT, UPDATE, INSERT, or DELETE statements and, if so, initializes processing for those results. Arguments Statement handle [SQLHSTMT] Syntax S SQLCODE=$$MR^SQLOS(SQLHSTMT) 57 KBSODBCDriver Notes • • • • • • UPDATE, INSERT, and DELETE statements return a count of affected rows. If any of these statements are batched, submitted with arrays of parameters, or in procedures, they can return multiple result sets or counts. If another result set or count is available, SQLMoreResults returns SQL_SUCCESS and initializes the result set or count for additional processing. After calling SQLMoreResults for SELECT statements, an application can call functions to determine the characteristics of the result set and to retrieve data from the result set. After calling SQLMoreResults for UPDATE, INSERT, or DELETE statements, an application can call SQLRowCount. If all results have been processed, SQLMoreResults returns SQL_NO_DATA_FOUND. Note that if there is a current result set with unfetched rows, SQLMoreResults discards that result set and makes the next result set or count available. If a batch of statements or a procedure mixes other SQL statements with SELECT, UPDATE, INSERT, and DELETE statements, these other statements do not affect SQLMoreResults. SQLNativeSql SQLNativeSql returns the SQL command text as translated by the server. Arguments Connection handle [SQLHDBC] LinesIn [IN] ArrayIn [XIN] LinesOut [OUT] ArrayOut [XOUT] Syntax S SQLCODE=$$NS^SQLOS(SQLHDBC,IN,XIN,.OUT,XOUT) Notes The SQLNativeSql function returns the SQL command text after it has been processed to handle ODBC escape clauses and string literal quoting. A summary of the conversions is listed below. {fn function(parmlist)} SQL_function(parmlist) {fn lower(Name)} => SQL_lower(Name) {d date-literal} date-literal {d '1996-07-15'} => '1996-07-15' {t time-literal} time-literal {t '22:30:15'} => '22:30:15' 58 Programming Considerations {ts timestamp-literal} timestamp-literal {ts '1996-07-15 22:30:15'} => '1996-07-15 22:30:15' {call procedure(parmlist)} call procedure(parmlist) {call DeptEmps(?)} => call DeptEmps(?) DoubleQuote in SingleQuoted Literal 'hello "there" world' => 'hello ""there"" world' SingleQuote in DoubleQuoted Literal "hello 'there' world" => "hello ''there'' world" SoftTag in Literal 'hello {*there} world' => ('hello '|chr(123,42)|'there} world') Related Functions Sample routine SQLJ21. Example Enter SQL Command (or 'GO' to execute) -->Select {fn lcase(name)}, {fn soundex(name)} -->From Employees -->Where {fn floor(salary)} > 10 -->go SQL Statement converted to native syntax Select SQL_fn_lcase(name), SQL_fn_soundex(name) From Employees Where SQL_fn_floor(salary) > 10 SQLNumParams SQLNumParams returns the number of parameters in an SQL statement. Arguments Statement handle [SQLHSTMT] numParams [NPM] Syntax S SQLCODE=$$NP^SQLOS(SQLHSTMT,.NPM) Notes • • SQLNumParams can be called only after SQLPrepare has been called. If the statement associated with hstmt does not contain parameters, SQLNumParams sets numParams to 0. Related Functions 59 KBSODBCDriver Sample routine SQLJ21. SQLDescribeParam API function. SQLNumResultCols Returns the number of columns in a table. Arguments Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Number of columns [COLS] Syntax SQLCODE=$$NRC^SQLOS(SQLHSTMT,.COLS) Example S SQLCODE=$$NRC^SQLOS(SQLHSTMT,.NRC) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • The example uses the NRC variable to return the number of result columns in the statement referenced by the SQLHSTMT variable. Note that the statement must be prepared prior to execution of this function, otherwise an error will result. SQLPrepare Prepares an SQL command for execution. Arguments Statement handle [SQLHSTMT] SQL command [SQLTEXT] Returns Return code [SQLCODE] Syntax SQLCODE=$$P^SQLOS(SQLHSTMT,SQLTEXT) Example S SQLCODE=$$P^SQLOS(SQLHSTMT,"SELECT * FROM SQL_TEST.EMPLOYEES") I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • If the SQL command is too long (greater than 255 bytes) to be prepared all at once, use KBSStatement. SQLPrimaryKeys SQLPrimaryKeys returns the column names that comprise the primary key for a table. Arguments Statement handle [SQLHSTMT] 60 Programming Considerations TableQualifier [QUAL] TableOwner [OWNER] TableName [TABLE] Syntax S SQLCODE=$$PK^SQLOS(SQLHSTMT,QUAL,OWNER,TABLE) Notes SQLPrimaryKeys returns the results as a standard result set, ordered by TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, and KEY_SEQ. SQLProcedureColumns SQLProcedureColumns returns the list of input and output parameters, as well as the columns that make up the result set for the specified procedures. Arguments Statement handle [SQLHSTMT] ProcQualifier [QUAL] ProcOwner [OWNER] ProcName [PROC] ColumnName [COLUMN] Syntax S SQLCODE=$$PC^SQLOS(SQLHSTMT,QUAL,OWNER,PROC,COLUMN) Notes • • • This function is typically used before statement execution to retrieve information about procedure parameters and columns from the system catalog. The procedure query must be compiled in order for the procedure to be recognized. The ProcOwner, ProcName, and ColumnName arguments accept wildcard search patterns. SQLProcedures SQLProcedures returns the list of procedure names stored in a specific data source. Procedure is a generic term used to describe an executable object, or a named entity that can be invoked using input and output parameters, and which can return result sets similar to the results returned by SQL SELECT expressions. Arguments Statement handle [SQLHSTMT] ProcQualifier [QUAL] ProcOwner [OWNER] ProcName [PROC] Syntax S SQLCODE=$$PR^SQLOS(SQLHSTMT,QUAL,OWNER,PROC) 61 KBSODBCDriver Notes • • • • SQLProcedures lists all procedures in the requested range. A user may or may not have permission to execute any of these procedures. To check accessibility, an application can call SQLGetInfo and check the SQL_ACCESSIBLE_PROCEDURES information value. Otherwise, the application must be able to handle a situation where the user selects a procedure which it cannot execute. The procedure query must be compiled in order for the procedure to be recognized. The ProcOwner and ProcName arguments accept wildcard search patterns. SQLPutData Specifies the execution time value for a parameter. Arguments Statement handle [SQLHSTMT] Parameter value [VALUE] Parameter sequence [SEQ] Returns Return code [SQLCODE] Syntax SQLCODE=$$PD^SQLOS(SQLHSTMT,VALUE,SEQ) Example S SQLCODE=$$PD^SQLOS(SQLHSTMT,"9.00",2) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • In the case of date, time, timestamp, and bit, the value parameter is in the external format used by ODBC. For example, a date parameter is specified as "1995-0428" as opposed to the internal format for M dates. Note that the SQL_BIT type is mapped to the KBS FLAG data type. SQLRowCount Returns the number of rows from a result set. Arguments Statement handle [SQLHSTMT] Returns Return code [SQLCODE] Number of rows [ROWS] Syntax SQLCODE=$$RC^SQLOS(SQLHSTMT,.ROWS) Example S SQLCODE=$$RC^SQLOS(SQLHSTMT,.ROWS) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes 62 Programming Considerations • • • This function is designed for use with INSERT, UPDATE, and DELETE queries. It returns the number of rows affected by the query. For a SELECT query, this function returns the current row number. SQLSetConnectOption Sets options that govern aspects of connections. Arguments Connection handle [SQLHDBC] Option type [TYPE] Option value [VALUE] Returns Return code [SQLCODE] Syntax SQLCODE=$$SCO^SQLOS(SQLHDBC,TYPE,VALUE) Example S TYPE=101,VALUE=1 S SQLCODE=$$SCO^SQLOS(SQLHDBC,TYPE,VALUE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • The example uses the variable TYPE to set the value SQL_ACCESS_MODE option to read only for the connection referenced by the variable SQLHDBC. Run the on-line query SQL_API_CONNECT_OPTION to generate a list of connection options. See the accompanying table on the next page for a list of this function’s statement options and their respective codes. Options SQLSetConnectOption Option Code SQL_ACCESS_MODE 101 SQL_AUTOCOMMIT 102 SQL_LOGIN_TIMEOUT 103 SQL_OPT_TRACE 104 SQL_OPT_TRACEFILE 105 SQL_TRANSLATE_DLL 106 SQL_TRANSLATE_OPTION 107 SQL_TXN_ISOLATION 108 SQL_CURRENT_QUALIFIER 109 SQL_ODBC_CURSORS 110 SQL_QUIET_MODE 111 SQL_PACKET_SIZE 112 SQL_CONNECT_OPT_DRVR_START 1000 63 KBSODBCDriver SQLSetCursorName Specifies the name of a cursor for a statement. Arguments Statement handle [SQLHSTMT] Cursor name [NAME] Returns Return code [SQLCODE] Syntax SQLCODE=$$SCN^SQLOS(SQLHSTMT,NAME) Example S SQLCODE=$$SCN^SQLOS(SQLHSTMT,NAME) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • • • All cursor names within the connection must be unique. The only statements that use a cursor name are the positioned UPDATE and DELETE (for example, UPDATE table-name...WHERE CURRENT OF cursorname). If the application does not call SQLSetCursorName, the SQL engine allocates a default cursor name. This function returns the name of a cursor regardless of whether it was created explicitly or implicitly. SQLSetStmtOption Sets options related to statement handle. Arguments Statement handle [SQLHSTMT] Statement option [OPTION] Option value [VALUE] Returns Return code [SQLCODE] Syntax SQLCODE=$$SSO^SQLOS(SQLHSTMT,OPTION,VALUE) Example S OPTION=0,VALUE=60 S SQLCODE=$$SSO^SQLOS(SQLHSTMT,OPTION,VALUE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • 64 The example uses the variable OPTION to set the SQL_QUERY_TIMEOUT value for the statement referenced by the variable SQLHSTMT. For a list of valid statement options, run the on-line query SQL_API_STATEMENT_OPTION or see the table on the next page. Programming Considerations Options SQLSetStmtOption Option Code SQL_QUERY_TIMEOUT 0 SQL_MAX_ROWS 1. SQL_NOSCAN 2. SQL_MAX_LENGTH 3. SQL_ASYNC_ENABLE 4. SQL_BIND_TYPE 5. SQL_CURSOR_TYPE 6. SQL_CONCURRENCY 7. SQL_KEYSET_SIZE 8. SQL_ROWSET_SIZE 9. SQL_SIMULATE_CURSOR 1. SQL_RETRIEVE_DATA 1. SQL_USE_BOOKMARKS 1. SQL_GET_BOOKMARK 1. SQL_ROW_NUMBER 1. SQLSpecialColumns Returns row identity and auto-updates columns. Arguments Statement handle [SQLHSTMT] Column type [COLTYPE] Table qualifier [QUAL] Table owner [OWNER] Table name [TABLE] Scope [SCOPE] Nullable [NULLABLE] Returns 65 KBSODBCDriver Return code [SQLCODE] Syntax SQLCODE=$$SC^SQLOS(SQLHSTMT,COLTYPE,QUAL,OWNER,TABLE,SCO PE,NULLABLE) Example S SQLCODE=$$SC^SQLOS(SQLHSTMT,1,"","SQL_TEST","CHARGES",0,0) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • This function returns the primary keys for the table. See the accompanying table on the next page for the result set. Result Set SQLSpecialColumns Column Col Seq SCOPE 1. COLUMN_NAME 2. DATA_TYPE 3. TYPE_NAME 4. PRECISION 5. LENGTH 6. SCALE 7. PSEUDO_COLUMN 8. SQLStatistics Returns the primary key for a base table and for an index table. Because the primary key is all the columns for an index table, you can use this function to get all the columns in an index table, but not all the columns in a base table. Arguments Statement handle [SQLHSTMT] Table qualifier [QUAL] Table owner [OWNER] Table name [TABLE] Unique [UNIQUE] Accuracy [ACCURACY] Returns Return code [SQLCODE] 66 Programming Considerations Syntax SQLCODE=$$SM^SQLOS(SQLHSTMT,QUAL,OWNER,TABLE,UNIQUE,ACC URACY) Example S SQLCODE=$$SM^SQLOS(SQLHSTMT,"","SQL_TEST","EMPLOYEES",1,1) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • See the accompanying table on the next page for the result set. Result Set SQLStatistics Column Col Seq TABLE_QUALIFIER 1. TABLE_OWNER 2. TABLE_NAME 3. NON_UNIQUE 4. INDEX_QUALIFIER 5. INDEX_NAME 6. TYPE 7. SEQ_IN_INDEX 8. COLUMN_NAME 9. COLLATION 1. CARDINALITY 1. PAGES 1. FILTER_CONDITION 1. SQLTablePrivileges SQLTablePrivileges returns a list of tables and the privileges associated with each table. Arguments Statement handle [SQLHSTMT] 67 KBSODBCDriver TableQualifier [QUAL] TableOwner [OWNER] TableName [TABLE] Notes • • • The TableOwner and TableName arguments accept search patterns. For the DBA, privileges will appear for all grantees. For non-DBA users, privileges will appear for your user group only. Result Set Column Name Description TABLE_QUALIFIER Table qualifier identifier. TABLE_OWNER Table owner identifier. TABLE_NAME Table identifier. GRANTOR User who granted the privilege. GRANTEE User to whom the privilege was granted. PRIVILEGE Identifies the table privilege. SELECT The grantee is permitted to retrieve data for one or more INSERT The grantee is permitted to insert new rows containing UPDATE The grantee is permitted to update the data in one or DELETE The grantee is permitted to delete rows of data from the REFERENCES The grantee is permitted to refer to one or more columns of the table within a constraint (for example, a unique, referential, or table check constraint). The scope of action permitted the grantee by a given table privilege is data source-dependent. For example, the UPDATE privilege might permit the grantee to update all columns in a table on one data source and only those columns for which the grantor has the UPDATE privilege on another data source. IS_GRANTABLE Indicates whether the grantee is permitted to grant the privilege to other users: YES, NO, or NULL if unknown. Related Functions Sample routine SQLJ20. SQLTables Returns list of table names stored in a specific data source. The list includes only those tables accessible by the user who is currently logged in via the SQLConnect function. To get the complete list of tables you must log in as the DBA. Arguments Statement handle [SQLHSTMT] Table Qualifier [QUAL] 68 Programming Considerations Table Owner [OWNER] Table Name [TABLE] Table Type [TYPE] Returns Return code [SQLCODE] Syntax SQLCODE=$$TM^SQLOS(SQLHSTMT,QUAL,OWNER,TABLE,TYPE) Example ;List all Owners (schemas) S SQLCODE=$$TM^SQLOS(HSTMT,"","%","","") ;List Types S SQLCODE=$$TM^SQLOS(HSTMT,"","","","%") ;List Views S SQLCODE=$$TM^SQLOS(HSTMT,"","","%","VIEW") ;List Tables S SQLCODE=$$TM^SQLOS(HSTMT,"","","%","TABLE") ;List System Tables S SQLCODE=$$TM^SQLOS(HSTMT,"","","%","SYSTEM TABLE") Notes • • The table qualifier (QUAL) argument is supported, but its value must be null. You may use the subroutine WCPD^SQLK4 to pad or insert wildcards into an SQL_IDENTIFIER. For example, assume the following SQL_IDENTIFIER is a valid table name. THIS_IS_MY_VALID_TABLENAME The WCPD subroutine may be called to insert the wildcard escape character as illustrated below. >w X THIS_IS_MY_VALID_TABLENAME >D WCPD^SQLK4 /* After conversion */ >W X THIS\_IS\_MY\_VALID\_TABLENAME The result set of the function appears below. Result Set SQLTables Column Col Seq TABLE_QUALIFIER 1. TABLE_OWNER 2. TABLE_NAME 3. TABLE_TYPE 4. 69 KBSODBCDriver REMARKS 5. SQLTransact Commits or rolls back pending transactions. Arguments Connection handle [SQLHDBC] Commit or rollback [SQLTTYPE] Returns Return code [SQLCODE] Syntax SQLCODE=$$T^SQLOS(SQLHDBC,SQLTTYPE) Example S TTYPE=1 SQLCODE=$$T^SQLOS(SQLHDBC,TTYPE) I SQLCODE'=0 D Error G:SQLCODE<0 Discon Notes • • The example attempts to rollback the transaction for the connection. TTYPE can be zero (0) for commit, or one (1) for rollback. Users are encouraged to use this API call instead of the SQL COMMIT and ROLLBACK commands to commit or rollback pending transactions. Options SQLTransact Option Code COMMIT 0 ROLLBACK 1. ActiveX Data Objects (ADO) Overview of ADO Programming Programming using ADO with KB_SQL is just as it is for using ADO with any other SQL Data Source. See www.microsoft.com/data for more information. 70 Appendixes A - Escape Sequences Extensions SQL Extensions KB_SQL API supports several ODBC SQL extensions: • • • • the representation of date and time literals the syntax for scalar functions LIKE predicate escape characters stored procedures These extensions provide essential functionality that is shared by most DBMSs. However, because the syntax required by the DBMSs varies, ODBC uses a syntactical notation called the escape clause. The escape clause consists of a pair of curly braces {} which surround the standard SQL syntax form and a token which specifies the type of clause. Date, Time, and TimeStamp Date, Time, and Timestamp Data KB_SQL API supports the DATE, TIME, and TIMESTAMP (a combined form of DATE and TIME) data types. The shorthand escape clause syntax for these data types is: {d 'value'} {d '1999-04-28'} April 28, 1999 {t 'value'} {t '10:30:00'} 10:30 AM {ts 'value'} {ts '1999-04-28 10:30:00'} April 28, 1999 at 10:30 AM Wildcards Wildcards (Search Pattern Escape Characters) ODBC supports wildcards using the underscore character (_) for single-character replacement and the percent sign (%) for multiple-character replacement. A word of caution is in order with respect to the use of wildcards, particularly in relation to the various catalog functions where the SQL_IDENTIFIER can include the underscore character. When you want to use a meta character as a literal and not as a wildcard, you must precede the meta character with the search pattern escape character (the default is the backward slash). 71 KBSODBCDriver For example, to obtain all columns for the LAB_PATIENT table where the underscore is a literal in the SQL_IDENTIFIER, you send the table name parameter as: LAB\_PATIENT Using the escape character prevents the engine from interpreting the underscore as a wildcard, thus avoiding retrieving columns for tables that could be named LABaTABLE, LABbTABLE, and so forth. Scalar functions Scalar Functions Scalar (or row) functions operate on a single value. They include functions that compute absolute value or length, format a date or time, or return a substring. The on-line query SQL_FUNCTION_LIST provides a complete list of the KB_SQL API scalar functions and their syntax. Function Description SQL_FN_ABS(numeric_exp) Returns absolute value SQL_FN_ASCII(string_exp) Returns the ASCII code value of the leftmost character SQL_FN_CEILING(numeric_exp) Returns smallest integer greater or equal to value SQL_FN_CHAR(code) Returns the character of the ASCII code SQL_FN_CONCAT(string_exp1, string_exp2) Concatenates two values using SQL rules SQL_FN_DAYNAME(date_exp) Returns day name SQL_FN_DAYOFMONTH(date_exp) Returns day of month based on date value SQL_FN_DAYOFWEEK(date_exp) Returns day of week (1=Sunday) SQL_FN_DAYOFYEAR(date_exp) Returns day of year SQL_FN_DIFFERENCE(string_exp1, string_exp2) Difference in Soundex codes SQL_FN_FLOOR(numeric_exp) Returns largest integer less than or equal to value SQL_FN_HOUR(time_exp) Returns hour for time value SQL_FN_IDENTIFIER(<value>) Formats an SQL_IDENTIFIER value SQL_FN_IFNULL(exp,value) Returns NULL or value SQL_FN_INITIAL_CAPS(Value) Format value using initial capitals SQL_FN_INSERT(string_exp1, start, length, string_exp2) Overwrite characters in 72 Appendixes string SQL_FN_LCASE(string_exp) Convert to lowercase SQL_FN_LEFT(string_exp, count) Returns the leftmost count of characters in string SQL_FN_LENGTH(string_exp) Number of characters in string less trailing blanks SQL_FN_LOCATE(exp1,exp2[,exp3]) Returns starting position of exp1 in exp2 SQL_FN_LTRIM(string_exp) Strip leading blanks SQL_FN_MINUTE(time_exp) Returns minute of hour SQL_FN_MOD(integer_exp1,integer_exp2) Returns remainder (modulus) of integer_exp1 divided by inte2 SQL_FN_MONTH(date_exp) Returns month based on date value SQL_FN_MONTHNAME(date_exp) Returns name of month SQL_FN_NEXT_MONTH_FIRST(<DateValue>) Returns the date value of next first of month SQL_FN_NEXT_MONTH_LAST Returns the date value of the next month end date SQL_FN_NEXT_WEEKDAY(<DateValue>) Returns the date value of the next weekday SQL_FN_NEXT_WEEKEND_DAY(<DateValue>) Returns date value of next weekend day SQL_FN_POWER(numeric_exp,integer_exp) Returns value raised to power SQL_FN_QUARTER(date_exp) Returns quarter (1-4) for date value SQL_FN_RAND(integer_exp) Returns random number using value as seed SQL_FN_REPEAT(string_exp, count) Repeat string n-times SQL_FN_REPLACE(string_exp1,string_exp2,string_exp3) Replace all occurrences of s2 in s1 with s3 SQL_FN_RIGHT(string_exp, count) Returns the rightmost count of characters from string SQL_FN_ROUND(numeric_exp,integer_exp) Returns value rounded to nplaces to right of decimal SQL_FN_RTRIM(string_exp) Returns the characters of string with w/o trailing blanks SQL_FN_SECOND(time_exp) Returns seconds for time 73 KBSODBCDriver SQL_FN_SIGN(numeric_exp) SQL_FN_SOUNDEX(string_exp) SQL_FN_SPACE(count) SQL_FN_SQRT(float_exp) SQL_FN_SUBSTRING(string_exp,start,length) SQL_FN_TIMESTAMPADD( interval, integer_exp,timestamp_exp) SQL_FN_TIMESTAMPDIFF( interval, timestamp_exp1,timestamp_exp2) SQL_FN_TIMESTAMPPART(<Part>,<TimeStamp>) SQL_FN_TRUNCATE(numeric_exp,integer_exp) SQL_FN_UCASE(string_exp) SQL_FN_WEEK(date_exp) SQL_FN_YEAR(date_exp) LIKE Predicate value Returns -1 (neg), 0 (zero), or 1 (positive) Returns site-determined value of string Returns string of n-spaces Returns the square root of value Returns sub-component of string value Add interval to timestamp Returns integer number of intervals between m1 and m2 Returns a specified part of a timestamp Truncates numeric value Converts all lowercase characters to uppercase Returns week of year based on date value Returns year of date value LIKE Predicate Escape Characters The support of the LIKE predicate escape clause allows for searches to include metacharacters. In a LIKE predicate, the underscore character (_) is used for singlecharacter replacement and the percent sign (%) is used for multiple-character replacement. The percent and underscore characters can be used as literals in a LIKE predicate by preceding them with an escape character. The escape clause for ODBC queries looks like: {escape ‘escape-character’} Example {escape ‘\’} Example Items aab aac aad aazz aa_123 aa_245 abc ade 74 Appendixes SQL without escape character select code from item_master where code like ‘aa_%’ Returns aab aac aad aazz aa_123 aa_245 SQL with escape character select code from item_master where code like ‘aa\_%’ Returns aa_123 aa_245 Notes • • • The default LIKE escape character is '\' (backslash). The escape character can be specified using the escape clause syntax: {escape '\'}. The SQL Editor supports the feature, but does not use the {} syntax. ODBC Example select code from item_master where code like ‘aa\_%’ {escape ‘\’} SQL Editor Example select code from item_master where code like ‘aa\_%’ escape ‘\’ Procedure Calls • • • • • • • • • The KB_SQL Server API supports the use of stored procedures as a collection of precompiled SQL statements residing on the server. An application can call a procedure in place of an SQL statement. KB_SQL supports temporary and permanent stored procedures. A temporary stored procedure is stored in the cache of recent SQL commands on the server. A permanent stored procedure is stored as a query definition on the server. Stored procedures can improve performance by eliminating query compilation at runtime. Permanent stored procedures can simplify application development, as most changes to procedures are isolated on the server. Procedures can return a result set (1 or more columns, 1 or more rows) Procedures can perform DML, DCL, and DDL operations, returning no result set. 75 KBSODBCDriver Outer Joins The KB_SQL Outer Join syntax is proprietary to KBS. For generic applications, use of this syntax would compromise the portability of the application. To avoid this limitation, generic applications use the ODBC escape clause to encapsulate the outer join syntax, allowing the specific driver to translate into a native syntax where necessary. This is exactly what KB_SQL does. ODBC uses escape sequences for outer joins. The syntax of this escape sequence is as follows: {oj outer-join} where outer-join is: table-reference {LEFT | RIGHT | FULL} OUTER JOIN {table-reference | outer-join} ON search-condition Note that any terms in {braces} indicate that only one of the terms would appear in a phrase. For example, an outer join would be characterized as one of LEFT, RIGHT, or FULL. Note also that the outer-join term can be included as part of the outer-join specification. Although the nesting of outer joins might be a desired feature, KB_SQL does not currently support this capability as of 10/18/2001. B - Connection Options Connection options The ODBC interface allows some flexibility in the ways in which a client application can achieve a connection to a server-based data source. The choice of option is sometimes left to the application such as the case of Microsoft Office products. Other situations give the developer the choice of connection strategy. These strategies are basically trading off of several considerations, including: • Control over appearance of dialogs in your application. If you are building a custom application, you will want to control the dialogs that are presented to your customers. At a minimum, his translates to using SQLConnect and NOT using SQLDriverConnect. • Whether or not you require a pre-configured data source to define the parameters of the connection. If you are building a custom application, you might want total control over the connection parameters. You can accomplish this by controlling the creation of the data source. You can also control this by putting the connection parameter value information in the application code and connecting without a pre-defined data source. See File Data Sources and DSN-less Connections. 76 Appendixes • When using a commercial application, your options are limited to the choices made by the developers. Sometimes this means that you are forced to create a certain type of connection and certain connection strategies are not available. When evaluating a new ODBC-enabled application, it is valuable to review the connection options that are supported. SQLConnect SQLConnect is the simplest connection function. It requires a data source name and accepts an optional user ID and password. It works well for applications that hard-code a data source name and do not require a user ID or password. It also works well for applications that want to control their own “look and feel,” or that have no user interface. Such applications can build a list of data sources using SQLDataSources; prompt the user for data source, user ID, and password; and then call SQLConnect. The SQLConnect function establishes connections to a driver and a data source. The connection handle references storage of all information about the connection to the data source, including status, transaction state, and error information. It requires the following: • • • A valid connection handle (hdbc). A valid KB_SQL username. A valid KB_SQL password. Connecting from a C program. /* Connect to data source */ rc = SQLConnect(hdbc, // hdbc is the connection handle (SQLCHAR*) "Sales", SQL_NTS, // Sales is the DataSourceName (SQLCHAR*) "DBA", SQL_NTS, // DBA is the username (SQLCHAR*) "SHARK", SQL_NTS); // SHARK is the password Connection from a M program. S rc=$$C^SQLOS("M", "DBA", "SHARK", hdbc) // M is the DataSourceName // DBA is the username // SHARK is the password // hdbc is the connection handle See SQLAllocConnect for information on connection handles. Note that the values of "Sales", "DBA", and "SHARK" are used for illustrative purposes only. SQLDriverConnect SQLDriverConnect is used to connect to a data source using a connection string. SQLDriverConnect is used instead of SQLConnect for the following reasons: 77 KBSODBCDriver • • • To let the application use driver-specific connection information. To request that the driver prompt the user for connection information. To connect without specifying a data source. SQLDriverConnect is an alternative to SQLConnect. It supports data sources that require more connection information than the three arguments in SQLConnect, dialog boxes to prompt the user for all connection information, and data sources that are not defined in the system information. SQLDriverConnect provides the following connection attributes: • • • • Establish a connection using a connection string that contains the data source name, one or more user IDs, one or more passwords, and other information required by the data source. Establish a connection using a partial connection string or no additional information; in this case, the Driver Manager and the driver can each prompt the user for connection information. Establish a connection to a data source that is not defined in the system information. If the application supplies a partial connection string, the driver can prompt the user for connection information. See DSN-Less Connections. Establish a connection to a data source using a connection string constructed from the information in a .dsn file. See File Data Sources. After a connection is established, SQLDriverConnect returns the completed connection string. The application can use this string for subsequent connection requests. For more information, see the Microsoft ODBC documentation. Note that the SQLDriverConnect function is not available in the M-based interface. For connections from M programs, use the SQLConnect function. DSN-less Connections If you are using ODBC 3.0 and a connection without DSN, or a file DSN, to connect to your server, you can set the additional connection properties supported by the driver. Connection Parameters UID=UserName PWD=PassWord Driver=KB_SQL ODBC 32-bit Driver Host=ServerAddress TCP_PORT=ServerListeningPort Connection Example // DsnLessConnect.cpp #include "stdafx.h" #include <windows.h> #include <sqlext.h> int main() { 78 Appendixes SQLHENV hEnv; SQLHDBC hDbc; SQLRETURN rc; SQLCHAR szConnStrOut[256]; SQLCHAR szConnStrIn[] = "DRIVER= KB_SQL ODBC 32-bit Driver;UID=DBA;PWD=SHARK;TCP_PORT=6500;HOST=192.9.90.36;"; SQLSMALLINT cbConnStrIn, cbConnStrOut, cbConnStrOutLen; SQLHWND hWnd = NULL; SQLSMALLINT fDriverCompletion = SQL_DRIVER_COMPLETE_REQUIRED; cbConnStrIn = cbConnStrOut = 256; rc = SQLAllocEnv(&hEnv); rc = SQLAllocConnect(hEnv, &hDbc); rc = SQLDriverConnect( hDbc, hWnd, szConnStrIn, SQL_NTS, szConnStrOut, cbConnStrOut, &cbConnStrOutLen, fDriverCompletion); if (rc != SQL_SUCCESS) { SQLCHAR szSQLState[10], szErrorMsg[128]; SQLSMALLINT cbErrorMsgMax = 128, pcbErrorMsg; SQLINTEGER pfNativeError; rc = SQLError(NULL, hDbc, NULL, szSQLState, &pfNativeError, szErrorMsg, cbErrorMsgMax, &pcbErrorMsg); } rc = SQLDisconnect(hDbc); rc = SQLFreeConnect(hDbc); rc = SQLFreeEnv(hEnv); return 0; } C - Error Messages Message Format When using the KB_SQL ODBC Driver, you may encounter errors and messages of one type or another. It is useful to understand the format of the messages so that you can determine the source of the error or warning. This information is also useful when reporting errors to KBS for technical support. Syntax All messages have the following format: SQLSTATE (native_error_code);[vendor_name] 79 KBSODBCDriver [module_name][version_number]API_function; error_message Description SQLSTATE codes are a standard naming scheme for errors SQLSTATE developed by the SQL Access Group (SAG). The returned native error code is mapped to the appropriate SQLSTATE code. If the native error code does not have a corresponding SQLSTATE code, the KB_SQL ODBC Driver returns SQLSTATE 37000 (Syntax error or access violation). Native_error_code The native error code number will be included for any error generated by the KB_SQL Server API. It corresponds to a KB_SQL specific error message. This is the vendor name of the provider of the module that reported Vendor_name the error. In the example below, it is KBS, the provider of the Server API. It could also be Microsoft, if the module was the ODBC Driver Manager. This is the module responsible for the error. In the example below, it Module_name is the KB_SQL Server API. Errors can also be tagged with KB_SQL ODBC Driver for errors generated by the driver. Version_number This is the version number of the module that reported the error. In the example below, it is version 3.6 This is the name of the API function that was last invoked. This API_function name will prefix the first error generated for a particular API function call. This is the native error text that corresponds to the native error code. Error_message In the example below, the test corresponds to the error code for #530. Example 28000 (530): [Knowledge Based Systems, Inc.][Server API][V3.6] SQLConnect: User name / password failure Note: For a complete list of all the possible errors and their descriptions, see one of the following queries: SQL_API_SQLSTATE or SQL_ERROR_LIST. SQLCODE Error processing typically handles the following values for SQLCODE. See also, the SQLError function. SQLCODE ODBC Value Description 0 SQL_SUCCESS Function completed successfully. -1 SQL_ERROR Function failed. -2 SQL_INVALID_HANDLE Network failure. SQL_SUCCESS_WITH_INFO Function completed successfully with a 1. nonfatal error. 99 SQL_NEED_DATA The application needs to send parameter 80 Appendixes 100 SQL_NO_DATA_FOUND data values. No data found (or End-of-Data) SQLSTATE Mappings The following table shows the SQLSTATE codes that can be generated with diagnostic messages from KB_SQL. See also, the SQLError function. SQLSTATE SQLCODE Description 21000 -1 Cardinality violation. 22000 -1 Data exception. 22001 -1 String data right truncation. 22003 -1 Numeric value out of range. 22005 -1 Error in assignment. 22008 -1 Datetime field overflow. 22012 -1 Division by zero. 22026 -1 String data, length mismatch. 23000 -1 Integrity constraint violation. 24000 -1 Invalid cursor state. 25000 -1 Invalid transaction state. 26000 -1 Invalid statement name. 27000 -1 Triggered data change violation. 28000 -1 Invalid authorization specification. 33000 -1 Invalid SQLDA name. 34000 -1 Invalid cursor name. 35000 -1 Invalid condition number. 37000 -1 Dynamic SQL syntax error or access violation. 40000 -1 Rollback. 40001 -1 Serialization failure. 42000 -1 Syntax error or access violation. 44000 -1 Check option violation. 70100 -1 Operation aborted. 00000 0 Success. 01000 Success with information 1. 01002 1. Disconnect error. 01004 1. Data truncated. 01006 1. Privilege not revoked. 1. S00 1. Invalid connection string attribute. 1. S01 1. Error in row. 81 KBSODBCDriver 1. S02 1. Option value changed. 1. S03 1. No rows updated or deleted. 1. S04 1. More than one row updated or deleted. 02000 100 07000 -1 07001 -1 07006 -1 08000 -1 08001 -1 08002 -1 08003 -1 08004 -1 08007 -1 08S01 -1 0A000 -1 21S01 -1 21S02 -1 2. A000 -1 No data found Dynamic SQL error. Wrong number of parameters. Restricted data type attribute violation. Connection error. Unable to connect to data source. Connection in use. Connection not open. Data source rejected establishment of connection. Connection failure during transaction. Communication link failure. Feature not supported. Insert value list does not match column list. Degree of derived table does not match column list. Direct SQL syntax or access error. 2B000 -1 2C000 -1 2D000 -1 3. C000 -1 Dependent privileges exist. Invalid character set name. Invalid transaction termination. Duplicate cursor name. 3D000 3F000 HZ000 IM001 IM002 IM003 IM004 IM005 IM006 IM007 IM008 IM009 IM010 IM011 IM012 Invalid catalog name. Invalid schema name. Remote Database Access condition. Driver does not support this function. Data source name not found and no default driver specified. Driver specified by data source name could not be loaded. Driver's SQLAllocEnv failed. Driver's SQLAllocConnect failed. Driver's SQLSetConnectOption failed. No data source specified; dialog prohibited. Dialog failed. Unable to load translation DLL. Data source name too long. Driver name too long. DRIVER keyword syntax error. 82 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 Appendixes IM013 S0001 S0002 S0011 S0012 S0021 S0022 S0023 S1000 S1001 S1002 S1003 S1004 S1008 S1009 S1010 S1011 S1012 S1015 S1090 S1091 S1092 S1093 S1094 S1095 S1096 S1097 S1098 S1099 S1100 S1101 S1102 S1103 S1104 S1105 S1106 S1107 S1108 S1109 S1110 S1111 S1C00 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 Trace file error. Base table or view already exists. Base table not found. Index already exists. Index not found. Column already exists. Column not found. No default for column. General error. Memory allocation failure. Invalid column number. Program type out of range. SQL data type out of range. Operation canceled. Invalid argument value. Function sequence error. Operation invalid at this time. Invalid transaction operation code specified. No cursor name available. Invalid string or buffer length. Descriptor type out of range. Option type out of range. Invalid parameter number. Invalid scale value. Function type out of range. Information type out of range. Column type out of range. Scope type out of range. Nullable type out of range. Uniqueness option type out of range. Accuracy option type out of range. Table type out of range. Direction option out of range. Invalid precision value. Invalid parameter type. Fetch type out of range. Row value out of range. Concurrency option out of range. Invalid cursor position. Invalid driver completion. Invalid bookmark value. Driver not capable. 83 KBSODBCDriver S1DE0 S1T00 -1 -1 No data at execution values pending. Timeout expired D - Info Types SQLGetInfo SQLGetInfo Return Values The following table lists the information types used by ODBC along with the responses from the KB_SQL Server. Note that items marked with an asterisk (*) are based on sitedefined names or values that could be different in your installation. This list can be reproduced using the GetInfoAll option of the ODBC Test utility that comes with the Microsoft ODBC SDK. InfoType Value SQL_ACCESSIBLE_PROCEDURES=20 SQL_ACCESSIBLE_TABLES=19 SQL_ACTIVE_CONNECTIONS=0 SQL_ACTIVE_ENVIRONMENTS=116 SQL_ACTIVE_STATEMENTS=1 SQL_ALTER_DOMAIN=117 SQL_ALTER_TABLE=86 SQL_ASYNC_MODE=10021 SQL_BATCH_ROW_COUNT=120 SQL_BATCH_SUPPORT=121 SQL_BOOKMARK_PERSISTENCE=82 SQL_CATALOG_LOCATION=114 SQL_CATALOG_NAME_SEPARATOR=41 SQL_CATALOG_NAME=10003 SQL_CATALOG_TERM=42 SQL_CATALOG_USAGE=92 SQL_COLLATION_SEQ=10004 SQL_COLUMN_ALIAS=87 SQL_CONCAT_NULL_BEHAVIOR=22 "Y" "Y" 254 254 65534 0x00000000 0x00000020 = SQL_AT_ADD_COLUMN SQL_AM_NONE = 0 0x00000002 = SQL_BRC_EXPLICIT 0x00000000 0x00000052 = SQL_BP_DELETE | SQL_BP_UPDATE SQL_CL_START = 1 "." "N" "Catalog" 0x00000000 "ISO8859-1" "Y" SQL_CB_NULL = 0 SQL_CONVERT_BIGINT=53 SQL_CONVERT_BINARY=54 0x00000000 0x00000000 84 Appendixes SQL_CONVERT_BIT=55 SQL_CONVERT_CHAR=56 SQL_CONVERT_DATE=57 SQL_CONVERT_DECIMAL=58 SQL_CONVERT_DOUBLE=59 SQL_CONVERT_FLOAT=60 SQL_CONVERT_FUNCTIONS=48 SQL_CONVERT_INTEGER=61 SQL_CONVERT_INTERVAL_DAY_TIME=123 SQL_CONVERT_INTERVAL_YEAR_MONTH=124 SQL_CONVERT_LONGVARBINARY=71 SQL_CONVERT_LONGVARCHAR=62 SQL_CONVERT_NUMERIC=63 SQL_CONVERT_REAL=64 SQL_CONVERT_SMALLINT=65 SQL_CONVERT_TIME=66 SQL_CONVERT_TIMESTAMP=67 SQL_CONVERT_TINYINT=68 SQL_CONVERT_VARBINARY=69 SQL_CONVERT_VARCHAR=70 SQL_CONVERT_WCHAR=122 SQL_CONVERT_WLONGVARCHAR=125 SQL_CONVERT_WVARCHAR=126 SQL_CORRELATION_NAME=74 SQL_CREATE_ASSERTION=127 SQL_CREATE_CHARACTER_SET=128 SQL_CREATE_COLLATION=129 SQL_CREATE_DOMAIN=130 SQL_CREATE_SCHEMA=131 SQL_CREATE_TABLE=132 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 SQL_CN_ANY = 2 0x00000000 0x00000000 0x00000000 0x00000000 1. x00000001 = SQL_CS_CREATE_ 1. x00000001 = SQL_CT_CREATE_ SQL_CREATE_TRANSLATION=133 SQL_CREATE_VIEW=134 0x00000000 1. x00000001 = SQL_CV_CREATE_ SQL_CURSOR_COMMIT_BEHAVIOR=23 SQL_CURSOR_ROLLBACK_BEHAVIOR=24 SQL_CURSOR_SENSITIVITY=10001 SQL_CB_PRESERVE = 2 SQL_CB_PRESERVE = 2 SQL_UNSPECIFIED = 0 85 KBSODBCDriver SQL_DATA_SOURCE_NAME=2 "KB_SQL" SQL_DATA_SOURCE_READ_ONLY=25 SQL_DATABASE_NAME=16 SQL_DATETIME_LITERALS=119 SQL_DBMS_NAME=17 "N" "" 0x00000007 = SQL_DL_SQL92_DATE | SQL_DL_SQL92_TIMESTAMP "KB_SQL" SQL_DBMS_VER=18 "04.00.mmdd" SQL_DEFAULT_TXN_ISOLATION=26 SQL_TXN_READ_UNCOMMITTED = 1 SQL_DESCRIBE_PARAMETER=10002 SQL_DM_VER=171 "N" "03.51.300213.0000" SQL_DRIVER_HDBC=3 26960. SQL_DRIVER_HDESC=135 1. x00000001 SQL_DRIVER_HENV=4 16960. SQL_DRIVER_HLIB=76 1. x00FC0000 SQL_DRIVER_HSTMT=5 26961. SQL_DRIVER_NAME=6 "kbodbc32.dll" SQL_DRIVER_ODBC_VER=77 "03.51" SQL_DRIVER_VER=7 "04.00.mmdd" SQL_DROP_ASSERTION=136 SQL_DROP_CHARACTER_SET=137 SQL_DROP_COLLATION=138 SQL_DROP_DOMAIN=139 SQL_DROP_SCHEMA=140 0x00000000 0x00000000 0x00000000 0x00000000 1. x00000001 = SQL_DS_DROP_SC SQL_DROP_TABLE=141 SQL_DROP_TRANSLATION=142 86 x01010000 x01000000 x01010001 1. x00000001 = SQL_DT_DROP_TA 0x00000000 Appendixes SQL_DROP_VIEW=143 1. x00000001 = SQL_DV_DROP_VI SQL_DYNAMIC_CURSOR_ATTRIBUTES1=144 SQL_DYNAMIC_CURSOR_ATTRIBUTES2=145 SQL_EXPRESSIONS_IN_ORDERBY=27 SQL_FETCH_DIRECTION=8 0x00000000 0x00000000 "Y" 1. x00000001 = SQL_FD_FETCH_N SQL_FILE_USAGE=84 SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1=146 SQL_FILE_NOT_SUPPORTED = 0 1. x00000001 = SQL_CA1_NEXT SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2=147 SQL_GETDATA_EXTENSIONS=81 SQL_GROUP_BY=88 SQL_IDENTIFIER_CASE=28 SQL_IDENTIFIER_QUOTE_CHAR=29 SQL_INDEX_KEYWORDS=148 SQL_INFO_SCHEMA_VIEWS=149 SQL_INTEGRITY=73 SQL_KEYSET_CURSOR_ATTRIBUTES1=150 SQL_KEYSET_CURSOR_ATTRIBUTES2=151 SQL_KEYWORDS=89 SQL_LIKE_ESCAPE_CLAUSE=113 SQL_LOCK_TYPES=78 0x00000000 0x0000000B = SQL_GD_ANY_COLUMN SQL_GD_BOUND SQL_GB_GROUP_BY_CONTAINS_SEL SQL_IC_UPPER = 1 "" 0x00000003 = SQL_IK_ASC | SQL_IK_D 0x00000000 "N" 0x00000000 0x00000000 "" "Y" 1. x00000001 = SQL_LCK_NO_CHA SQL_MAX_ASYNC_CONCURRENT_STATEMENTS=10022 SQL_MAX_BINARY_LITERAL_LEN=112 SQL_MAX_CATALOG_NAME_LEN=34 SQL_MAX_CHAR_LITERAL_LEN=108 SQL_MAX_COLUMN_NAME_LEN=30 SQL_MAX_COLUMNS_IN_GROUP_BY=97 SQL_MAX_COLUMNS_IN_INDEX=98 SQL_MAX_COLUMNS_IN_ORDER_BY=99 SQL_MAX_COLUMNS_IN_SELECT=100 SQL_MAX_COLUMNS_IN_TABLE=101 SQL_MAX_CONCURRENT_ACTIVITIES=1 SQL_MAX_CURSOR_NAME_LEN=31 SQL_MAX_DRIVER_CONNECTIONS=0 SQL_MAX_IDENTIFIER_LEN=10005 0 0 30 200 30 0 0 0 0 0 65534 30 254 30 87 KBSODBCDriver SQL_MAX_INDEX_SIZE=102 SQL_MAX_OWNER_NAME_LEN=32 SQL_MAX_PROCEDURE_NAME_LEN=33 SQL_MAX_QUALIFIER_NAME_LEN=34 SQL_MAX_ROW_SIZE_INCLUDES_LONG=103 SQL_MAX_ROW_SIZE=104 SQL_MAX_SCHEMA_NAME_LEN=32 SQL_MAX_STATEMENT_LEN=105 SQL_MAX_TABLE_NAME_LEN=35 SQL_MAX_TABLES_IN_SELECT=106 SQL_MAX_USER_NAME_LEN=107 SQL_MULT_RESULT_SETS=36 SQL_MULTIPLE_ACTIVE_TXN=37 SQL_NEED_LONG_DATA_LEN=111 SQL_NON_NULLABLE_COLUMNS=75 SQL_NULL_COLLATION=85 0 30 35 30 "N" 32767 30 0 30 0 30 "N" "Y" "N" SQL_NNC_NON_NULL = 1 SQL_NC_END = 4 SQL_NUMERIC_FUNCTIONS=49 0x00D35A21 = SQL_FN_NUM_ABS | SQ SQL_FN_NUM_FLOOR | SQL_FN_NUM SQL_FN_NUM_SQRT | SQL_FN_NUM_ SQL_FN_NUM_POWER | SQL_FN_NUM SQL_FN_NUM_TRUNCATE SQL_OAC_LEVEL1 = 1 SQL_OIC_CORE = 1 SQL_OSCC_COMPLIANT = 1 SQL_OSC_CORE = 1 "N" "03.51.0000" SQL_ODBC_API_CONFORMANCE=9 SQL_ODBC_INTERFACE_CONFORMANCE=152 SQL_ODBC_SAG_CLI_CONFORMANCE=12 SQL_ODBC_SQL_CONFORMANCE=15 SQL_ODBC_SQL_OPT_IEF=73 SQL_ODBC_VER=10 SQL_OJ_CAPABILITIES=115 SQL_ORDER_BY_COLUMNS_IN_SELECT=90 SQL_OUTER_JOINS=38 SQL_OWNER_TERM=39 SQL_OWNER_USAGE=91 SQL_PARAM_ARRAY_ROW_COUNTS=153 SQL_PARAM_ARRAY_SELECTS=154 SQL_POS_OPERATIONS=79 88 0x00000043 = SQL_OJ_LEFT | SQL_OJ_ SQL_OJ_ALL_COMPARISON_OPS "N" "P" "Schema" 0x0000001F = SQL_OU_DML_STATEM SQL_OU_PROCEDURE_INVOCATION | SQL_OU_INDEX_DEFINITION | SQL_ SQL_PARC_BATCH = 1 SQL_PAS_NO_BATCH = 2 0x00000000 Appendixes SQL_POSITIONED_STATEMENTS=80 SQL_SCROLL_CONCURRENCY=43 0x00000007 = SQL_PS_POSITIONED_D SQL_PS_POSITIONED_UPDATE | SQL_ "Procedure" "Y" SQL_CL_START = 1 "." "Catalog" 0x00000000 SQL_IC_SENSITIVE = 3 "N" "Schema" 0x0000001F = SQL_OU_DML_STATEM SQL_OU_PROCEDURE_INVOCATION SQL_OU_TABLE_DEFINITION | SQL_O SQL_OU_PRIVILEGE_DEFINITION 1. x00000001 = SQL_SCCO_READ_ SQL_SCROLL_OPTIONS=44 SQL_SEARCH_PATTERN_ESCAPE=14 0x00000011 = SQL_SO_FORWARD_ON "\" SQL_SERVER_NAME=13 "Server1" SQL_SPECIAL_CHARACTERS=94 SQL_SQL_CONFORMANCE=118 SQL_SQL92_DATETIME_FUNCTIONS=155 "" SQL_SC_SQL92_ENTRY = 1 0x00000007 = SQL_SDF_CURRENT_DA SQL_SDF_CURRENT_TIME | SQL_SDF 0x00000000 0x00000000 0x00000C70 = SQL_SG_WITH_GRANT_ SQL_SG_DELETE_TABLE | SQL_SG_IN SQL_SG_SELECT_TABLE | SQL_SG_U 0x00000000 0x00000E07 = SQL_SP_EXISTS | SQL_SP_ISNOTNUL SQL_SP_LIKE | SQL_SP_IN | SQL_SP_BETWEEN 0x00000140 = SQL_SRJO_LEFT_OUTER SQL_SRJO_RIGHT_OUTER_JOIN 0x00003190 = SQL_SR_GRANT_OPTIO SQL_SR_DELETE_TABLE | SQL_SR_IN SQL_SR_SELECT_TABLE | SQL_SR_U SQL_PROCEDURE_TERM=40 SQL_PROCEDURES=21 SQL_QUALIFIER_LOCATION=114 SQL_QUALIFIER_NAME_SEPARATOR=41 SQL_QUALIFIER_TERM=42 SQL_QUALIFIER_USAGE=92 SQL_QUOTED_IDENTIFIER_CASE=93 SQL_ROW_UPDATES=11 SQL_SCHEMA_TERM=39 SQL_SCHEMA_USAGE=91 SQL_SQL92_FOREIGN_KEY_DELETE_RULE=156 SQL_SQL92_FOREIGN_KEY_UPDATE_RULE=157 SQL_SQL92_GRANT=158 SQL_SQL92_NUMERIC_VALUE_FUNCTIONS=159 SQL_SQL92_PREDICATES=160 SQL_SQL92_RELATIONAL_JOIN_OPERATORS=161 SQL_SQL92_REVOKE=162 89 KBSODBCDriver SQL_SQL92_ROW_VALUE_CONSTRUCTOR=163 SQL_SQL92_STRING_FUNCTIONS=164 SQL_SQL92_VALUE_EXPRESSIONS=165 SQL_STANDARD_CLI_CONFORMANCE=166 0x00000003 = SQL_SRVC_VALUE_EXP 0x0000003E = SQL_SSF_LOWER | SQL_SSF_UPPER | SQL_SSF_TRANSLATE | SQL_SSF_TRI 0x00000005 = SQL_SVE_CASE | SQL_S 2. x00000002 = SQL_SCC_ISO92_C SQL_STATIC_CURSOR_ATTRIBUTES1=167 1. x00000001 = SQL_CA1_NEXT SQL_STATIC_CURSOR_ATTRIBUTES2=168 SQL_STATIC_SENSITIVITY=83 SQL_STRING_FUNCTIONS=50 0x00000000 0x00000000 0x0007FFFF = SQL_FN_STR_CONCAT SQL_FN_STR_LEFT | SQL_FN_STR_LT SQL_FN_STR_LOCATE | SQL_FN_STR SQL_FN_STR_REPEAT | SQL_FN_STR SQL_FN_STR_RIGHT | SQL_FN_STR_R SQL_FN_STR_SUBSTRING | SQL_FN_ SQL_FN_STR_ASCII | SQL_FN_STR_C SQL_FN_STR_DIFFERENCE | SQL_FN_ SQL_FN_STR_SOUNDEX | SQL_FN_ST 0x0000001F = SQL_SQ_COMPARISON SQL_SQ_IN | SQL_SQ_QUANTIFIED | SQL_SQ_CORRELATED_SUBQUERIES 0x00000007 = SQL_FN_SYS_USERNAM SQL_FN_SYS_IFNULL "Table" 0x000001FF = SQL_FN_TSI_FRAC_SEC SQL_FN_TSI_MINUTE | SQL_FN_TSI_H SQL_FN_TSI_WEEK | SQL_FN_TSI_MO SQL_FN_TSI_QUARTER | SQL_FN_TSI 0x000001FF = SQL_FN_TSI_FRAC_SEC SQL_FN_TSI_MINUTE | SQL_FN_TSI_H SQL_FN_TSI_WEEK | SQL_FN_TSI_MO SQL_FN_TSI_QUARTER | SQL_FN_TSI 0x0001FFFF = SQL_FN_TD_NOW | SQL SQL_FN_TD_DAYOFMONTH | SQL_FN SQL_FN_TD_DAYOFYEAR | SQL_FN_ SQL_FN_TD_QUARTER | SQL_FN_TD_ SQL_FN_TD_CURTIME | SQL_FN_TD_ | SQL_FN_TD_SECOND | SQL_FN_TD_ SQL_FN_TD_TIMESTAMPDIFF | SQL_ SQL_FN_TD_MONTHNAME SQL_TC_DML = 1 SQL_SUBQUERIES=95 SQL_SYSTEM_FUNCTIONS=51 SQL_TABLE_TERM=45 SQL_TIMEDATE_ADD_INTERVALS=109 SQL_TIMEDATE_DIFF_INTERVALS=110 SQL_TIMEDATE_FUNCTIONS=52 SQL_TXN_CAPABLE=46 90 Appendixes SQL_TXN_ISOLATION_OPTION=72 SQL_UNION=96 SQL_USER_NAME=47 0x00000007 = SQL_TXN_READ_UNCO SQL_TXN_READ_COMMITTED | SQL_ 0x00000000 "User2" SQL_XOPEN_CLI_YEAR=10000 "1995" E - Data Types Data Type Mapping The KB_SQL Server driver maps Server datatypes to ODBC SQL datatypes. The following table lists all Server datatypes and shows the ODBC SQL datatypes to which they are mapped. Note that multiple Server types can map to a single ODBC type, but each ODBC type maps to only one Server type. ServerTypeName ServerTypeID ODBCSqlType SqlTypeName CHARACTER 2 12 SQL_VARCHAR DATE 91 SQL_TYPE_DATE 5. FLAG ID 4 INTEGER MOMENT NUMERIC 3 8 7 1. -7 4 SQL_BIT SQL_INTEGER 4 93 SQL_INTEGER SQL_TYPE_TIMESTAMP SQL_NUMERIC 2. TEXT 9 -1 SQL_LONGVARCHAR TIME 6 92 SQL_TYPE_TIME It is valuable to recognize the type names and numbers in both contexts. Working with ServerAPI queries, either using the host-based interface or through ODBC queries, you will see the ODBC SQLType values going back and forth. Data Type Formats Information is exchanged between the client application and the ODBC Driver using data formats as defined in the C programming language. The exchange of data between the driver and server is primarily done using character string representations of the data, with conversions applied on either side as necessary. It is important to realize that certain data that might appear as numbers to us in M terms might not be a number at all in terms of a non-M application. For example, the DATE, TIME, and MOMENT types are exchanged between the server and driver as character strings in a particular format defined by ODBC. See the table 91 KBSODBCDriver below. These values are stored in the driver in a structure and provided to the application in an application-defined format. It is important to understand that the display formatting of the data is the responsible of the application. Consider also the FLAG data type. Using the SQL Editor, you might be used to thinking of FLAG types as YES/NO or TRUE/FALSE. In the exchange between the driver and server, these values are represented as 1 (true), 0 (false), or NULL if unknown. Depending on the application, you could see flag values displayed as -1, Yes/No, or almost any other format applicable to a binary choice. Character strings deserve special consideration as well. In C, a character string can be referenced using several strategies based on the storage of character strings as a array of character bytes. Some applications use a null-terminated-string approach, allowing character strings to be of arbitrary length as long as they are null-terminated. Other applications will use the defined length, as retrieved from SQLDescribeCol, to reference the value as a fixed-length string. This can lead to errors if the actual lengths of your data exceeds the defined length. In these cases, the driver is responsible to raise a warning message about the truncation of the data value. The handling of this warning message is application-dependent. There is a server-side utility, named SQLJ14, that can be used to find data values that exceed the defined length in the data dictionary. Contact KBS technical support if you need assistance with this important issue. For the most part, data of the TEXT type appears to the ODBC driver as a character string. It just happens to allow a larger maximum size. On the server side, the TEXT data is stored in a global array of subscripted segments of character strings. The only important point to realize is that the data has no inherent formatting. It is simply a stream of bytes. As with the other types, the application is in control of the formatting. See Data Type Mapping for information about how KB_SQL data types are mapped to the ODBC types. ServerTypeName Base Format ODBC Format CHARACTER "hello" "hello" DATE 57821 1999-04-23 FLAG 1. 1. ID 123 123 INTEGER 123 123 MOMENT 57821,34557 1999-04-23 09:36:57 NUMERIC 123.45 123.45 TEXT "abcde" "abcde" TIME 34557 09:36:57 It is valuable to recognize the data type values in both contexts. Working with ServerAPI queries, either using the host-based interface or through ODBC queries, you will see the ODBC format values going back and forth. 92 Index 3 API_function....................................... 80 32-bit ODBC Drivers .......................... 3 Architecture....................................... 35 A ArrayIn................................................ 58 AC^SQLOS ....................................... 42 ArrayOut ............................................. 58 Access ................... 4, 7, 8, 35, 41, 80, 81 AS^SQLOS......................................... 43 ACCURACY ...................................... 66 ASCII Administrator...................................... 9 Returns........................................... 72 AE^SQLOS......................................... 43 ASCII ................................................. 72 Allow connections.............................. 14 B AND.................................................... 41 Background ....................................... 22 ANSI BC^SQLOS......................................... 44 OEM ................................................. 5 ANSI ..................................................... 5 Before you begin.................................. 9 Benefits KB_SQL ODBC ........................... 8 API name............................................ 80 API Function Reference ................... 41 Benefits of KB_SQL ODBC................. 8 Bitmask API Function Summary ................... 38 receive ............................................. 56 API functions................... 38, 41, 59, 80 Bitmask ............................................... 56 API supports BitString DATE ............................................. 71 Convert Number.............................. 56 API supports.................................. 35, 71 BitString.............................................. 56 API supports...................................... 71 BP^SQLOS........................................ 44 93 KBSODBCDriver C Client .................................................. 35 C^SQLOS ........................................... 47 Client .................................................. 36 CA^SQLOS ........................................ 45 CM^SQLOS ................................ 46, 47 CARDINALITY ................................. 66 CNAME .............................................. 44 CHARACTER................................... 91 Code Page Translator Character set translation.................... 5 Characteristics Specify ............................................ 10 Code Page Translator ....................... 10 determine......................................... 57 COLTYPE........................................... 65 Characteristics................................... 36 COLUMN .............................. 46, 47, 61 Characteristics..................................... 57 COLUMN_NAME ....................... 65, 66 CHARGES.......................................... 65 ColumnName............................... 46, 61 Check COMMIT ............................................ 70 SQL_ACCESSIBLE_PROCEDUR ES................................................ 61 Congratulations................................. 10 Connection Check.................................................. 61 SQL_ACCESS_MODE state...... 54 Check .................................................. 67 Connection options............................ 76 Check .................................................. 81 Connection pooling ....................... 3, 31 Chr....................................................... 58 Connection string ........................ 38, 81 Client Convert BitString Engine ............................................... 7 Number ........................................... 56 sets .................................................. 36 Convert BitString ................................ 56 Tracing on...................................... 26 Convert Number Client..................................................... 7 BitString.......................................... 56 Client .................................................. 26 94 Index Convert Number.................................. 56 form ............................................ 71 Corresponding API supports.............................. 71 KB_SQL ......................................... 80 Date Time and TimeStamp .............. 71 SQLSTATE..................................... 80 Date value .......................................... 72 Corresponding..................................... 80 Datetime.............................................. 81 Create DateValue........................................... 72 Default Data Source.................. 10 DBA .................................. 36, 47, 67, 68 Data Source................................ 10 DBMSs ............................................... 71 Create a Default Data Source .......... 10 DC^SQLOS ........................................ 48 CS^SQLOS ......................................... 45 Default Data Source D Create ............................................. 10 D MASK^SQLK4............................... 56 Default Data Source.......................... 10 D SPLIT^SQLK4.............................. 41 DELETE ..................... 55, 57, 62, 64, 67 D UNMASK^SQLK4 ......................... 56 DeptEmps..................................... 36, 58 D WCPD^SQLK4 ............................. 68 Determine Data Source characteristics.................................. 57 Give............................................. 10 Determine............................. 3, 7, 31, 48 create .......................................... 10 Determine............................................ 57 Data Source Types ............................ 25 Determine............................................ 80 Data Type Formats.............................. 92 Direct SQL .......................................... 81 Data Type Mapping .......................... 91 DISCON S SQLCODE ..................... 49 DATA_TYPE ..................................... 65 DLL .......................................... 5, 35, 81 Date DoubleQuote ....................................... 58 95 KBSODBCDriver DoubleQuoted Literal ......................... 58 Error Code................................... 49, 80 DP^SQLOS......................................... 48 Error Processing.................................. 50 DRIVER.......................................... 7, 81 Error Text.................................... 49, 80 Driver Setup ...................................... 10 Escape-character............................... 74 DSNless................................................. 4 Excel DSN-less Connections ....................... 78 including........................................... 7 Dynamic SQL ..................................... 81 Return Data ................................... 34 Dynasets.............................................. 33 Excel ..................................................... 7 E Excel ..................................................... 7 E^SQLOS............................................ 50 Excel ................................................... 34 ED^SQLOS......................................... 50 Execute Edit network configuration.............. 14 Use .................................................. 36 Enabling the API Trace Feature ..... 29 Execute.......................................... 35, 36 Enabling tracing................................ 27 Execute ............................................... 36 End-of-Data ....................................... 80 Execute ............................................... 38 Engine Execute................................................ 43 client.............................................. 7 Execute................................................ 50 Engine allocates ............................ 55, 64 Execute................................................ 50 Equal Execute................................................ 58 99..................................................... 50 Execute ............................................... 61 Equal ................................................... 50 Extensions .......................................... 71 Equal .................................................. 72 EZQ....................................................... 8 ER^SQLOS ....................................... 49 96 Index F Form ................................................... 71 F^SQLOS .......................................... 51 FOUND .............................................. 80 FC^SQLOS........................................ 53 FS^SQLOS.......................................... 54 FE^SQLOS ......................................... 53 Function causes ................................. 49 File data source names........................ 4 Function requires ........................ 42, 43 File DSN ......................................... 4, 25 Functions.... 7, 35, 36, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 71, 72, 80, 81 FILTER_CONDITION....................... 66 FK^SQLOS......................................... 51 G FKOWNER......................................... 51 GCN^SQLOS...................................... 55 FKQUAL ............................................ 51 GCO^SQLOS...................................... 54 FKTABLE........................................... 51 GD^SQLOS ........................................ 55 FkTableName...................................... 51 GetExternalData ............................... 34 FkTableOwner .................................... 51 GI^SQLOS.......................................... 56 FkTableQualifier................................. 51 Give FLAG ............................................ 57, 91 Data Source.................................... 10 Fn ........................................................ 58 Give....................................................... 8 Fn function .......................................... 58 Give..................................................... 10 Fn lcase ............................................... 58 Give..................................................... 36 Fn soundex .......................................... 58 GRANTEE.......................................... 67 Foreground.......................................... 21 GRANTOR ......................................... 67 Form GSO^SQLOS .................................... 56 DATE ............................................. 71 GTI^SQLOS ....................................... 57 Form.............................................. 48, 71 97 KBSODBCDriver H Interpreting the API Trace .................. 30 HANDLE ........................................... 80 Invalid SQLDA................................... 81 Hostname ............................................. 9 IP........................................................... 9 Hour IS_GRANTABLE............................... 67 Returns minute.............................. 72 ISO8859-1 .......................................... 84 Hour ................................................... 72 J How does it work? ................................ 7 Java....................................................... 4 Hstmt....................................... 57, 59, 68 K Hstmt containing SELECT ................. 57 K65 ..................................................... 49 I KB Systems....................... 56, 62, 80, 81 IMPORTANT.................................... 36 KB_SQL Imported Tables .................................. 33 corresponds ................................. 80 IN ........................................................ 58 KB_SQL creates................................ 36 Including KB_SQL Engine ....................... 7, 35, 46 Excel ................................................. 7 Including .............................................. 7 KB_SQL ODBC Benefits ......................................... 8 INDEX_NAME .................................. 66 KB_SQL ODBC Driver INDEX_QUALIFIER ......................... 66 KB_SQL RDBMS ................................ 7 InfoType............................................. 84 KB_SQL reserves.............................. 41 INSERT................................... 57, 62, 67 KB_SQL Server ... 7, 36, 47, 49, 80, 84, 91 INTEGER .......................................... 91 KB_SQL Server API................... 36, 80 Internet Information Server .............. 4 KB_SQL Server API supports......... 36 Interoperability...................................... 8 KB_SQL Server Interface..................... 7 98 Index Kbodbc32.dll...................................... 84 Message Format .................................. 80 KBSStatement ................................... 41 Meta KEY_SEQ..................................... 51, 60 precede ........................................... 71 KS^SQLOS........................................ 41 Meta.................................................... 71 L Metacharacters.................................. 74 LENGTH............................................. 65 Metadata.............................................. 48 LIKE............................................. 71, 74 Microsoft.............. 3, 4, 7, 33, 34, 38, 80 LIKE Predicate ........................... 71, 74 Microsoft Access ................................ 33 LIKE Predicate Escape Characters 71, 74 Microsoft Office .............................. 4, 7 Microsoft provides The......................... 7 LinesIn ................................................ 58 Microsoft Query ................................ 34 LinesOut.............................................. 58 Microsoft Transaction Server............ 4 Linked Tables...................................... 33 Module_name - This ........................... 80 Listening Port ...................................... 9 MOMENT.......................................... 91 Literal................................ 36, 58, 71, 74 MR^SQLOS........................................ 57 M MSQuery............................................ 36 M 7, 8, 41, 47, 62 Multiple-character ...................... 71, 74 M Community Multi-row fetch.................................... 5 mean ................................................. 7 N M Community ..................................... 7 Name M globals .............................................. 7 API .................................................. 80 M programming ................................ 41 MASK^SQLK4................................... 56 Name.... 5, 10, 36, 38, 41, 44, 45, 47, 48, 51, 55, 58, 60, 61, 64, 65, 66, 67, 68, 71, 72 Maximum number of stored queries14 99 KBSODBCDriver Name ................................................... 80 nnn represents ............................... 36 Name ................................................... 81 Number ............................................ 5, 7 Name................................................... 84 Number .............................................. 36 Native_error_code............................... 80 Number .............................................. 38 Neg...................................................... 72 Number ............................................... 44 Network Number ............................................... 48 Specify ........................................ 10 Number ............................................... 55 Network Library M ............................... 7 Number ............................................... 56 Network TroubleShooting................ 18 Number .............................................. 59 NetworkInfo....................................... 15 Number .............................................. 60 NON_UNIQUE................................... 66 Number ............................................... 62 Non-DBA............................................ 67 Number .............................................. 72 NP^SQLOS........................................ 59 Number ............................................... 80 NPM ................................................... 59 Number ............................................... 81 NRC NUMERIC ......................................... 91 uses ................................................. 60 NumParams ....................................... 59 NRC.................................................... 60 NumResultCols ............................. 48, 55 NRC^SQLOS .................................... 60 O NS^SQLOS......................................... 58 ODBC .. 3, 4, 5, 7, 31, 35, 36, 38, 44, 48, 56, 57, 58, 62, 71, 74, 80, 91 NULL............................................ 48, 67 ODBC 3.0 ............................................. 5 Nullable................................... 48, 65, 81 ODBC Administrator ........... 3, 4, 5, 31 Number ODBC application......................... 3, 31 Convert BitString ............................ 56 ODBC Driver Manager............. 7, 35, 80 100 Index ODBC Example................................. 74 Parameter takes ................................... 47 ODBC SDK 3.51.................................. 3 Parameter.Example .......................... 36 ODBC Software Development Kit... 38 Parameters ODBC uses......................................... 71 setting ............................................. 36 ODBC V1.0 ........................................ 44 Parameters......................... 9, 10, 35, 36 ODBC Value ...................................... 80 Parameters......................................... 36 ODBC.INI........................................... 47 Parameters......................................... 38 ODBC-compliant Windows application ................................... 7, 8 Parameters........................................... 44 Parameters......................................... 44 ODBCSqlType................................... 91 Parameters........................................... 47 OEM Parameters........................................... 48 ANSI ................................................. 5 Parameters........................................... 50 OEM ..................................................... 5 Parameters........................................... 57 Open Database Connectivity.............. 7 Parameters......................................... 59 OPTION.................................. 54, 56, 64 Parameters......................................... 61 Overview of ADO Programming..... 70 Parameters......................................... 61 Overview of Windows Applications 33 Parameters........................................... 62 Overview_M_Programming ............ 41 Parameters......................................... 71 OWNER ... 46, 47, 60, 61, 65, 66, 67, 68 Parameters......................................... 80 Owners ............................................... 68 Parameters........................................... 81 P Parmlist ............................................... 58 P^SQLOS .................................... 41, 60 PARSEQ ............................................. 48 PAGES................................................ 66 Part Parameter Markers .................. 36, 38, 48 101 KBSODBCDriver timestamp....................................... 72 ProcName........................................... 61 Part ......................................... 10, 38, 41 ProcOwner......................................... 61 Part ..................................................... 72 ProcQualifier ..................................... 61 PC^SQLOS........................................ 61 Programmer's Reference.................. 38 PD^SQLOS......................................... 62 PSEUDO_COLUMN.......................... 65 PK^SQLOS......................................... 60 Q PKOWNER......................................... 51 QUAL ....... 46, 47, 60, 61, 65, 66, 67, 68 PKQUAL ............................................ 51 R PKTABLE........................................... 51 RC^SQLOS......................................... 62 PKTABLE_NAME............................. 51 RDBMS................................................. 8 PKTABLE_OWNER.......................... 51 Receive PKTABLE_QUALIFIER ................... 51 BitMask........................................... 56 PkTableName...................................... 51 Receive ............................................... 36 PkTableName contains ....................... 51 Receive................................................ 56 PkTableOwner .................................... 51 Recordsets ........................................... 33 PkTableQualifier................................. 51 Refer PR^SQLOS........................................ 61 PATIENT........................................ 51 PRECISION.................................. 48, 65 Refer.................................................... 50 Precompiled SQL .............................. 36 Refer.................................................... 51 Prefix for stored query routines ...... 13 Refer.................................................... 67 Prepare/execute ................................... 35 REFERENCES ................................... 67 PRIVILEGE........................................ 67 REMARKS ........................................ 68 Procedure Calls ................................. 75 Remote Database Access .................... 81 102 Index Respecify ............................................ 36 Results................................................. 66 Result Set . 35, 36, 38, 41, 44, 46, 47, 48, 51, 55, 57, 60, 61, 62, 65, 66, 67, 68 Results................................................. 67 Results ................................................ 68 Result set containing ........................... 51 Retrieving Results Results ............................................ 38 Retrieving....................................... 38 Retrieving........................................... 38 Results........................................... 35, 36 Return Data Results ................................................ 38 Excel ............................................... 34 Results ................................................ 41 Return Data ....................................... 34 Results................................................. 44 Return Values.............................. 72, 84 Results ................................................ 46 Returns Results ................................................ 47 ASCII ......................................... 72 Results................................................. 48 Returns minute Results................................................. 51 hour ................................................ 72 Results................................................. 54 Returns minute.................................. 72 Results................................................. 55 Returns NULL................................... 72 Results................................................. 57 Returns seconds................................. 72 Results................................................. 57 Returns site-determined value ......... 72 Results ................................................ 60 Returns SQL_NO_DATA_FOUND... 57 Results................................................. 60 Returns SQL_SUCCESS .................... 57 Results ................................................ 61 Returns starting ................................ 72 Results ................................................ 61 Returns string.................................... 72 Results................................................. 62 ROLLBACK ....................................... 70 Results................................................. 65 103 KBSODBCDriver ROLLBACK commands..................... 70 32-bit ODBC Drivers ...................... 3 ROWS ................................................. 62 SDK ...................................................... 3 Run Search Pattern Escape Characters.. 71 WindowsNT ..................................... 9 Run ....................................................... 9 SEQ_IN_INDEX ................................ 66 Server Run ..................................................... 36 Tracing on.................................. 28 Run ..................................................... 44 Server API........................... 7, 35, 47, 80 Run...................................................... 54 Server datatypes................................ 91 Run...................................................... 56 Server initial execute......................... 15 Run ..................................................... 56 Server queries.................................... 36 Run...................................................... 57 Server user initial execute ................ 15 Run...................................................... 63 SERVER_nnn.................................... 36 Run...................................................... 64 ServerInfo .......................................... 13 S ServerTypeID .................................... 91 Safe threads ......................................... 4 ServerTypeName............................... 91 SAG..................................................... 80 SET CLIENT..................................... 36 SC^SQLOS ......................................... 65 SET PARAMETERS ........................ 36 Scalar functions........................... 71, 72 SET STORED_PROCEDURE ........ 36 SCALE.......................................... 48, 65 Sets...................................................... 36 SCN^SQLOS..................................... 64 Setting SCO^SQLOS ...................................... 63 CLIENT ......................................... 36 SCOPE ................................................ 65 PARAMETERS............................. 36 SDK STORED_PROCEDURE............. 36 104 Index Setting................................................. 36 Specify ................................................ 47 Shows Specify ................................................ 51 SQLSTATE..................................... 81 Specify ................................................ 61 Shows.................................................. 36 Specify ................................................ 62 Shows.................................................. 81 Specify ................................................ 64 Shows.................................................. 91 Specify ................................................ 71 Silent configuration options ............... 4 Specify ................................................ 72 Single-character .......................... 71, 74 Specify ................................................ 74 SingleQuote......................................... 58 Specify ................................................ 81 SingleQuoted Literal........................... 58 SPLIT^SQLK4.................................. 41 SM^SQLOS ........................................ 66 SoftTag................................................ 58 SQL.. 7, 8, 35, 36, 38, 41, 43, 48, 49, 50, 55, 57, 58, 59, 60, 61, 64, 70, 71, 72, 74, 80, 81, 91 Soundex......................................... 58, 72 SQL Access Group ............................. 80 Source-dependent................................ 67 SQL commands ... 38, 41, 43, 50, 58, 60 Specify SQL COMMIT.................................... 70 Code Page Translator ................... 10 SQL Data Types .......................... 35, 81 Network.......................................... 10 SQL datatypes ................................... 91 Specify .................................................. 5 SQL Editor ...................................... 8, 74 Specify ................................................ 10 SQL Editor Example ........................ 74 Specify ................................................ 35 SQL Editor supports ........................ 74 Specify ................................................ 36 SQL SELECT.................................... 61 Specify ................................................ 38 SQL Statement 35, 36, 38, 48, 57, 58, 59 Specify ................................................ 46 SQL_ACCESS_MODE ................ 54, 63 105 KBSODBCDriver SQL_ACCESS_MODE state SQL_AT_ADD_COLUMN_SINGLE ......................................................... 84 connection ....................................... 54 SQL_ACCESS_MODE state.............. 54 SQL_ATTR_CONNECTION_POOLI NG............................................... 3, 31 SQL_ACCESSIBLE_PROCEDURES SQL_AUTOCOMMIT ....................... 63 check............................................... 61 SQL_BATCH_ROW_COUNT........ 84 SQL_ACCESSIBLE_PROCEDURES ......................................................... 61 SQL_BATCH_SUPPORT................ 84 SQL_BIND_TYPE ............................. 64 SQL_ACCESSIBLE_PROCEDURES ......................................................... 84 SQL_ACCESSIBLE_TABLES ....... 84 SQL_BIT................................. 57, 62, 91 SQL_BOOKMARK_PERSISTENCE ......................................................... 84 SQL_ACTIVE_CONNECTIONS ... 84 SQL_BP_DELETE ........................... 84 SQL_ACTIVE_ENVIRONMENTS 84 SQL_BP_SCROLL ........................... 84 SQL_ACTIVE_STATEMENTS...... 84 SQL_BP_UPDATE ........................... 84 SQL_ALTER_DOMAIN.................. 84 SQL_BRC_EXPLICIT..................... 84 SQL_ALTER_TABLE ..................... 84 SQL_CA1_NEXT.............................. 84 SQL_AM_NONE .............................. 84 SQL_CATALOG_LOCATION....... 84 SQL_API_CONNECT_OPTION ....... 63 SQL_CATALOG_NAME ................ 84 SQL_API_DATATYPE.............. 44, 57 SQL_API_INFO_OPTION................. 56 SQL_CATALOG_NAME_SEPARAT OR................................................... 84 SQL_API_SQLSTATE....................... 80 SQL_CATALOG_TERM ................ 84 SQL_API_STATEMENT_OPTION ................................................... 56, 64 SQL_CATALOG_USAGE............... 84 SQL_CB_NULL................................ 84 SQL_ASYNC_ENABLE.................... 64 SQL_CB_PRESERVE...................... 84 SQL_ASYNC_MODE ...................... 84 SQL_CL_START.............................. 84 106 Index SQL_CLOSE ...................................... 54 SQL_CONVERT_LONGVARCHAR ......................................................... 84 SQL_CN_ANY .................................. 84 SQL_CONVERT_NUMERIC ......... 84 SQL_COLLATION_SEQ ................ 84 SQL_CONVERT_REAL ................. 84 SQL_COLUMN_ALIAS .................. 84 SQL_CONVERT_SMALLINT ....... 84 SQL_CONCAT_NULL_BEHAVIOR ......................................................... 84 SQL_CONVERT_TIME.................. 84 SQL_CONCURRENCY..................... 64 SQL_CONVERT_TIMESTAMP.... 84 SQL_CONNECT_OPT_DRVR_START ......................................................... 63 SQL_CONVERT_TINYINT ........... 84 SQL_CONVERT_VARBINARY .... 84 SQL_CONVERT_BIGINT .............. 84 SQL_CONVERT_VARCHAR ........ 84 SQL_CONVERT_BINARY............. 84 SQL_CONVERT_WCHAR............. 84 SQL_CONVERT_BIT...................... 84 SQL_CONVERT_CHAR................. 84 SQL_CONVERT_WLONGVARCHA R...................................................... 84 SQL_CONVERT_DATE ................. 84 SQL_CONVERT_WVARCHAR .... 84 SQL_CONVERT_DECIMAL ......... 84 SQL_CORRELATION_NAME ...... 84 SQL_CONVERT_DOUBLE............ 84 SQL_CREATE_ASSERTION......... 84 SQL_CONVERT_FLOAT............... 84 SQL_CREATE_CHARACTER_SET ......................................................... 84 SQL_CONVERT_FUNCTIONS ..... 84 SQL_CREATE_COLLATION ....... 84 SQL_CONVERT_INTEGER .......... 84 SQL_CREATE_DOMAIN............... 84 SQL_CONVERT_INTERVAL_DAY_ TIME.............................................. 84 SQL_CONVERT_INTERVAL_YEA R_MONTH .................................... 84 SQL_CREATE_SCHEMA .............. 84 SQL_CREATE_TABLE .................. 84 SQL_CREATE_TRANSLATION... 84 SQL_CONVERT_LONGVARBINAR Y...................................................... 84 SQL_CREATE_VIEW..................... 84 SQL_CS_CREATE_SCHEMA ....... 84 107 KBSODBCDriver SQL_CT_CREATE_TABLE........... 84 SQL_DRIVER_HENV ..................... 84 SQL_CURRENT_QUALIFIER ......... 63 SQL_DRIVER_HLIB....................... 84 SQL_CURSOR_COMMIT_BEHAVI OR................................................... 84 SQL_DRIVER_HSTMT .................. 84 SQL_DRIVER_NAME..................... 84 SQL_CURSOR_ROLLBACK_BEHA VIOR .............................................. 84 SQL_DRIVER_ODBC_VER........... 84 SQL_CURSOR_SENSITIVITY...... 84 SQL_DRIVER_VER ........................ 84 SQL_CURSOR_TYPE ....................... 64 SQL_DROP ........................................ 54 SQL_CV_CREATE_VIEW ............. 84 SQL_DROP_ASSERTION .............. 84 SQL_DATA_SOURCE_NAME ...... 84 SQL_DROP_CHARACTER_SET.. 84 SQL_DATA_SOURCE_READ_ONL Y...................................................... 84 SQL_DROP_COLLATION............. 84 SQL_DROP_DOMAIN .................... 84 SQL_DATABASE_NAME............... 84 SQL_DROP_SCHEMA.................... 84 SQL_DATETIME_LITERALS....... 84 SQL_DROP_TABLE........................ 84 SQL_DBMS_NAME......................... 84 SQL_DROP_TRANSLATION........ 84 SQL_DBMS_VER............................. 84 SQL_DROP_VIEW .......................... 84 SQL_DEFAULT_TXN_ISOLATION ......................................................... 84 SQL_DS_DROP_SCHEMA............. 84 SQL_DESCRIBE_PARAMETER .. 84 SQL_DT_DROP_TABLE ................ 84 SQL_DL_SQL92_DATE.................. 84 SQL_DV_DROP_VIEW .................. 84 SQL_DL_SQL92_TIME .................. 84 SQL_DYNAMIC_CURSOR_ATTRI BUTES1 ......................................... 84 SQL_DL_SQL92_TIMESTAMP .... 84 SQL_DM_VER ................................. 84 SQL_DYNAMIC_CURSOR_ATTRI BUTES2 ......................................... 84 SQL_DRIVER_HDBC ..................... 84 SQL_ERROR .................................... 80 SQL_DRIVER_HDESC ................... 84 SQL_ERROR_LIST ........................... 80 108 Index SQL_EXPRESSIONS_IN_ORDERB Y...................................................... 84 SQL_FN_LENGTH .......................... 72 SQL_FN_LOCATE .......................... 72 SQL_FD_FETCH_NEXT ................ 84 SQL_FN_LTRIM.............................. 72 SQL_FETCH_DIRECTION............ 84 SQL_FN_MINUTE........................... 72 SQL_FILE_NOT_SUPPORTED .... 84 SQL_FN_MOD ................................. 72 SQL_FILE_USAGE ......................... 84 SQL_FN_MONTH............................ 72 SQL_FN_ABS ................................... 72 SQL_FN_MONTHNAME ............... 72 SQL_FN_ASCII ................................ 72 SQL_FN_NEXT_MONTH_FIRST. 72 SQL_FN_CEILING.......................... 72 SQL_FN_NEXT_MONTH_LAST .. 72 SQL_FN_CHAR ............................... 72 SQL_FN_NEXT_WEEKDAY ......... 72 SQL_FN_CONCAT.......................... 72 SQL_FN_DAYNAME ...................... 72 SQL_FN_NEXT_WEEKEND_DAY ......................................................... 72 SQL_FN_DAYOFMONTH ............. 72 SQL_FN_NUM_ABS........................ 84 SQL_FN_DAYOFWEEK................. 72 SQL_FN_NUM_CEILING .............. 84 SQL_FN_DAYOFYEAR.................. 72 SQL_FN_NUM_FLOOR ................. 84 SQL_FN_DIFFERENCE ................. 72 SQL_FN_NUM_MOD...................... 84 SQL_FN_FLOOR......................... 58, 72 SQL_FN_NUM_PI............................ 84 SQL_FN_HOUR ............................... 72 SQL_FN_NUM_POWER................. 84 SQL_FN_IDENTIFIER ................... 72 SQL_FN_NUM_RAND .................... 84 SQL_FN_IFNULL ............................ 72 SQL_FN_NUM_ROUND ................. 84 SQL_FN_INITIAL_CAPS ............... 72 SQL_FN_NUM_SIGN...................... 84 SQL_FN_INSERT ............................ 72 SQL_FN_NUM_SQRT..................... 84 SQL_FN_LCASE.............................. 72 SQL_FN_NUM_TRUNCATE ......... 84 SQL_FN_LEFT................................. 72 SQL_FN_POWER ............................ 72 109 KBSODBCDriver SQL_FN_QUARTER ....................... 72 SQL_FN_STR_REPEAT ................. 84 SQL_FN_RAND................................ 72 SQL_FN_STR_REPLACE .............. 84 SQL_FN_REPEAT ........................... 72 SQL_FN_STR_RIGHT .................... 84 SQL_FN_REPLACE ........................ 72 SQL_FN_STR_RTRIM.................... 84 SQL_FN_RIGHT.............................. 72 SQL_FN_STR_SOUNDEX.............. 84 SQL_FN_ROUND............................. 72 SQL_FN_STR_SPACE .................... 84 SQL_FN_RTRIM ............................. 72 SQL_FN_STR_SUBSTRING .......... 84 SQL_FN_SECOND........................... 72 SQL_FN_STR_UCASE.................... 84 SQL_FN_SIGN ................................. 72 SQL_FN_SUBSTRING .................... 72 SQL_FN_SOUNDEX................... 58, 72 SQL_FN_SYS_DBNAME ................ 84 SQL_FN_SPACE .............................. 72 SQL_FN_SYS_IFNULL................... 84 SQL_FN_SQRT ................................ 72 SQL_FN_SYS_USERNAME ........... 84 SQL_FN_STR_ASCII ...................... 84 SQL_FN_TD_CURDATE................ 84 SQL_FN_STR_CHAR...................... 84 SQL_FN_TD_CURTIME ................ 84 SQL_FN_STR_CONCAT ................ 84 SQL_FN_TD_DAYNAME............... 84 SQL_FN_STR_DIFFERENCE ....... 84 SQL_FN_TD_DAYOFMONTH...... 84 SQL_FN_STR_INSERT................... 84 SQL_FN_TD_DAYOFWEEK ......... 84 SQL_FN_STR_LCASE .................... 84 SQL_FN_TD_DAYOFYEAR .......... 84 SQL_FN_STR_LEFT ....................... 84 SQL_FN_TD_HOUR........................ 84 SQL_FN_STR_LENGTH ................ 84 SQL_FN_TD_MINUTE ................... 84 SQL_FN_STR_LOCATE ................ 84 SQL_FN_TD_MONTH .................... 84 SQL_FN_STR_LOCATE_2 ............ 84 SQL_FN_TD_MONTHNAME........ 84 SQL_FN_STR_LTRIM.................... 84 SQL_FN_TD_NOW.......................... 84 110 Index SQL_FN_TD_QUARTER................ 84 SQL_FORWARD_ONLY_CURSOR_ ATTRIBUTES2............................. 84 SQL_FN_TD_SECOND ................... 84 SQL_function...................................... 58 SQL_FN_TD_TIMESTAMPADD .. 84 SQL_FUNCTION_LIST .................. 72 SQL_FN_TD_TIMESTAMPDIFF.. 84 SQL_FUNCTION_LIST provides .. 72 SQL_FN_TD_WEEK ....................... 84 SQL_FN_TD_YEAR ........................ 84 SQL_GB_GROUP_BY_CONTAINS_ SELECT......................................... 84 SQL_FN_TIMESTAMPADD.......... 72 SQL_GD_ANY_COLUMN.............. 84 SQL_FN_TIMESTAMPDIFF ......... 72 SQL_GD_ANY_ORDER ................. 84 SQL_FN_TIMESTAMPPART........ 72 SQL_GD_BOUND ............................ 84 SQL_FN_TRUNCATE..................... 72 SQL_GET_BOOKMARK.................. 64 SQL_FN_TSI_DAY .......................... 84 SQL_GETDATA_EXTENSIONS ... 84 SQL_FN_TSI_FRAC_SECOND ..... 84 SQL_GROUP_BY............................. 84 SQL_FN_TSI_HOUR....................... 84 SQL_IC_SENSITIVE....................... 84 SQL_FN_TSI_MINUTE .................. 84 SQL_IC_UPPER............................... 84 SQL_FN_TSI_MONTH ................... 84 SQL_IDENTIFIER............... 68, 71, 72 SQL_FN_TSI_QUARTER............... 84 SQL_IDENTIFIER_CASE .............. 84 SQL_FN_TSI_SECOND .................. 84 SQL_IDENTIFIER_QUOTE_CHAR ......................................................... 84 SQL_FN_TSI_WEEK ...................... 84 SQL_IK_ASC.................................... 84 SQL_FN_TSI_YEAR ....................... 84 SQL_IK_DESC ................................. 84 SQL_FN_UCASE.............................. 72 SQL_INDEX_KEYWORDS............ 84 SQL_FN_WEEK............................... 72 SQL_INFO_SCHEMA_VIEWS...... 84 SQL_FN_YEAR................................ 72 SQL_INTEGER ................................ 91 SQL_FORWARD_ONLY_CURSOR_ ATTRIBUTES1............................. 84 SQL_INTEGRITY............................ 84 111 KBSODBCDriver SQL_INVALID ................................. 80 SQL_KEYSET_CURSOR_ATTRIBU TES1 ............................................... 84 SQL_KEYSET_CURSOR_ATTRIBU TES2 ............................................... 84 SQL_MAX_COLUMNS_IN_ORDER _BY ................................................. 84 SQL_MAX_COLUMNS_IN_SELEC T...................................................... 84 SQL_MAX_COLUMNS_IN_TABLE ......................................................... 84 SQL_KEYSET_SIZE ......................... 64 SQL_KEYWORDS........................... 84 SQL_LCK_NO_CHANGE .............. 84 SQL_MAX_CONCURRENT_ACTIV ITIES.............................................. 84 SQL_MAX_CURSOR_NAME_LEN ......................................................... 84 SQL_LIKE_ESCAPE_CLAUSE..... 84 SQL_LOCK_TYPES........................ 84 SQL_MAX_DRIVER_CONNECTIO NS ................................................... 84 SQL_LOGIN_TIMEOUT................... 63 SQL_MAX_IDENTIFIER_LEN ..... 84 SQL_LONGVARCHAR .................. 91 SQL_MAX_INDEX_SIZE ............... 84 SQL_lower.......................................... 58 SQL_MAX_LENGTH........................ 64 SQL_MAX_ASYNC_CONCURREN T_STATEMENTS......................... 84 SQL_MAX_OWNER_NAME_LEN84 SQL_MAX_BINARY_LITERAL_LE N...................................................... 84 SQL_MAX_CATALOG_NAME_LE N...................................................... 84 SQL_MAX_PROCEDURE_NAME_L EN ................................................... 84 SQL_MAX_QUALIFIER_NAME_LE N...................................................... 84 SQL_MAX_ROW_SIZE.................. 84 SQL_MAX_CHAR_LITERAL_LEN ......................................................... 84 SQL_MAX_ROW_SIZE_INCLUDES _LONG........................................... 84 SQL_MAX_COLUMN_NAME_LEN ......................................................... 84 SQL_MAX_ROWS ............................ 64 SQL_MAX_COLUMNS_IN_GROUP _BY ................................................. 84 SQL_MAX_SCHEMA_NAME_LEN ......................................................... 84 SQL_MAX_COLUMNS_IN_INDEX ......................................................... 84 SQL_MAX_STATEMENT_LEN.... 84 SQL_MAX_TABLE_NAME_LEN . 84 112 Index SQL_MAX_TABLES_IN_SELECT84 SQL_ODBC_SAG_CLI_CONFORM ANCE ............................................. 84 SQL_MAX_USER_NAME_LEN.... 84 SQL_MULT_RESULT_SETS......... 84 SQL_ODBC_SQL_CONFORMANC E...................................................... 84 SQL_MULTIPLE_ACTIVE_TXN . 84 SQL_ODBC_SQL_OPT_IEF .......... 84 SQL_NC_END .................................. 84 SQL_ODBC_VER ............................ 84 SQL_NEED_DATA .......................... 80 SQL_OIC_CORE ............................. 84 SQL_NEED_LONG_DATA_LEN .. 84 SQL_OJ_ALL_COMPARISON_OPS ......................................................... 84 SQL_NNC_NON_NULL.................. 84 SQL_OJ_CAPABILITIES............... 84 SQL_NO_DATA ............................... 80 SQL_OJ_LEFT ................................. 84 SQL_NO_NULLS .............................. 48 SQL_OJ_RIGHT .............................. 84 SQL_NON_NULLABLE_COLUMNS ......................................................... 84 SQL_OPT_TRACE ............................ 63 SQL_NOSCAN................................... 64 SQL_OPT_TRACEFILE.................... 63 SQL_NULL_COLLATION ............. 84 SQL_ORDER_BY_COLUMNS_IN_S ELECT ........................................... 84 SQL_NULLABLE.............................. 48 SQL_OSC_CORE............................. 84 SQL_NULLABLE_UNKNOWN....... 48 SQL_OSCC_COMPLIANT............. 84 SQL_NUMERIC ............................... 91 SQL_OU_DML_STATEMENTS.... 84 SQL_NUMERIC_FUNCTIONS ..... 84 SQL_OU_INDEX_DEFINITION ... 84 SQL_OAC_LEVEL1 ........................ 84 SQL_ODBC_API_CONFORMANCE ......................................................... 84 SQL_ODBC_CURSORS.................... 63 SQL_ODBC_INTERFACE_CONFO RMANCE....................................... 84 SQL_OU_PRIVILEGE_DEFINITIO N...................................................... 84 SQL_OU_PROCEDURE_INVOCATI ON................................................... 84 SQL_OU_PROCEDURE_INVOCATI ON|SQL_OU_TABLE_DEFINITIO N...................................................... 84 113 KBSODBCDriver SQL_OU_TABLE_DEFINITION... 84 SQL_QUOTED_IDENTIFIER_CASE ......................................................... 84 SQL_OUTER_JOINS ...................... 84 SQL_RESET_PARAMS .................... 54 SQL_OWNER_TERM ..................... 84 SQL_RETRIEVE_DATA................... 64 SQL_OWNER_USAGE ................... 84 SQL_ROW_NUMBER....................... 64 SQL_PACKET_SIZE ......................... 63 SQL_ROW_UPDATES.................... 84 SQL_PARAM_ARRAY_ROW_COU NTS................................................. 84 SQL_ROWSET_SIZE ........................ 64 SQL_PARAM_ARRAY_SELECTS 84 SQL_SC_SQL92_ENTRY ............... 84 SQL_PARC_BATCH ....................... 84 SQL_SCC_ISO92_CLI..................... 84 SQL_PAS_NO_BATCH................... 84 SQL_SCCO_READ_ONLY............. 84 SQL_POS_OPERATIONS .............. 84 SQL_SCHEMA_TERM ................... 84 SQL_POSITIONED_STATEMENTS ......................................................... 84 SQL_SCHEMA_USAGE ................. 84 SQL_SCROLL_CONCURRENCY 84 SQL_PROCEDURE_TERM ........... 84 SQL_SCROLL_OPTIONS .............. 84 SQL_PROCEDURES ....................... 84 SQL_SDF_CURRENT_DATE ........ 84 SQL_PS_POSITIONED_DELETE. 84 SQL_SDF_CURRENT_TIME......... 84 SQL_PS_POSITIONED_UPDATE 84 SQL_PS_SELECT_FOR_UPDATE 84 SQL_QUALIFIER_LOCATION .... 84 SQL_SDF_CURRENT_TIMESTAM P ...................................................... 84 SQL_SEARCH_PATTERN_ESCAPE ......................................................... 84 SQL_QUALIFIER_NAME_SEPARA TOR................................................ 84 SQL_SERVER_NAME .................... 84 SQL_QUALIFIER_TERM.............. 84 SQL_SG_DELETE_TABLE ........... 84 SQL_QUALIFIER_USAGE ............ 84 SQL_SG_INSERT_TABLE............. 84 SQL_QUERY_TIMEOUT ................. 64 SQL_SG_SELECT_TABLE............ 84 SQL_QUIET_MODE ......................... 63 SQL_SG_UPDATE_TABLE ........... 84 114 Index SQL_SG_WITH_GRANT_OPTION ......................................................... 84 SQL_SQL92_NUMERIC_VALUE_F UNCTIONS ................................... 84 SQL_SIMULATE_CURSOR............. 64 SQL_SQL92_PREDICATES........... 84 SQL_SO_FORWARD_ONLY......... 84 SQL_SQL92_RELATIONAL_JOIN_ OPERATORS................................ 84 SQL_SO_STATIC ............................ 84 SQL_SQL92_REVOKE ................... 84 SQL_SP_BETWEEN........................ 84 SQL_SP_EXISTS.............................. 84 SQL_SP_IN ....................................... 84 SQL_SQL92_ROW_VALUE_CONST RUCTOR ....................................... 84 SQL_SQL92_STRING_FUNCTIONS ......................................................... 84 SQL_SP_ISNOTNULL .................... 84 SQL_SP_ISNULL ............................. 84 SQL_SQL92_VALUE_EXPRESSION S ...................................................... 84 SQL_SP_LIKE.................................. 84 SQL_SR_DELETE_TABLE............ 84 SQL_SPECIAL_CHARACTERS ... 84 SQL_SR_GRANT_OPTION_FOR. 84 SQL_SQ_COMPARISON ............... 84 SQL_SR_INSERT_TABLE ............. 84 SQL_SQ_CORRELATED_SUBQUE RIES ............................................... 84 SQL_SR_SELECT_TABLE ............ 84 SQL_SR_UPDATE_TABLE ........... 84 SQL_SQ_EXISTS ............................. 84 SQL_SRJO_LEFT_OUTER_JOIN 84 SQL_SQ_IN....................................... 84 SQL_SQ_QUANTIFIED.................. 84 SQL_SRJO_RIGHT_OUTER_JOIN ......................................................... 84 SQL_SQL_CONFORMANCE ........ 84 SQL_SRVC_NULL........................... 84 SQL_SQL92_DATETIME_FUNCTI ONS ................................................ 84 SQL_SRVC_VALUE_EXPRESSION ......................................................... 84 SQL_SQL92_FOREIGN_KEY_DEL ETE_RULE ................................... 84 SQL_SSF_LOWER .......................... 84 SQL_SSF_SUBSTRING .................. 84 SQL_SQL92_FOREIGN_KEY_UPD ATE_RULE ................................... 84 SQL_SSF_TRANSLATE ................. 84 SQL_SQL92_GRANT ...................... 84 SQL_SSF_TRIM_BOTH ................. 84 115 KBSODBCDriver SQL_SSF_UPPER ............................ 84 SQL_TXN_ISOLATION_OPTION 84 SQL_STANDARD_CLI_CONFORM ANCE ............................................. 84 SQL_TXN_READ_COMMITTED. 84 SQL_STATIC_CURSOR_ATTRIBU TES1 ............................................... 84 SQL_TXN_READ_UNCOMMITTED ......................................................... 84 SQL_TXN_REPEATABLE_READ 84 SQL_STATIC_CURSOR_ATTRIBU TES2 ............................................... 84 SQL_TYPE_DATE........................... 91 SQL_STATIC_SENSITIVITY........ 84 SQL_TYPE_TIME ........................... 91 SQL_STRING_FUNCTIONS.......... 84 SQL_TYPE_TIMESTAMP ............. 91 SQL_SUBQUERIES......................... 84 SQL_UNBIND ................................... 54 SQL_SUCCESS................................. 80 SQL_UNION ..................................... 84 SQL_SVE_CASE .............................. 84 SQL_UNSPECIFIED ....................... 84 SQL_SVE_COALESCE................... 84 SQL_USE_BOOKMARKS................ 64 SQL_SYSTEM_FUNCTIONS......... 84 SQL_USER_NAME.......................... 84 SQL_TABLE_TERM ....................... 84 SQL_VARCHAR .............................. 91 SQL_TC_DML.................................. 84 SQL_XOPEN_CLI_YEAR .............. 84 SQL_TEST ............................ 47, 65, 66 SQLAllocConnect ....................... 42, 81 SQL_TIMEDATE_ADD_INTERVAL S ...................................................... 84 SQLAllocEnv................................ 43, 81 SQLAllocStmt..................................... 43 SQL_TIMEDATE_DIFF_INTERVA LS.................................................... 84 SQLBindCol ....................................... 44 SQL_TIMEDATE_FUNCTIONS ... 84 SQLBindParameter ....................... 36, 44 SQL_TRANSLATE_DLL.................. 63 SQLCancel.......................................... 45 SQL_TRANSLATE_OPTION ........... 63 SQLCODE .... 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 70, 80, 81 SQL_TXN_CAPABLE ..................... 84 SQL_TXN_ISOLATION ................... 63 116 Index SQLCODE<0 Discon 41, 43, 44, 45, 47, 48, 50, 51, 54, 55, 56, 57, 60, 62, 63, 64, 65, 66, 70 SQLGetConnectOption....................... 54 SQLCODE<0 Q................................. 49 SQLGetData........................................ 55 SQLCOL ........................... 44, 45, 48, 55 SQLGetFunctions ............................. 38 SQLColAttributes ............................... 45 SQLGetInfo......................................... 56 SQLColumnPrivileges ...................... 46 SQLGetStmtOption .......................... 56 SQLColumns ..................................... 47 SQLGetTypeInfo ................................ 57 SQLConnect .......................... 68, 77, 80 SQLHDBC .... 42, 43, 47, 49, 53, 54, 56, 58, 63, 70 SQLGetCursorName........................... 55 SQLDescribeCol ........................... 45, 48 SQLHENV ............................. 42, 43, 53 SQLDescribeParam............................. 48 SQLDisconnect.................................. 49 SQLHSTMT . 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 54, 55, 56, 57, 59, 60, 61, 62, 64, 65, 66, 67, 68 SQLDriverConnect ........................... 77 SQLJ10 ............................................... 56 SQLError........................................... 49 SQLJ13............................................... 36 SQLExecDirect ............................. 35, 50 SQLJ20 ............................................... 67 SQLExecute .................................. 35, 50 SQLJ21 ......................................... 58, 59 SQLExtendedFetch............................. 5 SQLJ6 ................................................. 57 SQLFetch ........................................... 51 SQLMoreResults................................. 57 SQLFetchScroll ................................... 5 SQLNativeSql ..................................... 58 SQLForeignKeys ................................ 51 SQLNC............................................... 49 SQLFreeConnect............................... 53 SQLNT ............................................... 49 SQLFreeEnv ....................................... 53 SQLNumParams ............................... 59 SQLFreeStmt ...................................... 54 SQLNumResultCols.......................... 60 SQLFreeStmt Option .......................... 54 SQLParamData................................. 38 117 KBSODBCDriver SQLPrepare....................... 35, 41, 50, 60 SQLTables ......................................... 68 SQLPrimaryKeys................................ 60 SQLTables Column .......................... 68 SQLProcedureColumns ............. 36, 61 SQLTEXT.............................. 41, 50, 60 SQLProcedures ........................... 36, 61 SQLTransact ....................................... 70 SQLPutData ................................ 38, 62 SQLTransact Option ........................... 70 SQLRowCount.............................. 57, 62 SQLTTYPE......................................... 70 SQLSetConnectOption ................. 63, 81 SqlType ......................................... 48, 54 SQLSetConnectOption Option ........... 63 SqlTypeName .................................... 91 SQLSetCursorName ......................... 64 SQLUAUTH ....................................... 47 SQLSetEnvAttr ............................. 3, 31 SQLUNAME ...................................... 47 SQLSetParam function .................... 44 SSO^SQLOS....................................... 64 SQLSetStmtOption ............................. 64 Starting the Server............................... 20 SQLSetStmtOption Option ................. 64 Statement Execution ..................... 35, 61 SQLSpecialColumns........................... 65 Stopping the Server............................. 22 SQLSpecialColumns Column............. 65 Stored Procedures ............................... 36 SQLSTATE Stored procedures help..................... 36 corresponding.............................. 80 STORED_PROCEDURE shows........................................... 81 Setting............................................. 36 SQLSTATE 37000.............................. 80 STORED_PROCEDURE................. 36 SQLSTATE Mappings........................ 81 String_exp1........................................ 72 SQLStatistics ............................... 47, 66 String_exp2........................................ 72 SQLStatistics Column......................... 66 String_exp3........................................ 72 SQLTablePrivileges............................ 67 SYSTEM TABLE ............................. 68 118 Index part ............................................. 72 System Tables .............................. 38, 68 T Timestamp Data ................................ 71 T^SQLOS............................................ 70 Timestamp_exp1 ............................... 72 TABLE ........... 46, 47, 60, 65, 66, 67, 68 Timestamp_exp2 ............................... 72 Table Owner .............. 47, 65, 66, 67, 68 Timestamp-literal................................ 58 Table Qualifier .......... 47, 65, 66, 67, 68 TM^SQLOS ...................................... 68 Table Type ................................... 68, 81 Trace API calls .................................. 14 TABLE_NAME................ 60, 66, 67, 68 Tracing on TABLE_OWNER ............. 60, 66, 67, 68 Client .......................................... 26 TABLE_QUALIFIER....... 60, 66, 67, 68 Server ......................................... 28 TABLE_TYPE .................................. 68 Tracing on the Client ........................ 26 TableName............................. 46, 60, 67 Tracing on the Server ....................... 28 TableOwner ........................... 46, 60, 67 Ts timestamp-literal ............................ 58 TableQualifier ....................... 46, 60, 67 TTYPE ................................................ 70 Tables... 7, 38, 46, 47, 51, 60, 63, 64, 65, 66, 67, 68, 71, 81, 84, 91 TYPE........ 44, 48, 54, 56, 57, 63, 66, 68 TYPE_NAME..................................... 65 TCP/IP............................................. 7, 35 TCP/IP Defaults ................................ 15 Types.... 8, 36, 38, 44, 45, 48, 54, 56, 57, 62, 63, 65, 68, 71, 80, 81, 91 TCP/IP Host Definition .................... 16 U TCP/IP Port Definition..................... 17 Unfetched............................................ 57 TEXT.................................................. 91 UNIQUE ............................................. 66 The KB_SQL ODBC Architecture ....... 7 UNMASK ........................................... 56 TIME............................................ 71, 91 UPDATE..................... 55, 57, 62, 64, 67 TimeStamp 119 KBSODBCDriver UPDATE table-name.WHERE CURRENT OF.......................... 55, 64 Use ...................................................... 74 Use ...................................................... 81 Use User2................................................... 84 Execute ........................................... 36 Using data-at-execution parameters 35 NRC................................................ 60 Using QUICK^SQL.......................... 23 Use ................................ 3, 4, 7, 8, 31, 36 V Use ...................................................... 36 V3.6..................................................... 80 Use ...................................................... 41 VALUE ........... 45, 54, 55, 56, 62, 63, 64 Use ...................................................... 47 Variable Names ................................. 41 Use ...................................................... 48 Vendor_name - This ........................... 80 Use ...................................................... 54 Version_number - This ....................... 80 Use ...................................................... 55 VIEW ................................................. 68 Use ...................................................... 56 Viewing the API Trace ..................... 29 Use ...................................................... 56 Views ............................................ 68, 81 Use ...................................................... 60 Visual Basic .................................... 7, 35 Use ...................................................... 60 VMS Cluster issues ........................... 20 Use ...................................................... 62 W Use ...................................................... 63 WCPD^SQLK4................................. 68 Use ...................................................... 64 What is ODBC?................................... 7 Use ...................................................... 64 Why Program .................................... 41 Use ...................................................... 66 Wildcards..................................... 68, 71 Use ...................................................... 68 Windows......................................... 7, 35 Use ...................................................... 70 Windows programming.................... 35 Use ...................................................... 71 120 Index WindowsNT running............................................. 9 WITH_INFO ..................................... 80 Word......................................... 7, 41, 71 WindowsNT ......................................... 9 121
Similar documents
KBS Getting Started Guide
and reporting solution for M databases since 1988. Since its introduction, it has progressed from simple report writer to database management system to application development platform. Thousands o...
More information