EJTTianyu created IOTDB-156:
-------------------------------

             Summary: add -e option for iotdb client
                 Key: IOTDB-156
                 URL: https://issues.apache.org/jira/browse/IOTDB-156
             Project: Apache IoTDB
          Issue Type: Improvement
            Reporter: EJTTianyu
         Attachments: image-2019-07-27-15-47-12-045.png

We added the -e parameter to the start-client.sh script. By using the -e 
parameter, we can operate IoTDB in the shell without entering the client's 
input mode. Take following as an example:

Suppose we want to create a storage group root.demo to a newly launched IoTDB, 
create a timeseries root.demo.s1 and insert three data points into it. With -e 
parameter, we could write a shell like this:
{code:java}
# !/bin/bash

host=127.0.0.1
port=6667
user=root
pass=root

./start-client.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "set storage 
group to root.demo"
./start-client.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "create 
timeseries root.demo.s1 WITH DATATYPE=INT32, ENCODING=RLE"
./start-client.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into 
root.demo(timestamp,s1) values(1,10)"
./start-client.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into 
root.demo(timestamp,s1) values(2,11)"
./start-client.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "insert into 
root.demo(timestamp,s1) values(3,12)"
./start-client.sh -h ${host} -p ${port} -u ${user} -pw ${pass} -e "select s1 
from root.demo"
{code}
The print results are shown in the figure, which are consistent with the client 
and jdbc operations.

!image-2019-07-27-15-47-12-045.png!

It should be noted that the use of the -e parameter in shell scripts requires 
attention to the escaping of special characters.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to