From: Mike Rylander Date: Fri, 28 Mar 2014 21:25:51 +0000 (-0400) Subject: Some typo and cut-paste-o cleanup X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0e4c4eb69994d067a9600852467cc9684fa70446;p=working%2FEvergreen.git Some typo and cut-paste-o cleanup Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c index d39e7865d4..7000f1d837 100644 --- a/Open-ILS/src/c-apps/oils_sql.c +++ b/Open-ILS/src/c-apps/oils_sql.c @@ -1677,9 +1677,10 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, osrfHash *class, const js 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) ) @@ -1845,9 +1846,10 @@ static int verifyObjectPCRUD ( osrfMethodContext* ctx, osrfHash *class, const js 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) ) @@ -2264,7 +2266,8 @@ int doCreate( osrfMethodContext* ctx ) { 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 ) ) { @@ -2284,7 +2287,7 @@ int doCreate( osrfMethodContext* ctx ) { 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); } @@ -6225,7 +6228,8 @@ int doUpdate( osrfMethodContext* ctx ) { 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 ) ) { @@ -6245,7 +6249,7 @@ int doUpdate( osrfMethodContext* ctx ) { return -1; } } - if (cind > 0) OSRF_BUFFER_ADD_CHAR( sql, ',' ); + if (vind > 0) OSRF_BUFFER_ADD_CHAR( sql, ',' ); buffer_add( sql, vstr ); free(vstr); } @@ -6506,6 +6510,7 @@ static jsonObject* oilsUnnestArray( char* array_string ) { // 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 ); @@ -6519,7 +6524,6 @@ static jsonObject* oilsUnnestArray( char* 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 ) ) { @@ -6682,7 +6686,7 @@ static jsonObject* oilsMakeFieldmapperFromResult( dbi_result result, osrfHash* m 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 );