Skip to content

Commit

Permalink
Merge pull request #232 from gramian/main
Browse files Browse the repository at this point in the history
Miscellaneous Fixes
  • Loading branch information
lvca authored Jan 4, 2024
2 parents 77ec68b + ea7b1b9 commit 0d1c99d
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/main/asciidoc/api/chapter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
The power of a Multi-Model database is also in the way you can interact with it.
ArcadeDB supports multiple languages, so it's easier to use it coming from other DBMS.

[cols=8]
[cols="h,1,1,1,1,1,1,1",options="header"]
|===
|
|<<Java-API,JVM Embedded API>>
Expand Down
6 changes: 3 additions & 3 deletions src/main/asciidoc/api/http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ This is for example the case in the data argument (`-d`) of POST requests.
==== Server-Side Transactions

ArcadeDB implements server-side transaction over HTTP stateless protocol by using sessions.
A session is created with the <<HTTP-Begin,/begin>> command and returns a session id in the response header (example `arcadedb-session-id: AS-ee056170-dc9b-4956-8d71-d7cfa01900d4`).
Use the session id in the request header of further commands you want to execute in the same transaction and execute <<HTTP-Commit,/commit>> to commit the server side transaction or <<HTTP-Rollback,/rollback>> to rollback the changes.
A session is created with the <<HTTP-Begin,/begin>> request and returns a session id in the response header (example `arcadedb-session-id: AS-ee056170-dc9b-4956-8d71-d7cfa01900d4`).
Use the session id in the request header of further commands you want to execute in the same transaction and request <<HTTP-Commit,/commit>> to commit the server side transaction or <<HTTP-Rollback,/rollback>> to rollback the changes.
After a period of inactivity (default is 30 seconds, see <<Settings,`server.httpTxExpireTimeout`>>), the server automatically rolls back and purges expired transactions.

[discrete]
==== Transaction Scripts

In case <<SQL,SQL>> (`sql`) is supposed to be used as language for a transactions, the language variant "SQL script" (`sqlscript`) is also available.
In case <<SQL,SQL>> (`sql`) is supposed to be used as language for a transactions, the language variant <<SQL-Script,SQL Script>> (`sqlscript`) is also available.
A `sqlscript` can consist of one or multiple SQL statements, which is collectively treated as a transaction.
Hence, for such a batch of SQL statements, no `begin` and `commit` commands are necessary, since `begin` and `commit` implicitly enclose any `sqlscript` command.

Expand Down
4 changes: 2 additions & 2 deletions src/main/asciidoc/appendix/sql-syntax.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This page lists all the details about its syntax.
[[SQL-Comments]]
**Comments**

Comments in the ArcadeDB SQL scripts can be C-Style block comments, which are enclosed by `/*` and `*/`,
Comments in the ArcadeDB SQL scripts can be C-Style block comments, which are enclosed by `+/*+` and `+*/+`,

```SQL
/* This is a single-line comment */
Expand All @@ -18,7 +18,7 @@ Comments in the ArcadeDB SQL scripts can be C-Style block comments, which are en
line comment */
```
as well as classic SQL end of line comments, started by ``-- `` (note the space after the two dashes),
as well as classic SQL end of line comments, started by ``--{nbsp}`` (note the space after the two dashes),
```SQL
SELECT true; -- This is an end of line comment
Expand Down
80 changes: 40 additions & 40 deletions src/main/asciidoc/sql/SQL-Where.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ And `item` can be:
[%header,cols=3]
|===
|**What**|**Description**|**Example**
|field|Document field|where _price_ &gt; 1000000
|field&lt;indexes&gt;|Document field part. To know more about field part look at the full syntax: <<SQL-Bracket,Document-API-Property>>|where tags[name='Hi'] or tags[0...3] IN ('Hello') and employees IS NOT NULL
|record attribute|Record attribute name with @ as prefix|where _@type_ = 'Profile'
|field|Document field|`+WHERE price > 1000000+`
|field&lt;indexes&gt;|Document field part. To know more about field part look at the full syntax: <<SQL-Bracket,Document-API-Property>>|`+WHERE tags[name='Hi'] OR tags[0...3] IN ('Hello') AND employees IS NOT NULL+`
|record attribute|Record attribute name with `+@+` as prefix|`+WHERE @type = 'Profile'+`
// |any()|Represents any field of the Document. The condition is true if ANY of the fields matches the condition|where _any()_ like 'L%'
// |all()|Represents all the fields of the Document. The condition is true if ALL the fields match the condition|where _all()_ is null
| <<SQL-Functions,Functions>> |Any <<SQL-Functions,Function>> between the defined ones|where distance(x, y, 52.20472, 0.14056 ) &lt;= 30
|<<Filtering,$variable>>|Context variable prefixed with $|where $depth &lt;= 3
| <<SQL-Functions,Functions>> |Any <<SQL-Functions,Function>> between the defined ones|`+WHERE distance(x, y, 52.20, 0.14) <= 30+`
|<<Filtering,$variable>>|Context variable prefixed with `+$+`|`+WHERE $depth <= 3+`
|===

[discrete]
Expand All @@ -36,10 +36,10 @@ And `item` can be:
[%header,cols=3]
|===
|Name|Description|Example
|`@this`|returns the record itself|select *@this.toJSON()* from Account
|`@rid`|returns the <<RID,RID>> in the form &lt;bucket:position&gt;. It's null for embedded records. _NOTE: using @rid in where condition slow down queries. Much better to use the <<RID,RID>> as target. Example: change this: select from Profile where @rid = #10:44 with this: select from #10:44 |**@rid** = #11:0
|`@size`|returns the record size in bytes|**@size** &gt; 1024
|`@type`|returns the record type between: 'document', 'column', 'flat', 'bytes'|**@type** = 'flat'
|`+@this+`|returns the record itself|`+SELECT @this.toJSON() FROM Account+`
|`+@rid+`|returns the <<RID,RID>> in the form `+bucket:position&gt;+`. It is null for embedded records. _NOTE:_ using `+@rid+` in a where condition slows down queries. Much better to use the <<RID,RID>> as target. Example: change `+SELECT FROM Profile WHERE @rid = #10:44+` to `+SELECT FROM #10:44+` |`+@rid = #11:0+`
|`+@size+`|returns the record size in bytes|`+@size > 1024+`
|`+@type+`|returns the record type between: 'document', 'column', 'flat', 'bytes'|`+@type = 'flat'+`
|===

[discrete]
Expand All @@ -53,26 +53,26 @@ And `item` can be:
[%header,cols=4]
|===
|Apply to|Operator|Description|Example
|any|`=` or `==`|Equal to|name *=* 'Luke'
|any|`+<=>+`|Null-safe equal to, is also true if left and right operands are `null`|name *+<=>+* word
|string|LIKE|Similar to equals, but allows the wildcards '%' that means "any characters" and '?' that means "any single character". LIKE is case sensitive.|name _LIKE_ 'Luk%'
|string|ILIKE|Similar to LIKE, but ILIKE is case insensitive.|name _ILIKE_ 'lUk%'
|any|`&lt;`|Less than|age *&lt;* 40
|any|`&lt;=`|Less or equal to|age *&lt;=* 40
|any|`&gt;`|Greater than|age *&gt;* 40
|any|`&gt;=`|Greater or equal to|age *&gt;=* 40
|any|`&lt;&gt;` or `!=`|Not equal to|age *&lt;&gt;* 40
|any|BETWEEN|The value is between a range. It's equivalent to &lt;field&gt; &gt;= &lt;from-value&gt; AND &lt;field&gt; &lt;= &lt;to-value&gt;|price _BETWEEN_ 10 and 30
|any|IS|Used to test if a value is NULL|children _IS_ null
|record, string (as type name)|INSTANCEOF|Used to check if the record extends a type|@this _INSTANCEOF_ 'Customer' or @type _INSTANCEOF_ 'Provider'
|collection|IN|contains any of the elements listed|name _IN_ ['European','Asiatic']
|collection|CONTAINS|true if the collection contains at least one element that satisfy the next condition. Condition can be a single item: in this case the behaviour is like the IN operator|children _CONTAINS_ (name = 'Luke') - map.values() _CONTAINS_ (name = 'Luke')
|collection|CONTAINSALL|true if all the elements of the collection satisfy the next condition|children _CONTAINSALL_ (name = 'Luke')
|collection|CONTAINSANY|true if any the elements of the collection satisfy the next condition|children _CONTAINSANY_ (name = 'Luke')
|map|CONTAINSKEY|true if the map contains at least one key equals to the requested. You can also use map.keys() CONTAINS in place of it|connections _CONTAINSKEY_ 'Luke'
|map|CONTAINSVALUE|true if the map contains at least one value equals to the requested. You can also use map.values() CONTAINS in place of it|connections _CONTAINSVALUE_ 10:3
|string|CONTAINSTEXT| When used against an indexed field, a lookup in the index will be performed with the text specified as key. When there is no index a simple Java indexOf will be performed. So the result set could be different if you have an index or not on that field |text _CONTAINSTEXT_ 'jay'
|string|MATCHES|Matches the string using a http://www.regular-expressions.info/[Regular Expression]|text _MATCHES_ `\b[A-Z0-9.%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b`
|any|`+=+` or `+==+`|Equal to|`+name = 'Luke'+`
|any|`+<=>+`|Null-safe equal to, is also true if left and right operands are `+NULL+`|`+name <=> word+`
|string|`+LIKE+`|Similar to equals, but allows the wildcards '`+%+`' that means "any characters" and '`+?+`' that means "any single character". `+LIKE+` is case sensitive.|`+name LIKE 'Luk%'+`
|string|`+ILIKE+`|Similar to `+LIKE+`, but `+ILIKE+` is case insensitive.|`+name ILIKE 'lUk%'+`
|any|`+<+`|Less than|`+age < 40+`
|any|`+<=+`|Less or equal to|`+age <= 40+`
|any|`+>+`|Greater than|`+age > 40+`
|any|`+>=+`|Greater or equal to|`+age >= 40+`
|any|`+<>+` or `+!=+`|Not equal to|`+age <> 40+`
|any|`+BETWEEN+`|The value is between a range. It's equivalent to `+<field> >= <from-value> AND <field> <= <to-value>+`|`+price BETWEEN 10 AND 30+`
|any|`+IS+`|Used to test if a value is `+NULL+`|`+children IS NULL+`
|record, string (as type name)|`+INSTANCEOF+`|Used to check if the record extends a type|`+@this INSTANCEOF 'Customer' OR @type INSTANCEOF 'Provider'+`
|collection|`+IN+`|contains any of the elements listed|`+name IN ['European','Asiatic']+`
|collection|`+CONTAINS+`|true if the collection contains at least one element that satisfy the next condition. Condition can be a single item: in this case the behaviour is like the `+IN+` operator|`+children CONTAINS (name = 'Luke') - map.values() CONTAINS (name = 'Luke')+`
|collection|`+CONTAINSALL+`|true if all the elements of the collection satisfy the next condition|`+children CONTAINSALL (name = 'Luke')+`
|collection|`+CONTAINSANY+`|true if any the elements of the collection satisfy the next condition|children CONTAINSANY (name = 'Luke')+`
|map|`+CONTAINSKEY+`|true if the map contains at least one key equals to the requested. You can also use `+map.keys() CONTAINS+` in place of it|`+connections CONTAINSKEY 'Luke'+`
|map|`+CONTAINSVALUE+`|true if the map contains at least one value equals to the requested. You can also use `+map.values() CONTAINS+` in place of it|`+connections CONTAINSVALUE 10:3+`
|string|`+CONTAINSTEXT+`| When used against an indexed field, a lookup in the index will be performed with the text specified as key. When there is no index a simple Java `+indexOf+` will be performed. So the result set could be different if you have an index or not on that field |`+text CONTAINSTEXT 'jay'+`
|string|`+MATCHES+`|Matches the string using a http://www.regular-expressions.info/[Regular Expression]|`pass:[text MATCHES `\b[A-Z0-9.%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b`]`
|===

[discrete]
Expand All @@ -82,9 +82,9 @@ And `item` can be:
[%header,cols=3]
|===
|Operator|Description|Example
|AND|true if both the conditions are true|name = 'Luke' *and* surname like 'Sky%'
|OR|true if at least one of the condition is true|name = 'Luke' *or* surname like 'Sky%'
|NOT|true if the condition is false. NOT needs parenthesis on the right with the condition to negate|**not** ( name = 'Luke')
|AND|true if both the conditions are true|`+name = 'Luke' AND surname LIKE 'Sky%'+`
|OR|true if at least one of the condition is true|`+name = 'Luke' OR surname LIKE 'Sky%'+`
|NOT|true if the condition is false. `+NOT+` needs parenthesis on the right with the condition to negate|`+NOT (name = 'Luke')+`
|===

[discrete]
Expand Down Expand Up @@ -116,12 +116,12 @@ ArcadeDB supports variables managed in the context of the command/query. By defa
[%header,cols=3]
|===
|Name |Description |Command(s)
|`$parent`|Get the parent context from a sub-query. Example: `select from V let $type = ( traverse * from $parent.$current.children )`|<<SQL-Select,SELECT>> and <<SQL-Traverse,TRAVERSE>>
|`$current`|Current record to use in sub-queries to refer from the parent's variable|<<SQL-Select,SELECT>> and <<SQL-Traverse,TRAVERSE>>
|`$depth`|The current depth of nesting|<<SQL-Traverse,TRAVERSE>>
|`$path`|The string representation of the current path. Example: `#6:0.in.#5:0#.out`. You can also display it with `select $path from (traverse * from V)`|<<SQL-Traverse,TRAVERSE>>
|`$stack`|The List of operation in the stack. Use it to access to the history of the traversal|<<SQL-Traverse,TRAVERSE>>
|`$history`|The set of all the records traversed as a `Set&lt;RID&gt;`|<<SQL-Traverse,TRAVERSE>>
|`+$parent+`|Get the parent context from a sub-query. Example: `+SELECT FROM V LET $type = (TRAVERSE * FROM $parent.$current.children)+`|<<SQL-Select,SELECT>> and <<SQL-Traverse,TRAVERSE>>
|`+$current+`|Current record to use in sub-queries to refer from the parent's variable|<<SQL-Select,SELECT>> and <<SQL-Traverse,TRAVERSE>>
|`+$depth+`|The current depth of nesting|<<SQL-Traverse,TRAVERSE>>
|`+$path+`|The string representation of the current path. Example: `+#6:0.in.#5:0#.out+`. You can also display it with `+SELECT $path FROM (TRAVERSE * FROM V)+`|<<SQL-Traverse,TRAVERSE>>
|`+$stack+`|The List of operation in the stack. Use it to access to the history of the traversal|<<SQL-Traverse,TRAVERSE>>
|`+$history+`|The set of all the records traversed as a `+Set<RID>+`|<<SQL-Traverse,TRAVERSE>>
|===

To set custom variable use the <<SQL-LET,LET>> keyword.
Expand All @@ -133,8 +133,8 @@ To set custom variable use the <<SQL-LET,LET>> keyword.
[%header,cols=3]
|===
|Symbol |Description |Example
|`%` |Matches all strings that contain an unknown substring of any length at the position of `%` |"%DB" "A%DB" "Arcade%" all match "ArcadeDB"
|`?` |Matches all strings that contain an unknown character at the position of `?` |"N?SQL" matches "NoSQL" but not "NewSQL"
|`+%+` |Matches all strings that contain an unknown substring of any length at the position of `+%+` |"%DB" "A%DB" "Arcade%" all match "ArcadeDB"
|`+?+` |Matches all strings that contain an unknown character at the position of `+?+` |"N?SQL" matches "NoSQL" but not "NewSQL"
|===

Filtering for strings containing wildcards characters can be done by escaping with backslash, i.e. `\%`, `\?`.
4 changes: 2 additions & 2 deletions src/main/asciidoc/tools/console.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The console supports these direct commands (not evaluated by the query engine):
| Database | CREATE DATABASE | DROP DATABASE | CHECK DATABASE
| Schema | INFO TYPES | INFO TYPE | INFO TRANSACTION
| Transaction | BEGIN | COMMIT | ROLLBACK
| Scripting | SET LANGUAGE | LOAD | `--` (COMMENT)
| Scripting | SET LANGUAGE | LOAD | `--` (Comment)
|===

for which you can retrieve the following help by typing `HELP` or just `?`:
Expand All @@ -37,7 +37,7 @@ close |<path>|remote:<url> <user> <pw> -> closes the dat
commit -> commits current transaction
connect <path>|local:<url>|remote:<url> <user> <pw> -> connects to a database
create database <path>|remote:<url> <user> <pw> -> creates a new database
create user <user> identified by <pw> [grant connect to <db>*] -> creates a user
create user <user> identified by <pw> [grant connect to <db>[:<group>]*] -> creates a user
drop database <path>|remote:<url> <user> <pw> -> deletes a database
drop user <user> -> deletes a user
help|? -> ask for this help
Expand Down
2 changes: 1 addition & 1 deletion src/main/asciidoc/tools/upgrade.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The migration is completely automatic and transparent.
==== Steps

1. Download and extract a newer version of ArcadeDB in the local file system
2. Stop any ArcadeDB running servers (or close manually the database by using the HTTP command <<HTTP-CloseDatabase>>).
2. Stop any ArcadeDB running servers (or close manually the database by using the HTTP command "<<HTTP-ServerCommand,close database>>").
3. Copy the databases directory from the old server to the new one
4. Start the new server

Expand Down
2 changes: 1 addition & 1 deletion src/main/asciidoc/version.adoc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
:revnumber: 23.11.1
:revnumber: 23.12.1

0 comments on commit 0d1c99d

Please sign in to comment.