Skip to content

Commit fa6e6aa

Browse files
laodouyalaodouya
authored andcommitted
chore(publish): published 0.7.0 docs by [laodouya]
1 parent 5f92c51 commit fa6e6aa

File tree

3 files changed

+84
-10
lines changed

3 files changed

+84
-10
lines changed

docs/cql_db_access.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The sub-command `console` also supports running `adapter` or `explorer` servers
6161
e.g.
6262
cql console covenantsql://4119ef997dedc585bfbcfae00ab6b87b8486fab323a8e107ea1fd4fc4f7eba5c
6363

64-
There is also a -command param for SQL script, and a -file param for reading SQL in a file.
64+
There is also a -command param for SQL script, and you can add "< file.sql" at end of command for executing a SQL file.
6565
If those params are set, it will run SQL script and exit without staying console mode.
6666
e.g.
6767
cql console -command "create table test1(test2 int);" covenantsql://4119ef997dedc585bfbcfae00ab6b87b8486fab323a8e107ea1fd4fc4f7eba5c
@@ -73,10 +73,6 @@ The sub-command `console` also supports running `adapter` or `explorer` servers
7373
Run only single command (SQL or usql internal command) and exit
7474
-explorer string
7575
Address serve a database chain explorer, e.g. :8546
76-
-file string
77-
Execute commands from file and exit
78-
-no-rc
79-
Do not read start up file
8076
-out string
8177
Record stdout to file
8278
-single-transaction

website/translated_docs/zh-CN/version-0.7.0/cql_db_access.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ cql console -config "account2/config.yaml" 'covenantsql://4bc27a06ae52a7b8b1747f
6161
示例:
6262
cql console covenantsql://4119ef997dedc585bfbcfae00ab6b87b8486fab323a8e107ea1fd4fc4f7eba5c
6363

64-
另外也可以通过 -command 参数来直接运行 SQL 查询语句或通过 -file 参数来从文件读取查询语句
64+
另外也可以通过 -command 参数来直接运行 SQL 查询语句。或者通过文件重定向,如在命令最后加入 '< filename.sql' 来从文件读取SQL语句
6565
在指定了这些参数的情况下 `console` 子命令将会直接执行命令后退出,而不会进入交互式的命令行模式。
6666
示例:
6767
cql console -command "create table test1(test2 int);" covenantsql://4119ef997dedc585bfbcfae00ab6b87b8486fab323a8e107ea1fd4fc4f7eba5c
@@ -73,10 +73,6 @@ cql console -config "account2/config.yaml" 'covenantsql://4bc27a06ae52a7b8b1747f
7373
执行单条 SQL 语句并退出
7474
-explorer string
7575
指定数据库子链的 explorer 服务器监听地址
76-
-file string
77-
执行 SQL 脚本中的语句并退出
78-
-no-rc
79-
启动时不加载 .rc 初始脚本
8076
-out string
8177
指定输出文件
8278
-single-transaction
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
id: version-0.7.0-cql_db_access
3+
title: Accessing Database
4+
original_id: cql_db_access
5+
---
6+
7+
Once your database is successfully created, you can use the `console` sub-command to access it in an interactive console:
8+
9+
```bash
10+
cql console 'covenantsql://4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5'
11+
```
12+
13+
Output:
14+
15+
INFO[0000] Geting bp address from dns: bp05.testnet.gridb.io
16+
INFO[0010] init config success path=~/.cql/config.yaml
17+
INFO[0010] connecting to "covenantsql://4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5"
18+
Connected with driver covenantsql (develop-da3af8f6-20190515152207)
19+
Type "help" for help.
20+
21+
co:4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5=>
22+
23+
Or access as `account2` (Should been granted access permission and transfered deposit token to the database successfully in last section):
24+
25+
```bash
26+
cql console -config "account2/config.yaml" 'covenantsql://4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5'
27+
```
28+
29+
Output:
30+
31+
INFO[0000] Geting bp address from dns: bp05.testnet.gridb.io
32+
INFO[0010] init config success path=~/.config/cql/account2/config.yaml
33+
INFO[0010] connecting to "covenantsql://4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5"
34+
Connected with driver covenantsql (develop-da3af8f6-20190515152207)
35+
Type "help" for help.
36+
37+
co:4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5=>
38+
39+
Here is an example of using the interactive console:
40+
41+
co:4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5=> create table t1 (c1 int);
42+
CREATE TABLE
43+
co:4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5=> insert into t1 values (1), (2), (3);
44+
INSERT
45+
co:4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5=> select * from t1;
46+
c1
47+
----
48+
1
49+
2
50+
3
51+
(3 rows)
52+
53+
co:4bc27a06ae52a7b8b1747f3808dda786ddd188627bafe8e34a332626e7232ba5=>
54+
55+
## Sub-command `console` Complete Parameters
56+
57+
The sub-command `console` also supports running `adapter` or `explorer` servers in the background. Check [Local Servers](#local-servers) for details.
58+
59+
usage: cql console [common params] [Console params] dsn
60+
61+
Console runs an interactive SQL console for CovenantSQL.
62+
e.g.
63+
cql console covenantsql://4119ef997dedc585bfbcfae00ab6b87b8486fab323a8e107ea1fd4fc4f7eba5c
64+
65+
There is also a -command param for SQL script, and you can add "< file.sql" at end of command for executing a SQL file.
66+
If those params are set, it will run SQL script and exit without staying console mode.
67+
e.g.
68+
cql console -command "create table test1(test2 int);" covenantsql://4119ef997dedc585bfbcfae00ab6b87b8486fab323a8e107ea1fd4fc4f7eba5c
69+
70+
Console params:
71+
-adapter string
72+
Address to serve a database chain adapter, e.g. :7784
73+
-command string
74+
Run only single command (SQL or usql internal command) and exit
75+
-explorer string
76+
Address serve a database chain explorer, e.g. :8546
77+
-out string
78+
Record stdout to file
79+
-single-transaction
80+
Execute as a single transaction (if non-interactive)
81+
-variable value
82+
Set variable

0 commit comments

Comments
 (0)