question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

delete binary records via sql problem in 2.1.15

See original GitHub issue

Dear @luigidellaquila based on https://github.com/orientechnologies/orientdb/issues/5748 I’d tested it now in 2.1.15 when i was try to delete via delete from 15:0 command everything works well 👍

but when i was trying to delete record from a select that contains a linked field that contains row id of my blobs , delete not working yet : delete from (select Blob from FileItem) also when i try to write another kind query does not working and returns error delete from cluster:BlobStorage where @rid in (select Blob from FileItem) returns : java.lang.ClassCastException: com.orientechnologies.orient.core.record.impl.ORecordBytes cannot be cast to com.orientechnologies.orient.core.record.impl.ODocument

for clearing what was happened i tried to run select @rid from cluster:BlobStorage that returns nothing but when i run select from cluster:BlobStorage returns a binary record that have @ rid and @ version and a base64 encoded string field . i’m wondered now . is it a new bug ?

how can i delete binary record via a nested select where query ? please help me to write a true delete statement .

at the last : Actually i have an opinion for select from Binary Record in Select Command . *it’s better select from blobstorage returns record id and record bytes size for binary records . now select from blobstorage (binary records) returns nothing *

thnaks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
luigidellaquilacommented, Aug 5, 2016

Hi @saeedtabrizi

I just tried this on 2.2.x branch (but I think nothing changed since 2.2.6)

 @Test
  public void testBinaryClusterSelect3() {
    database.command(new OCommandSQL("create class testBinaryClusterSelect3")).execute();
    database.command(new OCommandSQL("create blob cluster testBinaryClusterSelect3_blob")).execute();
    database.reload();
    OBlob bytes = new ORecordBytes(new byte[]{1,2,3});
    database.save(bytes, "testBinaryClusterSelect3_blob");

    ODocument doc = new ODocument("testBinaryClusterSelect3");
    doc.field("Blob", bytes);
    doc.save();

    ODocument doc2 = new ODocument("testBinaryClusterSelect3");
    doc2.save();

    List<OIdentifiable> result = database.query(
        new OSQLSynchQuery<OIdentifiable>("select from cluster:testBinaryClusterSelect3_blob"));

    Assert.assertEquals(result.size(), 1);

    database.command(new OCommandSQL("delete from (select expand(Blob) from testBinaryClusterSelect3)")).execute();
    result = database.query(
        new OSQLSynchQuery<OIdentifiable>("select from cluster:testBinaryClusterSelect3_blob"));

    Assert.assertEquals(result.size(), 0);
  }

And it succeeds.

Which 2.2 are you using? Did you try with latest stable?

Thanks

Luigi

1reaction
tglmancommented, May 25, 2016

closing this, if there are some more issue please reopen

Read more comments on GitHub >

github_iconTop Results From Across the Web

delete binary records via sql problem #5748 - GitHub
My Scenario is : ODB : 2.1.11,. Create Class BlobStorage. ... Select From BlobStorage returns nothing (i recommend return size and rid of...
Read more >
Overview of the SQL Delete statement - SQLShack
To remove a row from a table is accomplished through a Data Manipulation Language, aka DML statement, using the delete keyword. The SQL...
Read more >
MySQL Sample Databases
If a record having a particular key-value from the parent table (employees and departments) is deleted, all the records in this child table...
Read more >
DELETE - Oracle Help Center
Purpose. Use the DELETE statement to remove rows from: An unpartitioned or partitioned table. The unpartitioned or partitioned base table of a view....
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found