mcorest_svc_sql_init

Initialize the SQL web service library.

For an overview see page Web Services

Prototype

 
  MCOR_RET mcorest_svc_sql_init(mcorest_h rest, void *engine);
 

Arguments

rest Pointer to receive the server instance handle
engine Pointer to an instance of McoMultithreadedSqlEngine

Description

This function Initializes the SQL web service library.

The SQL web service enables the clients to run arbitrary SQL queries, execute statements, and fetch SQL statistics. The service must be explicitly initialized by the application using this function.

This function may only be called once, and only when the RESTful Web Services runtime is initialized and configured. It installs the handler for the "/api/sql" endpoint in the eXtremeDB embedded web server and initializes the internal state of the service.

The caller is responsible for creating a valid instance of McoMultithreadedSqlEngine. The pointer to the engine is passed through the "engine" parameter. It must remain valid until the RESTful server is destroyed using the mcorest_destroy() function.

If the application fails to call this function, the "/api/sql" endpoint and all its child resources will not be available. All client requests will return HTTP error 404 ("not found").

Return Codes

MCO_S_OK = 0 Success
MCO_E_REST_* Any of the Web Services Error Codes

Files

Header file:
mcorest.h
Source file:
restsql.c
Library:
libmcorestsql.a