Skip to content

Update with positional parameters on embedded databases #8563

@mjoa

Description

@mjoa

OrientDB Version: 3.0.7 (embedded)

Java Version: 1.8

OS: macOS 10.13

Expected behavior

Actual behavior

If an update with positional parameters is executed on an embedded in-memory database the updated record can't be found after the update. The update count returned in the ResultSet of the update command is correct, but a distinct select statement afterwards returns an empty ResultSet.

It seems like the in-memory database takes some damage cause we had some strange effects in other unit tests running against the same in-memory database instance. Creating a new instance for each test isolated the problem.

This does not affect stand-alone instances (tested with 3.0.5) or updates with named parameters.

Steps to reproduce

Create an item in a embedded in-memory database, fire an update command with positional parameters and try to select the updated record again.

try (ODatabaseSession session = dbPool.acquire()) {
    session.command("UPDATE MyVertex SET property = ? WHERE id = ?", "value", id).close();
    try (OResultSet rs = session.query("SELECT FROM MyVertex WHERE id = ?", id)) {
        if (rs.hasNext()) {
            ... 
        }
    }
}

However, the record can still be found including the * projection but I guess it just hides the problem somehow as it affected other statements on the same database instance.

// select with projection still works
try (OResultSet rs = session.query("SELECT * FROM MyVertex WHERE id = ?", id)) {
    if (rs.hasNext()) {
        ...
    }
}

Attached is a small unit test to reproduce at least the main effect.
orientdb-embedded-test.zip

Metadata

Metadata

Labels

buglegacy not used anymore

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions