int i = 0;
const char* lcontext = NULL;
while ( (lcontext = osrfStringArrayGetString(local_context, i++)) ) {
- jsonObject* ctx_obj = oilsFMGetObject( param, lcontext );
+ const jsonObject* ctx_obj = oilsFMGetObject( param, lcontext );
if ( ctx_obj->type == JSON_ARRAY ) { // it's a primitive-fleshed array
- for (int cind = 0; cind < ctx_obj->size; cind++) {
+ int cind;
+ for (cind = 0; cind < ctx_obj->size; cind++) {
osrfStringArrayAdd(
context_org_array,
jsonObjectToSimpleString( jsonObjectGetIndex(ctx_obj, cind) )
osrfStringArray* ctx_array = osrfHashGet( fcontext, "context" );
while ( (foreign_field = osrfStringArrayGetString(ctx_array, j++)) ) {
- jsonObject* ctx_obj = oilsFMGetObject( _fparam, foreign_field );
+ const jsonObject* ctx_obj = oilsFMGetObject( _fparam, foreign_field );
if ( ctx_obj->type == JSON_ARRAY ) { // it's a primitive-fleshed array
- for (int cind = 0; cind < ctx_obj->size; cind++) {
+ int cind;
+ for (cind = 0; cind < ctx_obj->size; cind++) {
osrfStringArrayAdd(
context_org_array,
jsonObjectToSimpleString( jsonObjectGetIndex(ctx_obj, cind) )
buffer_add( val_buf, "ARRAY[" );
const char* ftype = get_datatype( field );
- for (int vind = 0; vind < field_object->size; vind++) {
+ int vind;
+ for (vind = 0; vind < field_object->size; vind++) {
char* vstr = jsonObjectToSimpleString( jsonObjectGetIndex(field_object, vind) );
if ( !( !strncmp( ftype, "I", 1) || !strncmp( ftype, "N", 1) ) ) { // it's text-y, quote it
if ( !dbi_conn_quote_string( writehandle, &vstr ) ) {
return -1;
}
}
- if (cind > 0) OSRF_BUFFER_ADD_CHAR( val_buf, ',' );
+ if (vind > 0) OSRF_BUFFER_ADD_CHAR( val_buf, ',' );
buffer_add( val_buf, vstr );
free(vstr);
}
buffer_fadd( sql, " %s = ARRAY[", field_name );
const char* ftype = get_datatype( field_def );
- for (int vind = 0; vind < field_object->size; vind++) {
+ int vind;
+ for (vind = 0; vind < field_object->size; vind++) {
char* vstr = jsonObjectToSimpleString( jsonObjectGetIndex(field_object, vind) );
if ( !( !strncmp( ftype, "I", 1) || !strncmp( ftype, "N", 1) ) ) { // it's text-y, quote it
if ( !dbi_conn_quote_string( writehandle, &vstr ) ) {
return -1;
}
}
- if (cind > 0) OSRF_BUFFER_ADD_CHAR( sql, ',' );
+ if (vind > 0) OSRF_BUFFER_ADD_CHAR( sql, ',' );
buffer_add( sql, vstr );
free(vstr);
}
// Turn it into a JSON text array
osrfLogDebug( OSRF_LOG_MARK, "Building SQL to pull apart an array" );
+ jsonObject* unnest_list = jsonNewObjectType( JSON_ARRAY );
if( dbi_conn_quote_string( dbhandle, &array_string )) {
jsonObject* unnest_field = jsonNewObjectFmt( "{'from':['unnest',%s]}", array_string );
if( unnest_result ) {
unsigned short unnest_type = dbi_result_get_field_type_idx( unnest_result, 1 );
int unnest_attr = dbi_result_get_field_attribs_idx( unnest_result, 1 );
- jsonObject* unnest_list = jsonNewObjectType( JSON_ARRAY );
if( dbi_result_first_row( unnest_result ) ) {
if( dbi_result_field_is_null_idx( result, columnIndex )) {
jsonObjectSetIndex( object, fmIndex, jsonNewObject( NULL ));
- } else if( !strcmp( get_primitive( field ), "array" )) {
+ } else if( !strcmp( get_primitive( _f ), "array" )) {
char* array_string = dbi_result_get_string_copy_idx( result, columnIndex );
jsonObjectSetIndex( object, fmIndex, oilsUnnestArray(array_string) );
free( array_string );