#docslug#/ecob/ecob/V1.1.6/ph52hu
OceanBase Embedded SQL in C (ECOB) is an OceanBase precompiler that provides features that are compatible with Oracle Pro*C.
Pro*C is an application development tool provided by the Oracle database ecosystem. When you develop an application in C language, ECOB allows you to embed SQL statements into the source code of the application. These embedded SQL statements can use variables in the C code of the application as input and output parameters. Then, the Oracle PROC precompiler preprocesses the source code for complete syntax analysis and translates the embedded SQL statements and commands into calls to the SQLLIB runtime library. After that, ECOB generates a source code file of the application in C language. After the file is compiled and linked by a C compiler, an executable program is generated. To provide support for Pro*C, OceanBase develops ECOB that contains the ecob precompiler and the ecoblib runtime library.
A PROC program comprises a great number of PC files and is built by using methods such as makefiles. To minimize your migration costs, the ecob precompiler provides command-line tool options and features that are the same as those of the PROC program.
Features
ECOB of the current version provides the following features:
Supports SQL syntax that is compatible with the OceanBase Oracle mode.
Supports basic embedded SQL statements, such as
COMMIT,CONNECT,DELETE,EXECUTE,EXECUTE IMMEDIATE,INSERT,SELECT,UPDATE,WHENEVER,CALL,PREPARE, andROLLBACK.Supports cursor-related statements, such as
DECLARE,OPEN,CLOSE, andFETCH(includingNEXT,ABSOLUTE,WITH HOLD, andCURRENT OF).Supports
descriptorsrequired by ANSI dynamic SQL and descriptor-related statements, such asALLOCATE,DEALLOCATE,GET,SET,DESCRIBE, andFETCH.Allows you to use host variables without declaration in
BEGIN DECLARE SECTIONandEND DECLARE SECTION.Recognizes and processes C preprocessor macros, including #ifdef, #ifndef, #else, #endif, and #define.
The ecoblib library supports the runtime behavior of all the preceding statements. The ecoblib library provides options (such as CHAR_MAP) that are compatible with PROC programs and allows programs to run in the Tuxedo environment.
An ecob program recognizes all options and compatible semantics of PROC programs and can be used as a replacement for PROC programs.
Architecture
ECOB comprises the ecob precompiler and the ecoblib library (libecob.so), a runtime dynamic link library. The following figure shows the architecture of ECOB.
