![]() | ![]() |
Home |
|
|
Open Client Client-Library/C Reference Manual |
|
| Chapter 1 Introducing Client-Library |
|
| The Open Client and Open Server products |
Sybase provides two families of products to enable customers to write client and server application programs. They are:
Open Client
Open Server
Open Client provides customer applications, third-party products, and other Sybase products with the interfaces needed to communicate with Adaptive Server and Open Server.
Open Client can be thought of as comprising two components, programming interfaces and network services.
Open Client provides two core programming interfaces for writing client applications: Client-Library and DB-Library
Open Client Client-Library/C is described in this book. The Client-Library interface supports server-managed cursors and other features in System 10 and later versions of the product line.
Open Client DB-Library is a separate API that support older Open Client applications. DB-Library is documented in the Open Client DB-Library/C Reference Manual.
Client-Library programs also depend on CS-Library, which provides routines that are used in both Client-Library and Server-Library applications. Client-Library applications can also use Bulk-Library routines to facilitate high-speed data transfer.
CS-Library and Bulk-Library are both included in the Open Client product. These libraries are described further under "Shared common libraries".
Open Client network services include Sybase Net-Library(TM), which provides support for specific network protocols such as TCP/IP and DECnet. The Net-Library interface is invisible to application programmers. However, on some platforms an application may need a different Net-Library driver for different system network configurations. Depending on your host platform, the Net-Library driver is specified either by the system's Sybase configuration, or when you compile and link your programs. (Instructions for driver configuration are in the Open Client/Server Configuration Guide. Instructions for building Client-Library programs are in the Open Client/Server Programmer's Supplement.)
Open Server provides the tools and interfaces needed to create custom servers.
Like Open Client, Open Server consists of an interfaces component and a network services component.
The core programming interface for creating Open Server applications is Server-Library. Server-Library is documented in the Open Server Server-Library/C Reference Manual. Server-Library programs depend on Client/Server-Library (CS-Library for short). Gateway Server-Library applications can also use routines from Client-Library and Bulk-Library. Client-Library, CS-Library, and Bulk-Library are all included in the Open Server product.
Open Server network services are transparent.
The Open Client and Open Server products both include Bulk-Library and CS-Library. These libraries provide routines useful to both client applications and server applications. CS-Library and Bulk-Library are both documented in the Open Client and Open Server Common Libraries Reference Manual.
CS-LibraryCS-Library provides utility routines for Client-Library and Open Server programs. CS-Library allocates the core data structure (the CS_CONTEXT) for Client-Library programs. CS-Library also provides facilities for data conversion and localizing the client character set and language. The type definitions for data sent between the client and server are the same for CS-Library, Client-Library, and Server-Library.
DB-Library is not integrated with CS-Library. DB-Library and CS-Library share no common data structures, and their datatype definitions differ.
Bulk-LibraryBulk-Library/C provides routines that allow Client-Library and Server-Library applications to use Adaptive Server's bulk copy interface for high speed data transfer. Client-Library programmers do not need to know Bulk-Library unless they want their applications to transfer data with the bulk copy interface. Bulk-Library, Client-Library, and Server-Library share common type definitions for data exchanged between client and server.
DB-Library has its own bulk copy interface and cannot be used with Bulk-Library.
The following diagram illustrates the relationship between the libraries included with Open Client and Open Server:
As an example, a client application might include calls to Client-Library and CS-Library, while an application that acts as both client and server might include calls to Client-Library, CS-Library, and Server-Library.
Although DB-Library is a completely separate interface from Client-Library, CS-Library, and Bulk-Library, it can be used in an Open Server gateway. It does not share Client-Library's advantages of sharing common data structures and type definitions with Server-Library.
Client-Library is a generic interface. Through Open Server and gateway applications, Client-Library applications can run against non-Sybase applications and servers as well as Adaptive Server.
Because it is generic, Client-Library does not enforce or reflect any particular server's restrictions. For example, Client-Library allows text and image stored procedure parameters, but Adaptive Server does not.
When writing a Client-Library application, keep the application's ultimate target server in mind. If you are unsure about what is legal on a server and what is not, consult your server documentation.
An application can call ct_capability to find out what capabilities a particular client/server connection supports.
Either an Open Client library application or an Embedded SQL application can be used to send SQL commands to Adaptive Server.
An Embedded SQL application includes SQL commands in-line. The Embedded SQL precompiler processes the commands into calls to Client-Library routines. All Sybase precompilers 11.0 and later use a runtime library composed solely of documented Client-Library and CS-Library calls. Basically, the precompiler transforms an Embedded SQL application into a Client-Library application, which is then compiled using the host-language compiler.
An Open Client library application sends SQL commands through library routines and does not require a precompiler.
Generally, an Embedded SQL application is easier to write and debug, but a library application can take fuller advantage of the flexibility and power of Open Client routines.
|
|