| 1 |
/****************************************************************************** |
| 2 |
* |
| 3 |
* Project: Oracle Spatial Driver |
| 4 |
* Purpose: Test mainline for Oracle Spatial Driver low level functions. |
| 5 |
* Author: Frank Warmerdam, [email protected] |
| 6 |
* |
| 7 |
****************************************************************************** |
| 8 |
* Copyright (c) 2002, Frank Warmerdam <[email protected]> |
| 9 |
* |
| 10 |
* SPDX-License-Identifier: MIT |
| 11 |
****************************************************************************/ |
| 12 |
|
| 13 |
#include "ogr_oci.h" |
| 14 |
#include "cpl_conv.h" |
| 15 |
|
| 16 |
/************************************************************************/ |
| 17 |
/* main() */ |
| 18 |
/************************************************************************/ |
| 19 |
|
| 20 |
int main(int nArgc, char **papszArgv) |
| 21 |
|
| 22 |
{ |
| 23 |
OGROCISession *poSession = nullptr; |
| 24 |
const char *pszStatement = "SELECT * FROM NEPSITE"; |
| 25 |
char **papszResult; |
| 26 |
|
| 27 |
if (nArgc > 1) |
| 28 |
pszStatement = papszArgv[1]; |
| 29 |
|
| 30 |
poSession = OGRGetOCISession("system", "LetoKing", ""); |
| 31 |
if (poSession == nullptr) |
| 32 |
exit(1); |
| 33 |
|
| 34 |
OGROCIStatement oStatement(poSession); |
| 35 |
|
| 36 |
if (oStatement.Execute(pszStatement) == CE_Failure) |
| 37 |
exit(2); |
| 38 |
|
| 39 |
while ((papszResult = oStatement.SimpleFetchRow()) != nullptr) |
| 40 |
{ |
| 41 |
OGRFeatureDefn *poDefn = oStatement.GetResultDefn(); |
| 42 |
int nColCount = poDefn->GetFieldCount(); |
| 43 |
int i; |
| 44 |
|
| 45 |
printf("\n"); |
| 46 |
for (i = 0; i < nColCount; i++) |
| 47 |
{ |
| 48 |
printf(" %s = %s\n", poDefn->GetFieldDefn(i)->GetNameRef(), |
| 49 |
papszResult[i]); |
| 50 |
} |
| 51 |
} |
| 52 |
} |