Skip to content

Problem when adding Parse, Add and Loadrecordsets #90

Open
@dtrillo

Description

@dtrillo

Hi.
I use the library adding data using Parse function, but also with the Add and LoadRecordset. the property name doesn't work as expected. Here is hoy I solved it!

I have notice some problems, that I have solved by defining my own LoadRecordset method.
`
' Load properties from an ADO RecordSet object into an array

' @param rs as ADODB.RecordSet

public sub LoadRecordSet(byref rs) ' Change 3.8.2

	LoadRecordSet2 rs, true

end sub

public sub LoadRecordSet3(byref rs) ' Change 3.8.2

	LoadRecordSet2 rs, false

end sub

public sub LoadRecordSet4(byref rs, prop_name) ' Change 3.8.2

	dim old_i

	old_i = i_defaultPropertyName

	i_defaultPropertyName = prop_name
	LoadRecordSet2 rs, true
	i_defaultPropertyName = old_i
end sub
' Load properties from an ADO RecordSet object into an array
' @param rs as ADODB.RecordSet
public sub LoadRecordSet2(byref rs, lcaseall) ' Change 3.8.2
	dim arr, obj, field
	set arr = new JSONArray
	while not rs.eof
		set obj = new JSONobject
		for each field in rs.fields
			k = field.name: if lcaseall then k = lcase(k)
			obj.Add k, field.value
		next
		arr.Push obj
		rs.movenext
	wend
	set obj = nothing
	add i_defaultPropertyName, arr
end sub`

With this 4 functions, I can get the desire outcome.
first of all, because I can assing a name to the recordset, not loosing the previous name.

I notice you have not add the feature of lowercase properties (here included).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions