CONTENTS Title Page Copyright Page Send Us Your Comments Preface Technical Changes and New Features 1 Overview 1.1 Introduction to SQL/Services 1.1.1 Client Components 1.1.2 Network Components 1.1.3 Server System Components 1.2 Preparing Programmers to Use SQL/Services 1.2.1 What Programmers Must Know to Write Applications 1.2.2 Reading Path for Programmers 1.3 Location of SQL/Services Error Documentation 1.4 Other Digital Products That Layer on SQL/Services 1.5 What System Managers Must Know to Support SQL/Services 2 Tools for API Application Development 2.1 Introduction to the Dynamic SQL Interface of DEC Rdb 2.2 Overview of Dynamic SQL Processing Statements 2.2.1 Execution Statements 2.2.2 Result Table Statements 2.3 Using the Dynamic SQL Interface of DEC Rdb 2.3.1 Parameter Markers 2.3.2 SELECT Statements 2.3.3 Unknown Statements 2.3.4 The SQL Descriptor Area (SQLDA or SQLDA2) 2.3.5 The SQL Communications Area (SQLCA) 2.4 Overview of API Routines 2.4.1 Association Routines 2.4.2 SQL Statement Routines 2.4.3 Result Table Routines 2.4.4 Utility Routines 2.4.5 Functional Interface Routines 2.5 Overview of Data Structures 2.6 Developing Applications with the Functional Interface Routines 2.6.1 Recommendations for API Application Development 2.6.2 Methods for Indirectly Accessing SQLCA, SQLDA, and SQLDA2 Structures 2.7 Building SQL/Services Application Programs 2.7.1 Building Applications on the OpenVMS Operating System 2.7.2 Building Applications on the MS-DOS Operating System 2.7.2.1 Building Applications on MS-DOS from the DOS Prompt 2.7.2.2 Building Applications on MS Windows Version 3.0 or 3.1 2.7.3 Building Applications on the Windows NT PC or Windows NT AXP Operating System Version 3.1 2.7.4 Building Applications on the DEC OSF/1 AXP Operating System 2.7.5 Building Applications on the ULTRIX for RISC or ULTRIX for VAX Operating System 2.7.6 Building Applications on the OS/2 Operating System 2.7.7 Building Applications on the Macintosh Operating System 2.7.7.1 Building Applications on the Macintosh Operating System for MPW 2.7.7.2 Building Applications on the Macintosh Operating System for THINK C 2.7.8 Building Applications on the SunOS Operating System 2.8 Client Configurations 2.8.1 Supported Methods for MS-DOS Configurations 2.8.2 Supported Methods for MS Windows Configurations 3 Sample Application Guidelines 3.1 The Sample Application 3.2 Building the Sample Application 3.2.1 Building the Sample Application on the OpenVMS Operating System 3.2.2 Building the Sample Application for MS-DOS 3.2.2.1 Building the Sample Application on the MS-DOS Operating System 3.2.2.2 Building the Sample Application on the MS-DOS Operating System for MS Windows Version 3.0 or 3.1 3.2.3 Building the Sample Application on the Windows NT PC or Windows NT AXP Operating System Version 3.1 3.2.4 Building the Sample Application on the DEC OSF/1 AXP Operating System 3.2.5 Building the Sample Application on the ULTRIX for RISC or ULTRIX for VAX Operating System 3.2.6 Building the Sample Application on the OS/2 Operating System 3.2.7 Building the Sample Application on the Macintosh Operating System 3.2.7.1 Building the Sample Application on the Macintosh Operating System for MPW 3.2.7.2 Building the Sample Application on the Macintosh Operating System for THINK C 3.2.8 Building the Sample Application on the SunOS Operating System 3.3 Running the Sample Application 3.4 The Driver Module 3.5 The Dynamic Module 3.5.1 Creating and Releasing an Association 3.5.2 Processing the Dynamic SQL Statement 3.5.2.1 Declaring and Allocating SQLDA_ID Identifiers 3.5.2.2 Testing for Parameter Markers 3.5.2.3 Allocating Buffers That Hold the Data and Indicator Variables 3.5.2.4 Processing Parameter Markers 3.5.2.5 Executing Non-SELECT Statements 3.5.2.6 Testing for SELECT Statements 3.5.2.7 Processing a Result Table 3.5.2.8 Releasing Prepared Statements 3.5.2.9 Error Handling 4 Performance Considerations 4.1 Batched Execution 4.2 Fetching Multiple Rows 4.3 Using Stored Procedures 4.4 Reuse SQL Statements 5 Logging for Performance and Debugging 5.1 Enabling and Disabling Logging 5.2 Association Logging 5.3 Routine Logging 5.4 Message Protocol Logging 6 API Routines 6.1 Documentation Format 6.1.1 Routine Name 6.1.2 Return Values 6.1.3 C Format Section 6.1.4 Parameters Section 6.1.4.1 Data Type Entry 6.1.4.2 Access Entry 6.1.4.3 Mechanism Entry 6.2 API Routines 6.2.1 Association Routines sqlsrv_abort sqlsrv_associate sqlsrv_get_associate_info sqlsrv_release 6.2.2 SQL Statement Routines sqlsrv_prepare sqlsrv_execute sqlsrv_execute_in_out sqlsrv_execute_immediate sqlsrv_release_statement 6.2.3 Result Table Routines sqlsrv_declare_cursor sqlsrv_open_cursor sqlsrv_fetch sqlsrv_fetch_many sqlsrv_close_cursor 6.2.4 Utility Routines sqlsrv_allocate_sqlda_data or sqlsrv_allocate_sqlda2_data sqlsrv_free_sqlda_data or sqlsrv_free_sqlda2_data sqlsrv_set_option sqlsrv_sqlda_set_sqllen or sqlsrv_sqlda2_set_sqllen 6.2.5 Functional Interface Routines sqlsrv_sqlca_error sqlsrv_sqlca_error_text sqlsrv_sqlca_num_batch_rows sqlsrv_sqlca_count sqlsrv_sqlca_sqlerrd sqlsrv_sqlda_sqld or sqlsrv_sqlda2_sqld sqlsrv_sqlda_column_name or sqlsrv_sqlda2_column_name sqlsrv_sqlda_column_type or sqlsrv_sqlda2_column_type sqlsrv_sqlda_bind_data or sqlsrv_sqlda2_bind_data sqlsrv_sqlda_unbind_sqlda or sqlsrv_sqlda2_unbind_sqlda2 sqlsrv_sqlda_ref_data or sqlsrv_sqlda2_ref_data sqlsrv_sqlda_unref_data or sqlsrv_sqlda2_unref_data sqlsrv_sqlda_get_data or sqlsrv_sqlda2_get_data sqlsrv_sqlda_set_data or sqlsrv_sqlda2_set_data sqlsrv_sqlda2_char_set_info 7 Data Structures 7.1 Documentation Format 7.2 ASSOCIATE_STR-Association Structure 7.3 SQLCA-SQL Communications Area 7.4 SQLERRD-Part of SQLCA 7.5 SQLDA or SQLDA2-SQL Descriptor Area 7.6 SQLVAR-Parameter Marker or Select List Item 7.7 SQLVAR2-Parameter Marker or Select List Item 8 Data Types 8.1 Data Types 8.2 SQLSRV_ASCII_STRING 8.3 SQLSRV_GENERALIZED_NUMBER 8.4 SQLSRV_GENERALIZED_DATE 8.5 SQLSRV_VARCHAR 8.6 SQLSRV_VARBYTE 8.7 SQLSRV_LIST_VARBYTE 8.8 SQLSRV_INTERVAL A Reporting Software Problems B Deprecated Features B.1 VAX Format of SQL/Services API Routines B.1.1 VAX Format Section B.2 Deprecated Routines sqlsrv_set_server_class sqlsrv_set_transport_type sqlsrv_sqlda_map_data sqlsrv_sqlda_unmap_data