Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with positional parameters on embedded databases #8563

Closed
mjoa opened this issue Sep 25, 2018 · 2 comments
Closed

Update with positional parameters on embedded databases #8563

mjoa opened this issue Sep 25, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@mjoa
Copy link

mjoa commented Sep 25, 2018

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

@luigidellaquila luigidellaquila self-assigned this Sep 25, 2018
@luigidellaquila
Copy link
Member

Hi @mjoa

I think I found the problem, I'm fixing it now

Thanks

Luigi

@luigidellaquila luigidellaquila added this to the 3.0.8 milestone Sep 25, 2018
luigidellaquila added a commit that referenced this issue Sep 25, 2018
@mjoa
Copy link
Author

mjoa commented Sep 25, 2018

Thanks @luigidellaquila for your support and again a very quick solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants