MCPcopy Create free account
hub / github.com/MapServer/MapServer / msOracleSpatialGetFieldDefn

Function msOracleSpatialGetFieldDefn

maporaclespatial.c:2925–3029  ·  view source on GitHub ↗

* msOracleSpatialGetFieldDefn() * * Pass the field definitions through to the layer metadata in the * "gml_[item]_{type,width,precision}" set of metadata items for * defining fields. **********************************************************************/

Source from the content-addressed store, hash-verified

2923 * defining fields.
2924 **********************************************************************/
2925static void
2926msOracleSpatialGetFieldDefn( layerObj *layer,
2927 msOracleSpatialHandler *hand,
2928 const char *item,
2929 OCIParam *pard )
2930
2931{
2932 const char *gml_type = "Character";
2933 char md_item_name[256];
2934 char gml_width[32], gml_precision[32];
2935 int success;
2936 ub2 rzttype, nOCILen;
2937
2938 gml_width[0] = '\0';
2939 gml_precision[0] = '\0';
2940
2941/* -------------------------------------------------------------------- */
2942/* Get basic parameter details. */
2943/* -------------------------------------------------------------------- */
2944 success =
2945 TRY( hand, OCIAttrGet ((dvoid *) pard,(ub4) OCI_DTYPE_PARAM,
2946 (dvoid*)&rzttype,(ub4 *)0,
2947 (ub4) OCI_ATTR_DATA_TYPE, hand->errhp ))
2948 && TRY( hand, OCIAttrGet ((dvoid *) pard,(ub4) OCI_DTYPE_PARAM,
2949 (dvoid*)&nOCILen ,(ub4 *)0,
2950 (ub4) OCI_ATTR_DATA_SIZE, hand->errhp ));
2951
2952 if( !success )
2953 return;
2954
2955 switch( rzttype )
2956 {
2957 case SQLT_CHR:
2958 case SQLT_AFC:
2959 gml_type = "Character";
2960 if( nOCILen <= 4000 )
2961 sprintf( gml_width, "%d", nOCILen );
2962 break;
2963
2964 case SQLT_NUM:
2965 {
2966 // NOTE: OCI docs say this should be ub1 type, but we have
2967 // determined that oracle is actually returning a short so we
2968 // use that type and try to compensate for possible problems by
2969 // initializing, and dividing by 256 if it is large.
2970 unsigned short byPrecision = 0;
2971 sb1 nScale = 0;
2972
2973 if( !TRY( hand, OCIAttrGet ((dvoid *) pard,(ub4) OCI_DTYPE_PARAM,
2974 (dvoid*)&byPrecision ,(ub4 *)0,
2975 (ub4) OCI_ATTR_PRECISION,
2976 hand->errhp ))
2977 || !TRY( hand, OCIAttrGet ((dvoid *) pard,(ub4) OCI_DTYPE_PARAM,
2978 (dvoid*)&nScale,(ub4 *)0,
2979 (ub4) OCI_ATTR_SCALE,
2980 hand->errhp )) )
2981 return;
2982 if( byPrecision > 255 )

Callers 1

Calls 3

TRYFunction · 0.85
msOWSLookupMetadataFunction · 0.85
msInsertHashTableFunction · 0.85

Tested by

no test coverage detected