lib/framework/rhom/rhom_object_factory.rb in rhodes-3.3.5 vs lib/framework/rhom/rhom_object_factory.rb in rhodes-3.4.2

- old
+ new

@@ -1208,10 +1208,11 @@ return unless is_sync_source() nSrcID = get_source_id() db_partition = Rho::RhoConfig.sources[get_source_name]['partition'].to_s tableName = is_schema_source() ? get_schema_table_name : 'object_values' + is_full_update = Rho::RhoConfig.sources[get_source_name]['full_update'] db = ::Rho::RHO.get_src_db(get_source_name) db.start_transaction begin @@ -1224,20 +1225,29 @@ end end else objects.each do |obj, values| - values['attributes'].each do |attrib, value| - resUpdateType = db.select_from_table('changed_values', 'update_type', - {"object"=>obj, "source_id"=>nSrcID, "attrib"=>attrib, 'sent'=>0}) - next if resUpdateType && resUpdateType.length > 0 - - attrib_type = SyncEngine.is_blob_attr(db_partition, nSrcID,attrib) ? "blob.file" : "" - db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>attrib, - "value"=>value, "update_type"=>'update', "attrib_type"=>attrib_type }) - end - end + #if is_full_update + # resUpdateType = db.select_from_table('changed_values', 'update_type', {"object"=>obj, "source_id"=>nSrcID, 'sent'=>0}) + # + # unless resUpdateType && resUpdateType.length > 0 + # db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>'object', "value"=>"", "update_type"=>'update'}) + # end + #else + + values['attributes'].each do |attrib, value| + resUpdateType = db.select_from_table('changed_values', 'update_type', + {"object"=>obj, "source_id"=>nSrcID, "attrib"=>attrib, 'sent'=>0}) + next if resUpdateType && resUpdateType.length > 0 + + attrib_type = SyncEngine.is_blob_attr(db_partition, nSrcID,attrib) ? "blob.file" : "" + db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>attrib, + "value"=>value, "update_type"=>'update', "attrib_type"=>attrib_type }) + end + #end + end end db.commit rescue Exception => e puts 'on_sync_update_error Exception: ' + e.inspect @@ -1590,16 +1600,16 @@ if is_inst_sync_source() resUpdateType = db.select_from_table('changed_values', 'update_type', {"object"=>obj, "source_id"=>nSrcID, 'sent'=>0}) update_type = resUpdateType[0]['update_type'] if resUpdateType && resUpdateType.length > 0 ignore_changed_values = update_type=='create' - if is_inst_full_update - unless resUpdateType && resUpdateType.length > 0 - db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>'object', "value"=>"", "update_type"=>update_type}) - end - ignore_changed_values = update_type=='update' - end + #if is_inst_full_update + # unless resUpdateType && resUpdateType.length > 0 + # db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>'object', "value"=>"", "update_type"=>update_type}) + # end + # ignore_changed_values = update_type=='update' + #end end self.vars.each do |key_a,value| key = key_a.to_s next if ::Rhom::RhomObject.method_name_reserved?(key) @@ -1622,23 +1632,23 @@ if resValue && resValue.length > 0 isModified = false - if is_inst_full_update - isModified = true - else + #if is_inst_full_update + # isModified = true + #else oldValue = isSchemaSrc ? resValue[0][key] : resValue[0]['value'] isModified = oldValue != val if isModified && val && oldValue.nil? && val.to_s().length == 0 isModified = false end if isModified && oldValue && val.nil? && oldValue.to_s().length == 0 isModified = false end - end + #end if isModified unless ignore_changed_values resUpdateType = db.select_from_table('changed_values', 'update_type', {"object"=>obj, "attrib"=>key, "source_id"=>nSrcID, 'sent'=>0}) @@ -1722,15 +1732,15 @@ if is_inst_sync_source() resUpdateType = db.select_from_table('changed_values', 'update_type', {"object"=>obj, "source_id"=>nSrcID, 'sent'=>0}) update_type = resUpdateType[0]['update_type'] if resUpdateType && resUpdateType.length > 0 ignore_changed_values = update_type=='create' - if is_inst_full_update - unless resUpdateType && resUpdateType.length > 0 - db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>'object', "value"=>"", "update_type"=>update_type}) - end - ignore_changed_values = update_type=='update' - end + #if is_inst_full_update + # unless resUpdateType && resUpdateType.length > 0 + # db.insert_into_table('changed_values', {"source_id"=>nSrcID, "object"=>obj, "attrib"=>'object', "value"=>"", "update_type"=>update_type}) + # end + # ignore_changed_values = update_type=='update' + #end end attrs.each do |attrib,val| attrib = attrib.to_s.gsub(/@/,"") next if ::Rhom::RhomObject.method_name_reserved?(attrib) \ No newline at end of file