Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

toJson produces odd result if setRowKey is used on an existing field which is not an index #188

@StephanWald

Description

@StephanWald
use com.basiscomponents.db.ResultSet
use com.basiscomponents.db.DataRow
rs! = new ResultSet()
row! = DataRow.fromJson("{""NAME"":""Duck"",""FIRSTNAME"":"""",""Cartoon"":""Mickey Mouse""}")
row!.setRowKey("NAME")
rs!.add(row!)
? rs!.toJson(1,"NAME")

Output:

[{"NAME":"NAME","NAME":"Duck","FIRSTNAME":"","Cartoon":"Mickey Mouse","meta":{"N
AME":{"ColumnType":"12"},"NAME":{"ColumnType":"12"},"FIRSTNAME":{"ColumnType":"1
2"},"Cartoon":{"ColumnType":"12"}}}]

We should probably

  • throw an error if toJson is given a field name which exists but is not the only index field in the record
  • ignore it in this particular case, so the field is not added twice

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions