ZOO-Project
Functions | Variables
sqlapi.c File Reference
#include "ogr_api.h"
#include "ogrsf_frmts.h"
#include "ogr_p.h"
#include "response_print.h"
#include <fcgi_stdio.h>
#include "sqlapi.h"
#include "service_callback.h"

Functions

char * _createInitString (maps *pmsConf, const char *pccKey)
 Create a GDAL / OGR string for connecting to a db backend defined in the key section. More...
 
char * createInitString (maps *pmsConf)
 Create a GDAL / OGR string for connecting to the db backend. More...
 
int _init_sql (maps *pmsConf, const char *pccKey)
 Connect to a db backend. More...
 
int init_sql (maps *pmsConf)
 Connect to the db backend. More...
 
void close_sql (maps *pmsConf, int iConnectionId)
 Close any connection to the db backend. More...
 
void end_sql ()
 Call OGRCleanupAll. More...
 
OGRLayer * fetchSql (maps *pmsConf, int iConnectionId, const char *pcSqlQuery)
 Fetch a tuple set by executing a SQL query to the Database Backend. More...
 
void cleanFetchSql (maps *pmsConf, int iConnectionId, OGRLayer *poLayer)
 Clean any memory allocated by executing a request. More...
 
int execSql (maps *pmsConf, int iConnectionId, const char *pcSqlQuery)
 Execute a SQL query to the SQL Database Backend. More...
 
void cleanUpResultSet (const maps *pmsConf, int iConnectionId)
 Clean any memory allocated by executing a request. More...
 
int getCurrentId (maps *pmsConf)
 Get the identifier of the current database. More...
 

Variables

OGRDataSource ** ppoZooDS = NULL
 Global GDALDataset pointer. More...
 
OGRLayer * poZooResultSet = NULL
 Global OGRLayer pointer pointing to the lastest result set. More...
 

Function Documentation

◆ _createInitString()

char* _createInitString ( maps pmsConf,
const char *  pccKey 
)

Create a GDAL / OGR string for connecting to a db backend defined in the key section.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
pccKeythe name of the section containing the connection setting
Returns
the OGR connection string

◆ _init_sql()

int _init_sql ( maps pmsConf,
const char *  pccKey 
)

Connect to a db backend.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
pccKeythe name of the section containing the connection setting
See also
createInitString

◆ cleanFetchSql()

void cleanFetchSql ( maps pmsConf,
int  iConnectionId,
OGRLayer *  poLayer 
)

Clean any memory allocated by executing a request.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
iConnectionIdthe connection identifier
poLayerthe OGRLayer pointer to clean

◆ cleanUpResultSet()

void cleanUpResultSet ( const maps pmsConf,
int  iConnectionId 
)

Clean any memory allocated by executing a request.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
iConnectionIdthe connection identifier
Returns
-1 in case of failure and 1 if the query succeed.

◆ close_sql()

void close_sql ( maps pmsConf,
int  iConnectionId 
)

Close any connection to the db backend.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
iConnectionIdthe connection identifier

◆ createInitString()

char* createInitString ( maps pmsConf)

Create a GDAL / OGR string for connecting to the db backend.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
Returns
the OGR connection string

◆ end_sql()

void end_sql ( )

Call OGRCleanupAll.

◆ execSql()

int execSql ( maps pmsConf,
int  iConnectionId,
const char *  pcSqlQuery 
)

Execute a SQL query to the SQL Database Backend.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
pcSqlQuerythe SQL query to run
Returns
-1 in case of failure and 1 if the query succeed.

◆ fetchSql()

OGRLayer* fetchSql ( maps pmsConf,
int  iConnectionId,
const char *  pcSqlQuery 
)

Fetch a tuple set by executing a SQL query to the Database Backend.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
pcSqlQuerythe SQL query to run
Returns
NULL in case of failure or an OGRLayer pointer if the query succeed.

◆ getCurrentId()

int getCurrentId ( maps pmsConf)

Get the identifier of the current database.

Parameters
pmsConfthe maps containing the setting of the main.cfg file

◆ init_sql()

int init_sql ( maps pmsConf)

Connect to the db backend.

Parameters
pmsConfthe maps containing the setting of the main.cfg file
See also
createInitString

Variable Documentation

◆ poZooResultSet

OGRLayer* poZooResultSet = NULL

Global OGRLayer pointer pointing to the lastest result set.

◆ ppoZooDS

OGRDataSource** ppoZooDS = NULL

Global GDALDataset pointer.