forked from orientechnologies/orientdb-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to Console Commands: DECLARE INTENT, DELETE and DICTIONARY%
commands.
- Loading branch information
1 parent
9e58e39
commit 6cddef3
Showing
6 changed files
with
138 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
# Console - DECLARE INTENT | ||
# Console - `DECLARE INTENT` | ||
|
||
Declares an intent on current database. Intents are a way to tell to OrientDB what you're going to do. | ||
Declares an intent for the current database. Intents allow you to tell the database what you want to do. | ||
|
||
## Syntax | ||
**Syntax** | ||
|
||
```sql | ||
DECLARE INTENT <intent-name> | ||
``` | ||
|
||
Where: | ||
- **`<intent-name>`** Defines the name of the intent. OrientDB supports three intents: | ||
- *`NULL`* Removes the current intent. | ||
- *`MASSIVEINSERT`* | ||
- *`MASSIVEREAD`* | ||
|
||
- intent-name The name of the intent. "null" means remove the current intent. Supported ones are: | ||
- massiveinsert | ||
- massiveread | ||
**Examples** | ||
|
||
## Example | ||
- Declare an intent for a massive insert: | ||
|
||
```sql | ||
DECLARE INTENT massiveinsert | ||
``` | ||
<pre> | ||
orientdb> <code class="lang-sql userinput">DECLARE INTENT MASSIVEINSERT</code> | ||
</pre> | ||
|
||
- After the insert, clear the intent: | ||
|
||
<pre> | ||
orientdb> <code class="lang-sql userinput">DECLARE INTENT NULL</code> | ||
</pre> | ||
|
||
This is a command of the Orient console. To know all the commands go to [Console-Commands](Console-Commands.md). | ||
>For more information on other commands, see [Console Commands](Console-Commands.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
# Console - DELETE | ||
|
||
The **Delete** command deletes one or more records from the database. The set of records involved are taken by the [WHERE](SQL-Where.md) clause. | ||
Remove one or more records from the database. You can determine which records get deleted using the [`WHERE`](SQL-Where.md) clause. | ||
|
||
>NOTE: Don't use SQL DELETE to remove Vertices or Edges but use the DELETE VERTEX and DELETE EDGE commands that assure the integrity of the graph. | ||
## Syntax | ||
**Syntax** | ||
|
||
```sql | ||
DELETE FROM <Class>|cluster:<cluster>|index:<index> [LOCK <default|record>] [RETURN <returning>] | ||
[WHERE <Condition>*] [LIMIT <MaxRecords>] [TIMEOUT <timeout>] | ||
DELETE FROM <target-name> [LOCK <lock-type>] [RETURN <return-type>] | ||
[WHERE <condition>*] [LIMIT <MaxRecords>] [TIMEOUT <timeout-value>] | ||
``` | ||
|
||
Where: | ||
- **LOCK** specifies how the record is locked between the load and the delete. It can be a value between: | ||
- *DEFAULT*, no lock. In case of concurrent delete, the MVCC throws an exception | ||
- *RECORD*, locks the record during the delete | ||
- **RETURN** specifies what to return. It can be a value between: | ||
- **COUNT**, the default, returns the number of deleted records | ||
- **BEFORE**, returns the records before the delete | ||
- WHERE, [SQL-Where](SQL-Where.md) condition to select records to update | ||
- LIMIT, sets the maximum number of records to update | ||
- TIMEOUT, if any limits the update operation to a timeout | ||
- **`<target-name>`** Defines the target from which you want to delete records. Use one of the following target names: | ||
- `<class-name>` Determines what class you want to delete from. | ||
- `CLUSTER:<cluster-name>` Determines what cluster you want to delete from. | ||
- `INDEX:<index-name>` Determines what index you want to delete from. | ||
- **`LOCK <lock-type>`** Defines how the record locks between the load and deletion. It takes one of two types: | ||
- `DEFAULT` Operation uses no locks. In the event of concurrent deletions, the MVCC throws an exception. | ||
- `RECORD` Locks the record during the deletion. | ||
- **`RETURN <return-type>`** Defines what the Console returns. There are two supported return types: | ||
- `COUNT` Returns the number of deleted records. This is the default return type. | ||
- `BEFORE` Returns the records before the deletion. | ||
- [**`WHERE <condition>`**](SQL-Where.md) Defines the condition used in selecting records for deletion. | ||
- **`LIMIT`** Defines the maximum number of records to delete. | ||
- **`TIMEOUT`** Defines the time-limit to allow the operation to run before it times out. | ||
|
||
## Examples | ||
>**NOTE**: When dealing with vertices and edges, do not use the standard SQL [`DELETE`](SQL-Delete.md) command. Doing so can disrupt graph integrity. Instead, use the [`DELETE VERTEX`](SQL-Delete-Vertex.md) or the [`DELETE EDGE`](SQL-Delete-Edge.md) commands. | ||
Delete all the records with surname equals to 'unknown' ignoring the case: | ||
**Examples** | ||
|
||
```sql | ||
DELETE FROM Profile WHERE surname.toLowerCase() = 'unknown' | ||
``` | ||
- Remove all records from the class `Profile`, where the surname is unknown, ignoring case: | ||
|
||
<pre> | ||
orientdb> <code class="lang-sql userinput">DELETE FROM Profile WHERE surname.toLowerCase() = 'unknown'</code> | ||
</pre> | ||
|
||
|
||
>For more information on other commands, see [SQL Commands](SQL.md) and [Console Commands](Console-Commands.md). | ||
To know more about other SQL commands look at [SQL commands](SQL.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
# Console - DICTIONARY GET | ||
# Console - `DICTIONARY GET` | ||
|
||
Displays the value of the requested key loaded from the database dictionary. | ||
Displays the value of the requested key, loaded from the database dictionary. | ||
|
||
## Syntax | ||
**Syntax** | ||
|
||
``` | ||
```sql | ||
DICTIONARY GET <key> | ||
``` | ||
|
||
Where: | ||
- **`<key>`** Defines the key you want to access. | ||
|
||
- key The key to search | ||
|
||
## Example | ||
**Example** | ||
|
||
```sql | ||
DICTIONARY GET obama | ||
-------------------------------------------------- | ||
Class: Person id: 5:4 v.1 | ||
-------------------------------------------------- | ||
parent : null | ||
children : [Person@5:5{parent:Person@5:4,children:null,name:Malia Ann,surname:Obama,city:null}, Person@5:6{parent:Person@5:4,children:null | ||
,name:Natasha,surname:Obama,city:null}] | ||
name : Barack | ||
surname : Obama | ||
city : City@-6:2{name:Honolulu} | ||
-------------------------------------------------- | ||
``` | ||
- In a dictionary of U.S. presidents, display the entry for Barack Obama: | ||
|
||
<pre> | ||
orientdb> <code class='lang-sql userinput'>DICTIONARY GET obama</code> | ||
|
||
To know all the keys stored in the database dictionary use the [DICTIONARY KEYS](Console-Command-Dictionary-Keys.md) command. | ||
------------------------------------------------------------------------- | ||
Class: Person id: 5:4 v.1 | ||
------------------------------------------------------------------------- | ||
parent: null | ||
children : [Person@5:5{parent:Person@5:4,children:null,name:Malia Ann, | ||
surname:Obama,city:null}, Person@5:6{parent:Person@5:4, | ||
children:null,name:Natasha,surname:Obama,city:null}] | ||
name : Barack | ||
surname : Obama | ||
city : City@-6:2{name:Honolulu} | ||
------------------------------------------------------------------------- | ||
</pre> | ||
|
||
For complete index (and dictionary) guide look at [Index guide](Indexes.md). | ||
>You can display all keys stored in a database using the [`DICTIONARY KEYS`](Console-Command-Dictionary-Keys.md) command. For more information on indexes, see [Indexes](Indexes.md). | ||
This is a command of the Orient console. To know all the commands go to [Console-Commands](Console-Commands.md). | ||
>For more information on other commands, see [Console Commands](Console-Commands.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
# Console - DICTIONARY KEYS | ||
# Console - `DICTIONARY KEYS` | ||
|
||
Displays all the keys stored in the database dictionary. | ||
|
||
## Syntax | ||
**Syntax** | ||
|
||
``` | ||
DICTIONARY KEYS | ||
``` | ||
|
||
## Example | ||
**Example** | ||
|
||
```sql | ||
DICTIONARY KEYS | ||
|
||
Found 4 keys: | ||
#0: key-148 | ||
#1: key-147 | ||
#2: key-146 | ||
#3: key-145 | ||
``` | ||
- Display all the keys stored in the database dictionary: | ||
|
||
To load the associated record use the [DICTIONARY GET](Console-Command-Dictionary-Get.md) <code><key></code>. | ||
<pre> | ||
orientdb> <code class='lang-sql userinput'>DICTIONARY KEYS</code> | ||
|
||
For complete index (and dictionary) guide look at [Index guide](Indexes.md). | ||
Found 4 keys: | ||
#0: key-148 | ||
#1: key-147 | ||
#2: key-146 | ||
#3: key-145 | ||
</pre> | ||
|
||
This is a command of the Orient console. To know all the commands go to [Console-Commands](Console-Commands.md). | ||
>To load the records associated with these keys, use the [`DICTIONARY GET`](Console-Command-Dictionary-Get.md) command. For more information on indexes, see [Indexes](Indexes.md). | ||
> | ||
>For more information on other commands, see [Console Commands](Console-Commands.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
# Console - DISCTIONARY PUT | ||
# Console - `DICTIONARY PUT` | ||
|
||
Associates in the database dictionary a record to a key to be found later using a [DICTIONARY GET](Console-Command-Dictionary-Get.md) command. | ||
Binds a record to a key in the dictionary database, making it accessible to the [`DICTIONARY GET`](Console-Command-Dictionary-Get.md) command. | ||
|
||
## Syntax | ||
**Syntax** | ||
|
||
``` | ||
DICTIONARY PUT <key> <record-id> | ||
``` | ||
- **`<key>`** Defines the key you want to bind. | ||
- **`<record-id>`** Defines the ID for the record you want to bind to the key. | ||
|
||
Where: | ||
|
||
- key The key to bind | ||
- record-id The record-id of the record to bind to the key passes | ||
|
||
## Example | ||
|
||
```sql | ||
DICTIONARY PUT obama 5:4 | ||
-------------------------------------------------- | ||
Class: Person id: 5:4 v.1 | ||
-------------------------------------------------- | ||
parent : null | ||
children : [Person@5:5{parent:Person@5:4,children:null,name:Malia Ann,surname:Obama,city:null}, Person@5:6{parent:Person@5:4,children:null | ||
,name:Natasha,surname:Obama,city:null}] | ||
name : Barack | ||
surname : Obama | ||
city : City@-6:2{name:Honolulu} | ||
-------------------------------------------------- | ||
The entry obama=5:4 has been inserted in the database dictionary | ||
``` | ||
|
||
To know all the keys stored in the database dictionary use the [DICTIONARY KEYS](Console-Command-Dictionary-Keys.md) command. | ||
**Example** | ||
|
||
- In the database dictionary of U.S. presidents, bind the record for Barack Obama to the key `obama`: | ||
|
||
<pre> | ||
orientdb> <code class="lang-sql userinput">DICTIONARY PUT obama 5:4</code> | ||
|
||
For complete index (and dictionary) guide look at [Index guide](Indexes.md). | ||
------------------------------------------------------------------------ | ||
Class: Person id: 5:4 v.1 | ||
------------------------------------------------------------------------ | ||
parent : null | ||
children : [Person@5:5{parent:Person@5:4,children:null,name:Malia Ann, | ||
surname:Obama,city:null}, Person@5:6{parent:Person@5:4, | ||
children:null,name:Natasha,surname:Obama,city:null}] | ||
name : Barack | ||
surname : Obama | ||
city : City@-6:2{name:Honolulu} | ||
------------------------------------------------------------------------ | ||
The entry obama=5:4 has been inserted in the database dictionary | ||
</pre> | ||
|
||
The entry obama=5:4 has been inserted in the database dictionary | ||
``` | ||
This is a command of the Orient console. To know all the commands go to [Console-Commands](Console-Commands.md). | ||
>To see all the keys stored in the database dictionary, use the [`DICTIONARY KEYS`](Console-Command-Dictionary-Keys.md) command. For more information on dictionaries and indexes, see [Indexes](Indexes.md). | ||
> | ||
>For more information on other commands, see [Console Commands](Console-Commands.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
# Console - DICTIONARY REMOVE | ||
# Console - `DICTIONARY REMOVE` | ||
|
||
Removes the association from the database dictionary. | ||
|
||
## Syntax | ||
**Syntax** | ||
|
||
``` | ||
DICTIONARY REMOVE <key> | ||
``` | ||
|
||
Where: | ||
- **`<key>`** Defines the key that you want to remove. | ||
|
||
- key The key to remove | ||
**Example** | ||
|
||
## Example | ||
- In a database dictionary of U.S. presidents, remove the key for Barack Obama: | ||
|
||
```sql | ||
DICTIONARY REMOVE obama | ||
<pre> | ||
orientdb> <code class="lang-sql userinput">DICTIONARY REMOVE obama</code> | ||
|
||
Entry removed from the dictionary. Last value of entry was: | ||
-------------------------------------------------- | ||
Class: Person id: 5:4 v.1 | ||
-------------------------------------------------- | ||
parent : null | ||
children : [Person@5:5{parent:Person@5:4,children:null,name:Malia Ann,surname:Obama,city:null}, Person@5:6{parent:Person@5:4,children:null | ||
,name:Natasha,surname:Obama,city:null}] | ||
name : Barack | ||
surname : Obama | ||
city : City@-6:2{name:Honolulu} | ||
-------------------------------------------------- | ||
``` | ||
|
||
To know all the keys stored in the database dictionary use the [DICTIONARY KEYS](Console-Command-Dictionary-Keys.md) command. | ||
Entry removed from the dictionary. Last value of entry was: | ||
------------------------------------------------------------------------ | ||
Class: Person id: 5:4 v.1 | ||
------------------------------------------------------------------------ | ||
parent : null | ||
children : [Person@5:5{parent:Person@5:4,children:null,name:Malia Ann, | ||
surname:Obama,city:null}, Person@5:6{parent:Person@5:4, | ||
children:null,name:Natasha,surname:Obama,city:null}] | ||
name : Barack | ||
surname : Obama | ||
city : City@-6:2{name:Honolulu} | ||
------------------------------------------------------------------------ | ||
</pre> | ||
|
||
For complete index (and dictionary) guide look at [Index guide](Indexes.md). | ||
|
||
This is a command of the Orient console. To know all the commands go to [Console-Commands](Console-Commands.md). | ||
>You can display information for all keys stored in the database dictionary using the [`DICTIONARY KEY`](Console-Command-Dictionary-Keys.md) command. For more information on dictionaries and indexes, see [Indexes](Indexes.md). | ||
> | ||
>For more information on other commands, see [Console Commands](Console-Commands.md). |