Skip to content

Support UPDATE #5

@thiagodp

Description

@thiagodp

AFAIK, database-js-ini does not support UPDATE commands yet. One problem is probably the syntax.

Thus, I would like to suggest a syntax for that:

Update the ROOT

UPDATE ROOT SET foo = "bar"
UPDATE ROOT SET max = 1

would produce

foo=bar
max=1

only if the corresponding keys ("foo" and "max") exist.

Update a section

UPDATE `my section` SET foo = "bar"
UPDATE `my section` SET max = 1

would produce

[my section]
foo=bar
max=1

only if the section ("my section") and its corresponding keys ("foo" and "max") exist.

Update with restriction

UPDATE `my section` SET foo = "bar" WHERE foo = "zoo"
UPDATE `my section` SET max = 100, `new key` = "new value" WHERE max < 100

Note: Keys can be produced during UPDATE, like the "new key" above.

Removing a key

A key should be removed by setting its value to NULL.

UPDATE ROOT SET foo = null WHERE foo = "zoo"
UPDATE `my section` SET max = null WHERE max < 100
UPDATE `my section` SET foo = null, `other key` = null WHERE max < 100

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions