2016-10-06 10 views
0

OrientDB StudioでSQLクエリの異常な動作が検出されました(これはRESTプロトコルでも繰り返されます)。Orientdb quote in SQL query

select * from name 

結果:

プロパティは、姓と名のテキストフィールドです
{ 
    "result": [ 
     { 
      "@type": "d", 
      "@rid": "#25:0", 
      "@version": 1, 
      "@class": "name", 
      "surname": "foo surname", 
      "name": "foo name" 
     }, 
     { 
      "@type": "d", 
      "@rid": "#26:0", 
      "@version": 1, 
      "@class": "name", 
      "surname": "bar surname", 
      "name": "bar name" 
     }, 
     { 
      "@type": "d", 
      "@rid": "#27:0", 
      "@version": 1, 
      "@class": "name", 
      "surname": "O'brien", 
      "name": "baz" 
     } 
    ], 
    "notification": "Query executed in 0.069 sec. Returned 3 record(s)" 
} 

私のサーバーバージョンは、私のクラスでは2.2.5

データです。

私はStudioでいくつかのSQLクエリを作成:

select * from name WHERE surname='O\'brien' 

結果:良い作品

{ 
"result": [ 
    { 
     "@type": "d", 
     "@rid": "#27:0", 
     "@version": 1, 
     "@class": "name", 
     "surname": "O'brien", 
     "name": "baz" 
     } 
    ], 
"notification": "Query executed in 0.016 sec. Returned 1 record(s)" 

}

を。

次へ

select * from name WHERE NOT (surname='O\'brien') 

結果:私は予期しない第三の結果が得られた。この場合

{ 
"result": [ 
    { 
     "@type": "d", 
     "@rid": "#25:0", 
     "@version": 1, 
     "@class": "name", 
     "surname": "foo surname", 
     "name": "foo name" 
    }, 
    { 
     "@type": "d", 
     "@rid": "#26:0", 
     "@version": 1, 
     "@class": "name", 
     "surname": "bar surname", 
     "name": "bar name" 
    }, 
    { 
     "@type": "d", 
     "@rid": "#27:0", 
     "@version": 1, 
     "@class": "name", 
     "surname": "O'brien", 
     "name": "baz" 
    } 
], 
"notification": "Query executed in 0.015 sec. Returned 3 record(s)" 

}

次へ:

select * from name WHERE (NOT (surname='bar surname')) 

結果:

{ 
    "result": [ 
     { 
      "@type": "d", 
      "@rid": "#25:0", 
      "@version": 1, 
      "@class": "name", 
      "surname": "foo surname", 
      "name": "foo name" 
     }, 
     { 
      "@type": "d", 
      "@rid": "#27:0", 
      "@version": 1, 
      "@class": "name", 
      "surname": "O'brien", 
      "name": "baz" 
     } 
    ], 
    "notification": "Query executed in 0.017 sec. Returned 2 record(s)" 
} 

は正常に見えます。

次へ:

select * from name WHERE (NOT (surname='O\'brien')) 

結果:

java.lang.NullPointerException 

次へ:

select * from name WHERE (surname='O\'brien') 

結果:

Empty result 

私の質問 - バグか、何か間違っていますか?

これらのクエリはクエリビルダーの一部であるため、OrientDBの括弧の働きを理解する必要があります。

ありがとうございました。

+0

は、あなたが最新バージョンでそれを試すことができますか?それが持続するならgithubで問題を開くことができます。 –

+0

はい、私は2.2.12-SNAPSHOTのgithubで問題を再現しました - https://github.com/orientechnologies/orientdb/issues/6786 – Montekidlo

答えて

0

ODB ver2.2.12

使用引用の異なる種類。

私のデータ:

select from V

{ 
    "result": [ 
     { 
      "@type": "d", 
      "@rid": "#9:0", 
      "@version": 1, 
      "@class": "V", 
      "name": "O'Brian" 
     }, 
     { 
      "@type": "d", 
      "@rid": "#10:0", 
      "@version": 1, 
      "@class": "V", 
      "name": "Pippo" 
     } 
    ], 
    "notification": "Query executed in 0.013 sec. Returned 2 record(s)" 
} 

select from V where NOT (name = "O'Brian")

{ 
    "result": [ 
     { 
      "@type": "d", 
      "@rid": "#10:0", 
      "@version": 1, 
      "@class": "V", 
      "name": "Pippo" 
     } 
    ], 
    "notification": "Query executed in 0.023 sec. Returned 1 record(s)" 
} 
+0

はい、うまくいきますが、質問で二重引用符を使用したい場合はまだ動作しません: – Montekidlo

+0

select * from foo NOT(name = "Bar \" Baz ") – Montekidlo