diff --git a/docs/ref-ch03-create.md b/docs/ref-ch03-create.md index 3700422..e418f8e 100755 --- a/docs/ref-ch03-create.md +++ b/docs/ref-ch03-create.md @@ -31,6 +31,8 @@ This command mutates the state of the Obelisk agent. ## Produced Metadata +## Example + INSERT `name`, `` into `sys.sys.databases` Create all `.sys` tables @@ -43,7 +45,7 @@ This command creates an index over selected column(s) of an existing table. ``` ::= - CREATE [ UNIQUE ] [ NONCLUSTERED | CLUSTERED ] INDEX + CREATE [ UNIQUE ] [ LOOK-UP | CLUSTERED ] INDEX ON [ ] ( [ ASC | DESC ] [ ,...n ] ) ``` @@ -75,7 +77,7 @@ CREATE INDEX ix_vendor-id3 ON purchasing..product-vendor (vendor-id); **`UNIQUE`** Specifies that no two rows are permitted to have the same index key value. -**`NONCLUSTERED | CLUSTERED`** +**`LOOK-UP | CLUSTERED`** `CLUSTERED` creates an index in which the logical order of the key values determines the physical order of the corresponding rows in a table. A `
` or `` can have only one clustered index at a time. **``** @@ -97,7 +99,9 @@ _NOTE_: Further investigation is required to determine how "clustering" works in ## Produced Metadata -INSERT `table name`, `namespace` `index-name`, `NONCLUSTERED | CLUSTERED`, `is-unique`, `` into `.sys.indices` +## Example + +INSERT `table name`, `namespace` `index-name`, `LOOK-UP | CLUSTERED`, `is-unique`, `` into `.sys.indices` ## Exceptions @@ -134,6 +138,10 @@ This command mutates the state of the Obelisk agent. ## Produced Metadata +sys and data timestamps + +## Example + INSERT `name`, `` into `.sys.namespaces` ## Exceptions @@ -169,7 +177,7 @@ _NOTE_: Further investigation is needed to understand if there's a reason to spe [ ]
( [ ,... n ] ) - PRIMARY KEY [ CLUSTERED | NONCLUSTERED ] ( [ ,... n ] ) + PRIMARY KEY [ CLUSTERED | LOOK-UP ] ( [ ,... n ] ) [ { FOREIGN KEY ( [ ASC | DESC ] [ ,... n ] ) REFERENCES [ . ]
( [ ,... n ] ) [ ON DELETE { NO ACTION | CASCADE | SET DEFAULT } ] @@ -177,15 +185,6 @@ _NOTE_: Further investigation is needed to understand if there's a reason to spe [ ,... n ] ]` ``` -## Example -``` -CREATE TABLE order-detail -(invoice-nbr @ud, line-item @ud, product-id @ud, special-offer-id @ud, message @t) -PRIMARY KEY CLUSTERED (invoice-nbr, line-item) -FOREIGN KEY fk-special-offer-order-detail (product-id, specialoffer-id) -REFERENCES special-offer (product-id, special-offer-id) -``` - ## API ``` +$ create-table @@ -209,8 +208,8 @@ If not explicitly qualified, it defaults to the Obelisk agent's current database The list of user-defined column names and associated auras. Names must adhere to the hoon term naming standard. For more details, refer to [ref-ch02-types](ref-ch02-types.md) -**`[ CLUSTERED | NONCLUSTERED ] ( [ ,... n ]`** -These are column names in the required unique primary index. Defining the index as `NONCLUSTERED` is optional. +**`[ CLUSTERED | LOOK-UP ] ( [ ,... n ]`** +These are column names in the required unique primary index. Defining the index as `LOOK-UP` is optional. **` ( [ ASC | DESC ] [ ,... n ]`** This is a user-defined name for ``. It must adhere to the hoon term naming standard. @@ -265,12 +264,6 @@ NOTE: The specific definition of `CLUSTERED` in Hoon, possibly an ordered map, i ## Produced Metadata -INSERT `table name`, `namespace`, `` INTO `.sys.tables` -INSERT `table name`, `namespace`, ``, `column name`, `aura`, `` INTO `.sys.table-columns` -INSERT `table name`, `namespace`, `delete | update`, ``, `` INTO `.sys.table-ref-integrity` -CREATE INDEX on Primary Key -CREATE INDEX on Foreign Keys - ## Exceptions name within namespace already exists for table @@ -278,6 +271,15 @@ table referenced by FOREIGN KEY does not exist table column referenced by FOREIGN KEY does not exist aura mis-match in FOREIGN KEY +## Example +``` +CREATE TABLE order-detail +(invoice-nbr @ud, line-item @ud, product-id @ud, special-offer-id @ud, message @t) +PRIMARY KEY CLUSTERED (invoice-nbr, line-item) +FOREIGN KEY fk-special-offer-order-detail (product-id, specialoffer-id) +REFERENCES special-offer (product-id, special-offer-id) +``` + # CREATE TRIGGER A trigger automatically runs when a specified table or view event occurs in the Obelisk agent. It runs a previously defined ``. @@ -346,6 +348,8 @@ Views cannot be defined on foreign ship databases. ## Produced Metadata +## Examples + INSERT `name`, ``, `` INTO `.sys.views` INSERT `name`, ``, `` INTO `.sys.view-columns` diff --git a/docs/ref-ch04-data-manipulation.md b/docs/ref-ch04-data-manipulation.md index 6863d40..fbd1c6e 100755 --- a/docs/ref-ch04-data-manipulation.md +++ b/docs/ref-ch04-data-manipulation.md @@ -57,7 +57,7 @@ Inserts rows into a ``. ::= INSERT INTO [ ( [ ,...n ] ) ] - { VALUES ( [ ,...n ] ) [ ,...n ] + { VALUES ( [ ,...n ] ) [ ...n ] | } ``` @@ -117,6 +117,8 @@ When the target `` is a `
`, the input `` must match When target `` is not a `
` and the input is from a `` then the target `` and `` `` must have the same all-column ``. New `` sub-types may be introduced. +Note that multiple parentheses enclosed rows of column values are NOT comma separated. + ## Produced Metadata `@@ROWCOUNT` returns the total number of rows inserted diff --git a/docs/ref-ch07-transform.md b/docs/ref-ch07-transform.md index aa0b8ef..d47f5eb 100755 --- a/docs/ref-ch07-transform.md +++ b/docs/ref-ch07-transform.md @@ -34,7 +34,7 @@ A `` in a CTE cannot include a `WITH` clause. | ``` -A `` is considered terminal when it operates on a `
` and potentially mutates its state, whether it mutates `
` state or not. A terminal `` must be the last step in a ``, it cannot be grouped by parentheses, and it is not the only `` it must have been preceded by a ``. +A `` is considered terminal when it operates on a `
` and potentially mutates its state, whether it mutates `
` state or not. A terminal `` must be the last step in a ``, it cannot be grouped by parentheses, and if is not the only `` it must have been preceded by a ``. The `` command by itself is never terminal. It is terminal when it is followed by `INTO
`. @@ -110,7 +110,7 @@ API: $: %transform ctes=(list ) - (tree ) + set-functions=(tree ) == ``` @@ -118,9 +118,7 @@ API: **`WITH [ [ ,...n ] ]`** -``s within a CTE may not have their own `WITH` clause. - -The `WITH` clause makes the result `` of a `` statement available to the subsequent `` statements in the `WITH` clause and ``s in the main `` by ``. ``s in the `WITH` clause cannot have their own internal `WITH`, rather any preceding CTEs are available. +The `WITH` clause makes the result `` of a `` statement available to the subsequent `` statements in the `WITH` clause and ``s in the main `` by ``. ``s in the `WITH` clause cannot have their own `WITH` clause, rather preceding CTEs within the clause are available and function as a virtual `WITH` clause. When used as a ``, `` output must be a pass-thru virtual-table. diff --git a/utilities/file-to-tape.fsx b/utilities/file-to-tape.fsx new file mode 100644 index 0000000..fff78ec --- /dev/null +++ b/utilities/file-to-tape.fsx @@ -0,0 +1,17 @@ +// file-to-tape.fsx +open System +open System.IO + +let args = Environment.GetCommandLineArgs() +let inFile = + // File.ReadAllLines(Path.Combine([|args.[2]|])) + File.ReadAllLines(fsi.CommandLineArgs.[1]) + +let outString (inString : string) = + "\" " + inString + " \"." + +let output = + inFile + |> Array.map outString + +File.WriteAllLines(Path.Combine(fsi.CommandLineArgs.[1] + "x"), output)