solidDB Help : Samples : Stored procedures and ODBC sample
  
Stored procedures and ODBC sample
This sample C application and a procedure definition script demonstrate the usage of procedures when using ODBC.
The sample files are located in the soliddb-installdir\samples\procedures directory. For general information about running the samples, see Samples.
The sample consists of the following key files:
procedure.c: source for the program that runs the procedures,
extproclib.c: source for an external function and an external procedure,
procedures.sql: SQL statements that create and populate tables, and create the SQL function and SQL procedure (by using the external function and external procedure).
The following aspects of SQL procedure programming are demonstrated in the procedures application:
Use of an input parameter, and return values with the RETURNS clause.
Return of multiple rows (result set) and processing of each row in the program,
Return of several values for one column.
Use of an external C function and procedure.
Return of a value by using an output parameter.
Running the sample
To demonstrate the use of the application, run the runme script (runme.bat on Windows), which completes the following actions:
1 Build an external library (libextproc) that contains the external C function and procedure.
2 Compile the procedure application (procedure.exe).
3 Start a solidDB server.
4 Load an SQL script (procedures.sql) that creates and populates tables in the database, and creates the solidDB function and stored procedure.
5 Run the procedure application, which does the following steps:
a connects to the database by using ODBC,
b executes SQL statements and displays the results,
c cleans the database.
6 Stop the solidDB server.
Go up to
Samples