IBM Universe UCI

Click here to load reader

  • date post

    11-Apr-2015
  • Category

    Documents

  • view

    683
  • download

    0

Embed Size (px)

Transcript of IBM Universe UCI

C:\Program Files\Adobe\FrameMaker8\UniVerse 10.2A\uci\Front February 21, 2008 3:40 pm

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta

UniVerse

UCI Developers Guide

Version 10.2 February, 2008

C:\Program Files\Adobe\FrameMaker8\UniVerse 10.2A\uci\Front February 21, 2008 3:40 pm

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta BetaIBM Corporation 555 Bailey Avenue San Jose, CA 95141 Licensed Materials Property of IBM Copyright International Business Machines Corporation 2006, 2008. All rights reserved. AIX, DB2, DB2 Universal Database, Distributed Relational Database Architecture, NUMA-Q, OS/2, OS/390, and OS/400, IBM Informix, C-ISAM, Foundation.2000 , IBM Informix 4GL, IBM Informix DataBlade module, Client SDK, Cloudscape, Cloudsync, IBM Informix Connect, IBM Informix Driver for JDBC, Dynamic Connect, IBM Informix Dynamic Scalable Architecture (DSA), IBM Informix Dynamic Server, IBM Informix Enterprise Gateway Manager (Enterprise Gateway Manager), IBM Informix Extended Parallel Server, i.Financial Services, J/Foundation, MaxConnect, Object Translator, Red Brick Decision Server, IBM Informix SE, IBM Informix SQL, InformiXML, RedBack, SystemBuilder, U2, UniData, UniVerse, wIntegrate are trademarks or registered trademarks of International Business Machines Corporation. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Windows, Windows NT, and Excel are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Limited. Other company, product, and service names used in this publication may be trademarks or service marks of others. This product includes cryptographic software written by Eric Young ([email protected]). This product includes software written by Tim Hudson ([email protected]). Documentation Team: Claire Gustafson, Shelley Thompson, Anne Waite US GOVERNMENT USERS RESTRICTED RIGHTS Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

ii UCI Developers Guide

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta

Table of Contents

Table of Contents

PrefaceOrganization of This Manual . . . Documentation Conventions. . . . Hungarian Naming Conventions . Help . . . . . . . . . . . UniVerse Documentation. . . . . Related Documentation . . . . . API Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii ix xi xii xiii xvi xvii

Chapter 1

IntroductionWhat Is an SQL Call Interface?. . . . . . SQL Call Interface Versus Embedded SQL Advantages of Call Interfaces. . . . . Language Support . . . . . . . . . . Operating Platforms . . . . . . . . . Compliance with the ODBC 2.0 Standard . . Requirements for UCI Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 1-3 1-4 1-5 1-6 1-7 1-8

Chapter 2

Getting StartedInstalling UCI . . . . . . . . . . On UNIX Systems . . . . . . . On Windows Systems . . . . . . Version Compatibility . . . . . . Creating and Running the Sample Application Creating and Running Client Programs . . UCI Administration . . . . . . . . Maintaining the UCI Configuration File Administering the UniRPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 2-3 2-4 2-4 2-6 2-8 2-10 2-10 2-10

:\Program Files\Adobe\FrameMaker8\UniVerse 10.2A\uci\UCITOC.doc (bookTOC.template)

Chapter 3

Configuring UCIConfiguring a Database Server for UCI . . . . . . . UniRPC . . . . . . . . . . . . . . . UniVerse NLS . . . . . . . . . . . . . Configuring a Client System for UCI . . . . . . . Configuration Parameters. . . . . . . . . . Editing the UCI Configuration File . . . . . . Changing UCI Configuration File Parameters . . . Configuring UCI for an NLS-Enabled UniVerse Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 3-3 3-4 3-5 3-5 3-8 3-10 3-12

Chapter 4

Developing UCI ApplicationsWriting a UCI Application Program . . . . Initializing Resources . . . . . . . . Allocating the Environment . . . . . Allocating the Connection . . . . . Connecting to the Server . . . . . . Allocating Statement Handles . . . . Processing SQL Statements . . . . . . Transaction Modes . . . . . . . . Function Calls . . . . . . . . . Executing an SQL Statement . . . . Processing Output from SQL Statements . Checking for Errors . . . . . . . Freeing the SQL Statement Environment . Terminating the Connection . . . . . . Transaction Processing . . . . . . . . Nested Transactions . . . . . . . Transaction Isolation Levels . . . . . Handling Multivalued Columns . . . . . Setting the Data Model Mode . . . . Dynamic Normalization and Associations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 4-4 4-4 4-5 4-5 4-9 4-10 4-10 4-11 4-11 4-15 4-17 4-18 4-19 4-20 4-20 4-22 4-23 4-23 4-25

Chapter 5

Calling and Executing UniVerse ProceduresWhat Can You Call as a UniVerse Procedure? . Processing UniVerse Procedure Results . . . Print Result Set . . . . . . . . . Multicolumn Result Set . . . . . . Affected-Row Count . . . . . . . Output Parameter Values . . . . . . Processing Errors from UniVerse Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 5-5 5-5 5-6 5-6 5-6 5-7

iv UCI Developers Guide

Chapter 6

How to Write a UniVerse ProcedureUsing UniVerse Paragraphs, Commands, and Procs as Procedures . . . . 6-3 Writing UniVerse BASIC Procedures . . . . . . . . . . . . . 6-4 Parameters Used by a UniVerse BASIC Procedure . . . . . . . 6-4 SQL Results Generated by a UniVerse BASIC Procedure . . . . . 6-5 Using @HSTMT in a UniVerse BASIC Procedure to Generate SQL Results 67 Using the @TMP File in a UniVerse BASIC Procedure. . . . . . 6-9 Errors Generated by a UniVerse BASIC Procedure . . . . . . . 6-12 Restrictions in UniVerse BASIC Procedures . . . . . . . . . 6-15 Fetching Rows and Closing @HSTMT Within a Procedure . . . . 6-15 Hints for Debugging a Procedure . . . . . . . . . . . . . 6-16

Chapter 7

Data TypesData Types and Data Type Coercion C Data Types Supported . . SQL Data Types Supported . Data Type Coercion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 . 7-3 . 7-9 . 7-10

Chapter 8

UCI FunctionsFunction Call Summary . . . . . . . Variables . . . . . . . . . . Search Patterns . . . . . . . . Return Values . . . . . . . . . Error Codes . . . . . . . . . Use of Hungarian Naming Conventions Functions . . . . . . . . . . . . SQLAllocConnect . . . . . . . . . SQLAllocEnv . . . . . . . . . SQLAllocStmt . . . . . . . . . . SQLBindCol . . . . . . . . . . SQLBindMvCol . . . . . . . . . SQLBindMvParameter . . . . . . . SQLBindParameter . . . . . . . . SQLCancel . . . . . . . . . . SQLColAttributes . . . . . . . . SQLColumns . . . . . . . . . SQLConnect . . . . . . . . . . SQLDataSources . . . . . . . . . SQLDescribeCol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 . 8-5 . 8-7 . 8-8 . 8-8 . 8-8 . 8-10 . 8-11 . . . . . . . 8-13 . . . . . . . . 8-15 . . . . . . . 8-17 . . . . . . . 8-22 . . . . . . . 8-25 . . . . . . . 8-27 . . . . . . . 8-32 . . . . . . . 8-34 . . . . . . . 8-41 . . . . . . . 8-45 . . . . . . . . 8-49 . . . . . . . 8-52 Table of Contents v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.. .

. . . . . . . . . .

. . . . . . . .. .

.

SQLDisconnect . . SQLError . . . . SQLExecDirect . . SQLExecute . . . SQLFetch . . . . SQLFreeConnect . . SQLFreeEnv . . . SQLFreeMem . . . SQLFreeStmt . . . SQLGetData . . . SQLGetFunctions . . SQLGetInfo . . . SQLNumParams . . SQLNumResultCols . SQLParamOptions . SQLPrepare . . . SQLRowCount . . SQLSetConnectOption SQLSetParam . . . SQLTables . . . . SQLTransact . . . SQLUseCfgFile . .

. . . . . . . . . . . .. .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . .

. . . .

. . . . . . . .. .

. . . . .

. . . .

8-56 8-58 8-62 8-66 8-69 8-73 8-75 8-77 8-78 8-81 8-85 8-89 . . . . . . 8-98 . . . . . 8-100 . . . . . 8-102 . . . . . 8-105 . . . . . 8-109 . . . . . 8-111 . . . . . 8-117 . . . . . 8-120 . . . . . 8-125 . . . . . . 8-129

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

Appendix A

Error CodesSQLSTATE Error Codes . . . . . . . . . . . . . . . . UniVerse SQL Error Co