You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@iotdb.apache.org by 陈 鹏 <pe...@outlook.com> on 2020/08/20 15:08:53 UTC

Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565

In Session, the JDBC module can set the Boolean return data type to 0/1 or true/false.
可以通过在 Session,JDBC模块中可以设置Boolean的返回数据类型为0/1或true/false

Session Demo:
org.apache.iotdb.session.Session#executeQueryStatement

TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionId, sql, statementId);

execReq.setFetchSize(fetchSize);
RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);

//RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);

JDBC Demo:
org.apache.iotdb.jdbc.IoTDBConnection#IoTDBConnection

if (url == null) {
  throw new IoTDBURLException("Input url cannot be null");
}
params = Utils.parseUrl(url, info);
RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);

//RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
openTransport();

Cli Demo:
-h 127.0.0.1 -p 6667 -u root -pw root -bf number
-h 127.0.0.1 -p 6667 -u root -pw root -bf bool

And the migration of configuration items from part of the JDBC module to the RPC module
以及将部分JDBC模块中的配置项迁移到RPC模块



Re: Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565

Posted by Jialin Qiao <qj...@mails.tsinghua.edu.cn>.
Hi,

It looks good. 

As for the configuration parameter, you could refer to the org.apache.iotdb.db.service.MQTTService.createBrokerConfig()

Thanks,
--
Jialin Qiao
School of Software, Tsinghua University

乔嘉林
清华大学 软件学院

> -----原始邮件-----
> 发件人: "陈 鹏" <pe...@outlook.com>
> 发送时间: 2020-08-22 01:52:42 (星期六)
> 收件人: "dev@iotdb.apache.org" <de...@iotdb.apache.org>
> 抄送: 
> 主题: 回复: Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565
> 
> To pass parameters via URL, and to support Session concatenation, in order to return Boolean types in the format 0/1 or true/false
> 
> 
> SessionExample
> 
> Map<String,String> map = new HashMap<>();
> 
> map.put("boolFormat", "number");
> 
> //map.put("boolFormat", "bool");
> 
> session = new Session("127.0.0.1", 6667, "root", "root",map);
> 
> 
> JDBCExample
> 
> Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/?boolFormat=number", "root", "root");
> 
> // Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/?boolFormat=bool", "root", "root");
> 
> 
> The need to transfer multiple parameters in the future can also be supported such as:
> SessionExample
> 
> Map<String,String> map = new HashMap<>();
> 
> map.put("boolFormat", "number");
> 
> map.put("key", "value");
> 
> session = new Session("127.0.0.1", 6667, "root", "root",map);
> 
> JDBCExample
> 
> Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/?boolFormat=number&&key=value", "root", "root");
> 
> 
> 发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用
> 
> 发件人: Xiangdong Huang<ma...@gmail.com>
> 发送时间: 2020年8月21日 0:27
> 收件人: dev<ma...@iotdb.apache.org>
> 主题: Re: Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565
> 
> Hi,
> 
> Thanks for responding this github issue [1].
> 
> I want to confirm that... is this your design?
> Normally, we can put the configurations in jdbc URL, so, getting the
> configuration from the URL(parameters after the ?) can be a choice.
> 
> And, is there some better name for RpcConfig?
> 
> 
> [1] https://github.com/apache/incubator-iotdb/issues/1565
> 
> -----------------------------------
> Xiangdong Huang
> School of Software, Tsinghua University
> 
>  黄向东
> 清华大学 软件学院
> 
> 
> 陈 鹏 <pe...@outlook.com> 于2020年8月20日周四 下午11:09写道:
> 
> > In Session, the JDBC module can set the Boolean return data type to 0/1 or
> > true/false.
> > 可以通过在 Session,JDBC模块中可以设置Boolean的返回数据类型为0/1或true/false
> >
> > Session Demo:
> > org.apache.iotdb.session.Session#executeQueryStatement
> >
> > TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionId, sql,
> > statementId);
> >
> > execReq.setFetchSize(fetchSize);
> > RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);
> >
> > //RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
> >
> > JDBC Demo:
> > org.apache.iotdb.jdbc.IoTDBConnection#IoTDBConnection
> >
> > if (url == null) {
> >   throw new IoTDBURLException("Input url cannot be null");
> > }
> > params = Utils.parseUrl(url, info);
> > RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);
> >
> > //RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
> > openTransport();
> >
> > Cli Demo:
> > -h 127.0.0.1 -p 6667 -u root -pw root -bf number
> > -h 127.0.0.1 -p 6667 -u root -pw root -bf bool
> >
> > And the migration of configuration items from part of the JDBC module to
> > the RPC module
> > 以及将部分JDBC模块中的配置项迁移到RPC模块
> >
> >
> >
> 

回复: Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565

Posted by 陈 鹏 <pe...@outlook.com>.
To pass parameters via URL, and to support Session concatenation, in order to return Boolean types in the format 0/1 or true/false


SessionExample

Map<String,String> map = new HashMap<>();

map.put("boolFormat", "number");

//map.put("boolFormat", "bool");

session = new Session("127.0.0.1", 6667, "root", "root",map);


JDBCExample

Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/?boolFormat=number", "root", "root");

// Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/?boolFormat=bool", "root", "root");


The need to transfer multiple parameters in the future can also be supported such as:
SessionExample

Map<String,String> map = new HashMap<>();

map.put("boolFormat", "number");

map.put("key", "value");

session = new Session("127.0.0.1", 6667, "root", "root",map);

JDBCExample

Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/?boolFormat=number&&key=value", "root", "root");


发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用

发件人: Xiangdong Huang<ma...@gmail.com>
发送时间: 2020年8月21日 0:27
收件人: dev<ma...@iotdb.apache.org>
主题: Re: Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565

Hi,

Thanks for responding this github issue [1].

I want to confirm that... is this your design?
Normally, we can put the configurations in jdbc URL, so, getting the
configuration from the URL(parameters after the ?) can be a choice.

And, is there some better name for RpcConfig?


[1] https://github.com/apache/incubator-iotdb/issues/1565

-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


陈 鹏 <pe...@outlook.com> 于2020年8月20日周四 下午11:09写道:

> In Session, the JDBC module can set the Boolean return data type to 0/1 or
> true/false.
> 可以通过在 Session,JDBC模块中可以设置Boolean的返回数据类型为0/1或true/false
>
> Session Demo:
> org.apache.iotdb.session.Session#executeQueryStatement
>
> TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionId, sql,
> statementId);
>
> execReq.setFetchSize(fetchSize);
> RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);
>
> //RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
>
> JDBC Demo:
> org.apache.iotdb.jdbc.IoTDBConnection#IoTDBConnection
>
> if (url == null) {
>   throw new IoTDBURLException("Input url cannot be null");
> }
> params = Utils.parseUrl(url, info);
> RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);
>
> //RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
> openTransport();
>
> Cli Demo:
> -h 127.0.0.1 -p 6667 -u root -pw root -bf number
> -h 127.0.0.1 -p 6667 -u root -pw root -bf bool
>
> And the migration of configuration items from part of the JDBC module to
> the RPC module
> 以及将部分JDBC模块中的配置项迁移到RPC模块
>
>
>


Re: Can it be configured to return 0/1 or true/false when Boolean data is retrieved 可否通过配置,在获取boolean类型数据时,返回0/1 或 true/false #1565

Posted by Xiangdong Huang <sa...@gmail.com>.
Hi,

Thanks for responding this github issue [1].

I want to confirm that... is this your design?
Normally, we can put the configurations in jdbc URL, so, getting the
configuration from the URL(parameters after the ?) can be a choice.

And, is there some better name for RpcConfig?


[1] https://github.com/apache/incubator-iotdb/issues/1565

-----------------------------------
Xiangdong Huang
School of Software, Tsinghua University

 黄向东
清华大学 软件学院


陈 鹏 <pe...@outlook.com> 于2020年8月20日周四 下午11:09写道:

> In Session, the JDBC module can set the Boolean return data type to 0/1 or
> true/false.
> 可以通过在 Session,JDBC模块中可以设置Boolean的返回数据类型为0/1或true/false
>
> Session Demo:
> org.apache.iotdb.session.Session#executeQueryStatement
>
> TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionId, sql,
> statementId);
>
> execReq.setFetchSize(fetchSize);
> RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);
>
> //RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
>
> JDBC Demo:
> org.apache.iotdb.jdbc.IoTDBConnection#IoTDBConnection
>
> if (url == null) {
>   throw new IoTDBURLException("Input url cannot be null");
> }
> params = Utils.parseUrl(url, info);
> RpcConfig.setBoolFormat(RpcConfig.Constant.NUMBER);
>
> //RpcConfig.setBoolFormat(RpcConfig.Constant.BOOLEAN);
> openTransport();
>
> Cli Demo:
> -h 127.0.0.1 -p 6667 -u root -pw root -bf number
> -h 127.0.0.1 -p 6667 -u root -pw root -bf bool
>
> And the migration of configuration items from part of the JDBC module to
> the RPC module
> 以及将部分JDBC模块中的配置项迁移到RPC模块
>
>
>