ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

【深入理解TcaplusDB技术】入门Tcaplus SQL Driver

2022-06-16 14:31:34  阅读:172  来源: 互联网

标签:Tcaplus ERR database column TcaplusDB Driver value SQL method


【深入理解TcaplusDB技术】入门Tcaplus SQL Driver

 

简介

TcaplusDB SQL Driver/C++ 是用于连接C++应用程序到TcaplusDB服务器的TcaplusDBConnector。用于以传统方式使用SQL语句的TcaplusDB服务器。

二进制安装

TcaplusDB SQL Driver/C++二进制发行版是以特定于平台的压缩格式提供的。二进制发行版也以更通用的格式以压缩的tar文件或zip压缩包提供。 TcaplusDB SQL Driver/C++二进制发行版可用于几个平台,以压缩的tar文件或zip压缩包形式打包,在这里表示为PACKAGE.tar.gz或PACKAGE.zip. 要解压tar文件,在预期的安装目录中使用此命令: tar zxvf PACKAGE.tar.gz 从Zip压缩包安装(.zip),使用WinZip或者其他可以读取“.zip"文件的工具,将文件解压缩到您选择的位置的文件。

TcaplusDB和Tcaplus SQL Driver版本的兼容性

  • TcaplusDB版本: TcaplusDB SQL Driver/C++基于TcaplusDB 3.53.0开发。

  • C++标准: TcaplusDB SQL Driver/C++基于C++98标准开发。

TcaplusDB SQL Driver/C++快速入门

通过TcaplusDB SQL Driver/C++连接TcaplusDB,链接格式如下: tcp://<instance_ip>:<instance_port>?app_id=<app_id>&zone_id=<zone_id> 其中<instance_ip>为实例主机ip;<instance_port>为开放端口,默认为9999;<app_id>为业务id,<zone_id>为游戏区id。 连接与读取数据示例:

#include "cppconn/statement.h"
#include "cppconn/resultset.h"
#include "cppconn/connection.h"
#include "cppconn/driver.h"
#include "cppconn/metadata.h"
#include "cppconn/resultset.h"
#include "cppconn/resultset_metadata.h"
#include "cppconn/prepared_statement.h"
#include "tcapsql_driver.h"
#include <iostream>

int main()
{
   sql::Driver *driver;
   sql::Connection *conn;
   sql::Statement *state;
   sql::ResultSet *rset;
   try {
   driver = sql::tcapsql::get_driver_instance();
   conn = driver->connect("tcp://192.168.0.1:9999?app_id=2&zone_id=3", "", "123456");
   state = conn->createStatement();
   rset = state->executeQuery("SELECT * FROM user WHERE user_id = '10000'");
   while (rset->next())
  {
       std::cout << rset->getString(1) << std::endl;
  }
   delete rset;
   delete state;
   delete conn;
  } catch (sql::SQLException &e) {
       std::cout << "catch errCode " << e.getErrorCode() << " errMsg " << e.what() << std::endl;
       return EXIT_FAILURE;
  }
   return 0;
}

Makefile

export TCAPSQL_DRIVER=/youpath/TcaplusSQLDriver3.53.1.204605.x86_64_release_20210521/release/x86_64/;
CPPFILE=$(wildcard *.cpp)
LIBS +=-L$(TCAPSQL_DRIVER)/lib -Wl,-Bstatic -ltcaplus_sqldriver -Wl,-Bdynamic -lpthread -lanl

INC = -I$(TCAPSQL_DRIVER)/include/
.PHONY: all clean
all:
g++ -o mytest $(CPPFILE) $(INC) ${LIBS}  
clean:
rm -f mytest

 

 

TcaplusDB的表定义与表创建

使用xml定义TcaplusDB表,示例如下:

<?xml version="1.0" encoding="GBK" standalone="yes" ?>
<metalib name="demo_table" tagsetversion="1" version="1">
   <struct name="user" version="1" primarykey="user_id,server_id" splittablekey="user_id">
       <entry name="user_id" type="string" size="450" desc="用户ID"/>
       <entry name="server_id" type="uint64" desc="服务器ID" />
       <entry name="nick_name" type="string" size="50" desc="昵称"/>
       <entry name="desc" type="string" size="1024" desc="描述信息"/>
       <entry name="state" type="Tinyuint" defaultvalue="0" desc="用户状态 0 : AVALIABLE, 1 DELETED"/>
       <index name="index1" column="user_id"/>
       <index name="index2" column="user_id,server_id"/>
   </struct>
</metalib>

 

 

  • 元素 metalib 是 xml 文件的根元素。

  • 包含 primarykey 的 struct 元素是一个表,不包含 primarykey 的 struct 元素为一个普通结构体。

  • 每次修改表结构时,版本属性值需要相应地加1,初始版本始终为1。

  • primarykey 属性指定主键字段;对于 generic 表,您最多可以指定8个主键字段,对于 list 表,则可以指定7个。

  • splittablekey 属性等效于分片键(shard key),TcaplusDB 表被拆分存储到多个存储节点。splittablekey 必须是主键字段之一,一个好的 splittablekey 应该具有高度分散性,这意味着值的范围很广,建议选用字符串类型。

  • desc 属性包含当前元素的描述。

  • entry 元素定义一个字段,支持的值类型包括 int32,string,char,int64,double,short 等。

  • index 元素定义一个索引,该索引必须包含 splittablekey。由于可以使用主键查询表,因此索引不应与主键属性相同。

 

TcaplusDB SQL Driver/C++示例

TcaplusDB SQL Driver/C++:获取driver实例

通过调用 get_driver_instance 可以获取到driver实例,每个进程获取一次足矣。

sql::Driver * driver = sql::tcapsql::get_driver_instance();

使用后端TcaplusDB的连接信息生成 URL 并建立连接

// IP
#define DIR_HOST "192.168.0.1"
// port
#define DIR_PORT "9999"
// app_id
#define APP_ID 2
// zone_id
#define ZONE_ID 3
// signature
#define SIGNATURE "123456"
char url[120] = {0};
snprintf(url, 120, "tcp://%s:%d?app_id=%d&zone_id=%d", DIR_HOST, DIR_PORT , APP_ID, ZONE_ID);
// 中间参数为收发线程的线程名,conn的收发线程名相同,说明使用同一个收发线程收发包。
// 1个收发线程可以处理大概200个conn的请求响应。不过conn越多会造成延时变高,按需调整。
sql::Connection * conn = driver->connect(url, "instance1", SIGNATURE);

Statement 对象可以执行基本SQL查询,并通过 ResultSet 类获取结果。 对从 driver.connect() 获取的 Connection 对象调用 createStatement() 方法,则可创建一个 Statement 实例,之后就可以通过调用 executeQuery(String) 方法使用SQL语句执行SELECT查询。 如果要更新数据库中的数据,可以使用 executeUpdate(String SQL) 方法。 当语句是SELECT时,可以通过调用 getResultSet() 方法获取查询结果。当语句是UPDATE,INSERT,DELETE时,可以通过对 Statement 实例调用 getUpdateCount() 获取受影响的行数。 以下是执行SELECT查询的示例:

sql::Statement * state = conn->createStatement();
sql::ResultSet * rset = state->executeQuery("SELECT * FROM user WHERE user_id = '10000'");
while (rset->next())
{
   std::cout << rset->getString(1) << std::endl;
}
delete rset;
delete state;

 

sql类型和TcaplusDB类型对应关系

**TcaplusDB和sql数据类型对应关系

TcaplusDB数据类型sql类型
int8 sql::DataType::TINYINT (TINYINT)
uint8 sql::DataType::TINYINT (TINYINT UNSIGNED)
int16 sql::DataType::SMALLINT (SMALLINT)
uint16 sql::DataType::SMALLINT (SMALLINT UNSIGNED)
int32 sql::DataType::INTEGER (INT)
uint32 sql::DataType::INTEGER (INT UNSIGNED)
int64 sql::DataType::BIGINT (BIGINT)
uint64 sql::DataType::BIGINT (BIGINT UNSIGNED)
float sql::DataType::REAL (FLOAT)
double sql::DataType::DOUBLE (DOUBLE)
string sql::DataType::VARCHAR (VARCHAR)
binary sql::DataType::VARBINARY (BLOB)

将TcaplusDB错误码映射到SQL Driver SQLState代码

TcaplusDB部分常见错误码及说明如下:

错误码描述说明
2309 TXHDB_ERR_RECORD_IS_NOT_SET_TTL 记录未设置过期时间
261 TXHDB_ERR_RECORD_NOT_EXIST 该记录不存在
-261 TXHDB_ERR_INVALID_ARGUMENTS 内部参数错误
-273 PROXY_ERR_INVALID_PARAMS 内部参数错误
-275 API_ERR_OVER_MAX_KEY_FIELD_NUM 主键字段个数超过限制,Generic表限制数为4, List表限制数为3
-517 TXHDB_ERR_INVALID_MEMBER_VARIABLE_VALUE 内部参数错误
-525 SVR_ERR_FAIL_TIMEOUT 存储层请求超时
-529 PROXY_ERR_NO_NEED_ROUTE_BATCHGET_ACTION_MSG_WHEN_NODE_IS_IN_SYNC_STATUS 有损搬迁中部分命令不支持, 目前大多为无损搬迁,不会有该错误码
-531 API_ERR_OVER_MAX_VALUE_FIELD_NUM 非主键字段个数超过限制,Generic表限制数为128, List表限制数:127
-773 TXHDB_ERR_ALREADY_OPEN 引擎文件重复打开
-781 SVR_ERR_FAIL_SHORT_BUFF buf太短,内部错误
-785 PROXY_ERR_NO_NEED_ROUTE_WHEN_NODE_IS_IN_REJECT_STATUS 有损搬迁中部分命令不支持, 目前大多为无损搬迁,不会有该错误码
-787 API_ERR_OVER_MAX_FIELD_NAME_LEN 字段名称大小超过限制(32B)
-1037 SVR_ERR_FAIL_SYSTEM_BUSY 存储层过载, 请联系DBA
-1043 API_ERR_OVER_MAX_FIELD_VALUE_LEN 字段值长度指超过限制
-1293 SVR_ERR_FAIL_RECORD_EXIST insert的记录已存在
-1299 API_ERR_FIELD_NOT_EXSIST 访问的字段不存在, 请确定字段名拼写正确
-1549 SVR_ERR_FAIL_INVALID_FIELD_NAME 访问的字段不存在, 请确定表结构已更新到后端
-1555 API_ERR_FIELD_TYPE_NOT_MATCH 字段值的数据类型与其定义类型不匹配
-1792 GEN_ERR_TABLE_READONLY 表处于只读模式,请检查RCU, WCU或容量是否超出用户设定的阈值
-1805 SVR_ERR_FAIL_VALUE_OVER_MAX_LEN 记录超过最大长度,序列化后不能超过10MB
-1811 API_ERR_PARAMETER_INVALID 参数错误
-2048 GEN_ERR_TABLE_READ_DELETE 容量超限, 可读可删, 但不能写
-2061 SVR_ERR_FAIL_INVALID_FIELD_TYPE 表字段类型错误
-2067 API_ERR_OPERATION_TYPE_NOT_MATCH 表类型和命令字不匹配。比如generic表用了list表的命令字
-2304 GEN_ERR_ACCESS_DENIED 拒绝访问
-2317 SVR_ERR_FAIL_SYNC_WRITE tcapsvr_fail_sync_write
-2323 API_ERR_PACK_MESSAGE 打包错误,请联系管理员
-2560 GEN_ERR_INVALID_ARGUMENTS 参数错误,请联系管理员
-2573 SVR_ERR_FAIL_WRITE_RECORD 写引擎错误,请联系管理员
-2579 API_ERR_UNPACK_MESSAGE 解包错误,请联系管理员
-2816 GEN_ERR_UNSUPPORT_OPERATION 不支持的操作,请联系管理员
-2823 ENG_ERR_ENGINE_ERROR 引擎错误,请联系管理员
-2829 SVR_ERR_FAIL_DELETE_RECORD 删除引擎记录失败,请联系管理员
-3072 GEN_ERR_NOT_ENOUGH_MEMORY 内存不足
-3079 ENG_ERR_DATA_ERROR 数据错误,请联系管理员
-3085 SVR_ERR_FAIL_DATA_ENGINE SetFieldName操作指定了错误的字段
-3091 API_ERR_OVER_MAX_RECORD_NUM 客户端访问的表个数超过限制,通常不会出现,出现说明有bug,请联系管理员
-3328 GEN_ERR_NOT_SATISFY_INSERT_FOR_SORTLIST sortlist相关错误码。
-3341 SVR_ERR_FAIL_RESULT_OVERFLOW 字段值大小超过其定义类型的限制
-3347 API_ERR_INVALID_COMMAND 回包的命令不匹配
-3603 API_ERR_NO_MORE_RECORD 没有记录了
-3859 API_ERR_OVER_KEY_FIELD_NUM 超过最大key个数限制,当前最大8个key,list表少一个
-4109 SVR_ERR_FAIL_INVALID_INDEX list数据类型元素下标超过范围
-4115 API_ERR_OVER_VALUE_FIELD_NUM 超过最大value个数限制,当前最大256个value,list表少一个
-4365 SVR_ERR_FAIL_OVER_MAXE_FIELD_NUM 超过最大字段个数
-4371 API_ERR_OBJ_NEED_INIT API未初始化(或未RegisterTable)
-4621 SVR_ERR_FAIL_MISS_KEY_FIELD 请求缺少主键字段或索引字段
-4627 API_ERR_INVALID_DATA_SIZE 数据大小不对,通常是用户的本地表定义和服务端不一致。
-4883 API_ERR_INVALID_ARRAY_COUNT 数组大小无效
-5137 PROXY_ERR_PACK_MSG 打包失败
-5139 API_ERR_INVALID_UNION_SELECT 无效的union的select
-5393 PROXY_ERR_SEND_MSG 发送消息失败
-5395 API_ERR_MISS_PRIMARY_KEY 请求中缺少主键
-5649 PROXY_ERR_ALLOCATE_MEMORY 内存不足
-5651 API_ERR_UNSUPPORT_FIELD_TYPE 不支持的字段类型
-5905 PROXY_ERR_PARSE_MSG 解析消息失败
-5907 API_ERR_ARRAY_BUFFER_IS_SMALL 内存太小
-6157 SVR_ERR_FAIL_LIST_FULL list表元素个数超过定义范围,请设置元素淘汰
-6161 PROXY_ERR_INVALID_MSG 无效的消息
-6412 SVR_ERR_FAIL_LOW_VERSION 版本太低
-6417 PROXY_ERR_FAILED_PROC_REQUEST_BECAUSE_NODE_IS_IN_SYNC_STASUS 有损搬迁,部分命令不支持,当前主要是无损搬迁,不会遇到该问题
-6669 SVR_ERR_FAIL_HIGH_VERSION 版本太高
-6673 PROXY_ERR_KEY_FIELD_NUM_IS_ZERO 没有key字段
-6925 SVR_ERR_FAIL_INVALID_RESULT_FLAG result_flag设置错误,请参考SDK中result_flag说明
-6929 PROXY_ERR_LACK_OF_SOME_KEY_FIELDS 请求中缺少key字段
-7181 SVR_ERR_FAIL_PROXY_STOPPING 接入层正在停止,业务无需关注,API或自动切换新的接入层
-7185 PROXY_ERR_FAILED_TO_FIND_NODE 找不到路由节点,请联系管理员
-7437 SVR_ERR_FAIL_SVR_READONLY 存储层只读,通常磁盘写满或在进行主备切换
-7441 PROXY_ERR_INVALID_COMPRESS_TYPE 不支持的压缩类型
-7443 API_ERR_INCOMPATIBLE_META 不兼容的表结构, 请检查本地表结构和服务端表结构是否兼容。
-7669 API_ERR_PACK_ARRAY_DATA 打包数组字段失败
-7693 SVR_ERR_FAIL_SVR_READONLY_BECAUSE_IN_SLAVE_MODE 请求发向存储层备节点,可能是正在主备切换。若长时间返回该错误码,请联系管理员
-7697 PROXY_ERR_REQUEST_OVERSPEED 请求速度超过配额
-7949 SVR_ERR_FAIL_INVALID_VERSION 请检查乐观锁,请求记录版本号与实际记录版本号不一致
-7953 PROXY_ERR_SWIFT_TIMEOUT 接入层超时
-7955 API_ERR_PACK_UNION_DATA 打包union数据失败
-8205 SVR_ERR_FAIL_SYSTEM_ERROR 存储层内部错误,请联系管理员
-8209 PROXY_ERR_SWIFT_ERROR 接入层事务非超时类错误,请联系管理员
-8211 API_ERR_PACK_STRUCT_DATA 打包struct失败
-8461 SVR_ERR_FAIL_OVERLOAD 存储层过载
-8465 PROXY_ERR_DIRECT_RESPONSE 接入层直接回包, 相当于不走业务逻辑,通常用于测试API
-8467 API_ERR_UNPACK_ARRAY_DATA 解包数组字段失败
-8717 SVR_ERR_FAIL_NOT_ENOUGH_DADADISK_SPACE 存储层数据盘磁盘空间不足
-8721 PROXY_ERR_INIT_TLOG 初始化日志模块失败
-8723 API_ERR_UNPACK_UNION_DATA 解包union数据失败
-8973 SVR_ERR_FAIL_NOT_ENOUGH_ULOGDISK_SPACE 存储层binlog流水盘磁盘空间不足
-8979 API_ERR_UNPACK_STRUCT_DATA 解包struct数据失败
-9229 SVR_ERR_FAIL_UNSUPPORTED_PROTOCOL_MAGIC 内部错误,不支持的接入层协议magic
-9233 PROXY_ERR_REQUEST_ACCESS_CTRL_REJECT 接入层拒绝访问
-9235 API_ERR_INVALID_INDEX_NAME index不存在
-9485 SVR_ERR_FAIL_UNSUPPORTED_PROTOCOL_CMD 不支持的命令字
-9489 PROXY_ERR_NOT_ALL_NODES_ARE_IN_NORMAL_OR_WAIT_STATUS 遍历请求返回该错误码,因为该表处于搬迁状态
-9491 API_ERR_MISS_PARTKEY_FIELD 缺少partkey字段
-9745 PROXY_ERR_ALREADY_CACHED_REQUEST_TIMEOUT 路由变更时,cache的请求已超时
-9747 API_ERR_ALLOCATE_MEMORY 分配内存失败
-9997 SVR_ERR_FAIL_MERGE_VALUE_FIELD 合并value字段失败,内部错误,请联系管理员
-10001 PROXY_ERR_FAILED_TO_CACHE_REQUEST 路由变更时,cache请求失败
-10003 API_ERR_GET_META_SIZE api_get_meta_size_error
-10253 SVR_ERR_FAIL_CUT_VALUE_FIELD 合并value字段失败,内部错误,请联系管理员
-10257 PROXY_ERR_NOT_EXIST_CACHED_REQUEST 路由变更时,不存在cache请求
-10259 API_ERR_MISS_BINARY_VERSION 内部错误,二进制字段缺失版本
-10509 SVR_ERR_FAIL_PACK_FIELD 内部错误,打包字段失败,请联系管理员
-10513 PROXY_ERR_FAILED_NOT_ENOUGH_CACHE_BUFF 路由变更时,buff不足
-10765 SVR_ERR_FAIL_UNPACK_FIELD 存储层解包失败
-10769 PROXY_ERR_FAILED_PROCESS_CACHED_REQUEST 接入层处理缓存的请求失败
-10771 API_ERR_INVALID_RESULT_FLAG 无效的result flag
-11021 SVR_ERR_FAIL_LOW_API_VERSION api版本太低,请升级api
-11027 API_ERR_OVER_MAX_LIST_INDEX_NUM list表超过最大元素个数
-11277 SVR_ERR_COMMAND_AND_TABLE_TYPE_IS_MISMATCH 操作表的方法不存在
-11283 API_ERR_INVALID_OBJ_STATUE 未初始化, 通常出现在遍历请求中
-11533 SVR_ERR_FAIL_TO_FIND_CACHE 存储层未找到数据分片,内部错误,请联系管理员
-11537 PROXY_ERR_SWIFT_SEND_BUFFER_FULL 发送缓冲区已满, API处理响应太慢
-11539 API_ERR_INVALID_REQUEST 无效的请求
-11789 SVR_ERR_FAIL_TO_FIND_META 存储层未找到表定义, 内部错误,请联系管理员
-11793 PROXY_ERR_REQUEST_OVERLOAD_CTRL_REJECT 接入层过载
-12045 SVR_ERR_FAIL_TO_GET_CURSOR 存储层获取遍历游标失败, 可能是同时进行的遍历请求太多,通常不会遇到
-12049 PROXY_ERR_SQL_QUERY_MGR_IS_NULL 未创建索引?
-12051 API_ERR_TABLE_NAME_MISSING 未设置表名
-12301 SVR_ERR_FAIL_OUT_OF_USER_DEF_RANGE 超过用户定义的范围
-12305 PROXY_ERR_SQL_QUERY_INVALID_SQL_TYPE 无效的sql请求
-12307 API_ERR_SOCKET_SEND_BUFF_IS_FULL 请求发送失败,网络过载,请联系管理员。
-12557 SVR_ERR_INVALID_ARGUMENTS 内部参数错误
-12561 PROXY_ERR_GET_TRANSACTION_FAILED 分配失败失败,请联系管理员增加事务并发的配置
-12563 API_ERR_INVALID_MAGIC magic不对,通信出现问题,若一直有该问题,请联系管理员
-12817 PROXY_ERR_ADD_TRANSACTION_FAILED 分配失败失败,请联系管理员增加事务并发的配置
-12819 API_ERR_TABLE_IS_NOT_EXIST 表不存在
-13069 SVR_ERR_NULL_CACHE 不存在该数据分片
-13073 PROXY_ERR_QUERY_FROM_INDEX_SERVER_FAILED 查询全局索引失败
-13075 API_ERR_SHORT_BUFF buff太短
-13329 PROXY_ERR_QUERY_FROM_INDEX_SERVER_TIMEOUT 查询全局索引超时
-13331 API_ERR_FLOW_CONTROL api_flow_control
-13581 SVR_ERR_METALIB_VERSION_LESS_THAN_ENTRY_VERSION the metalib version in request is less than entry version
-13585 PROXY_ERR_QUERY_FOR_CONVERT_TCAPLUS_REQ_TO_INDEX_SERVER_REQ_FAILED 解析全局索引的sql语句失败
-13587 API_ERR_COMPRESS_SWITCH_NOT_SUPPORTED_REGARDING_THIS_CMD 对不支持协议压缩的命令调用的协议压缩SetCompressSwitch
-13837 SVR_ERR_INVALID_SELECT_ID_FOR_UNION 内部错误,请联系管理员
-13841 PROXY_ERR_QUERY_INDEX_FIELD_NOT_EXIST 索引字段不存在
-13843 API_ERR_FAILED_TO_FIND_ROUTE 后台网络异常,请求无法发送成功,如持续存在请联系管理员
-14093 SVR_ERR_CAN_NOT_FIND_SELECT_ENTRY_FOR_UNION 内部错误,请联系管理员
-14097 PROXY_ERR_THIS_SQL_IS_NOT_SUPPORT 不支持的SQL
-14099 API_ERR_OVER_MAX_PKG_SIZE 插入的记录超过大小限制(1MB)
-14353 PROXY_ERR_NO_SUCH_APPID 接入层认证失败,未找到该业务认证信息
-14605 SVR_ERR_TCAPSVR_PROCESS_NOT_NORMAL tcapsvr process in abnormal
-14609 PROXY_ERR_NO_APP_USER_PASSWD 接入层找不到用户认证信息
-14865 PROXY_ERR_NO_APP_USER_PASSWD_RECORD 接入层找不到用户认证信息
-15117 SVR_ERR_INVALID_ARRAY_COUNT 无效的数组大小
-15121 PROXY_ERR_NO_APP_USER_OPT 接入层找不到用户认证信息
-15123 API_ERR_ADD_RECORD failed to add a new record into request
-15373 SVR_ERR_REJECT_REQUEST_BECAUSE_ROUTE_IN_REJECT_STATUS 拒绝请求,svr处于搬迁状态,路由错误。
-15377 PROXY_ERR_NO_APP_USER_OPT_RECORD 接入层未找到用户认证信息
-15379 API_ERR_ZONE_IS_NOT_EXIST 不存在的zone
-15635 API_ERR_TRAVERSER_IS_NOT_EXIST 遍历器不存在
-15885 SVR_ERR_FAIL_INVALID_FIELD_VALUE 无效的字段值
-16141 SVR_ERR_FAIL_PROTOBUF_FIELD_GET PB表GetRecord操作失败,请联系管理员
-16147 API_ERR_INSTANCE_INIT_LOG_FAILURE 初始化日志模块失败
-16389 TXHDB_ERR_INVALID_VALUE_DATABLOCK_NUM 存储层value块个数异常,请联系管理员
-16397 SVR_ERR_FAIL_PROTOBUF_VALUE_BUFF_EXCEED PB表非主键字段值超过限定大小(256KB)
-16403 API_ERR_CONNECTOR_IS_ABNORMAL 连接异常
-16653 SVR_ERR_FAIL_PROTOBUF_FIELD_UPDATE PB表FieldSetRecord操作失败,请联系管理员
-16659 API_ERR_WAIT_RSP_TIMEOUT 超时
-16901 TXHDB_ERR_COMPRESSION_FAIL 压缩失败
-16909 SVR_ERR_FAIL_PROTOBUF_FIELD_INCREASE PB表FieldIncRecord操作失败,请联系管理员
-17157 TXHDB_ERR_DECOMPRESSION_FAIL 解压失败
-17165 SVR_ERR_FAIL_PROTOBUF_FIELD_TAG_MISMATCH PB表tag不匹配
-18445 SVR_ERR_FAIL_DOCUMENT_NOT_SUPPORT 不支持Document类请求
-18701 SVR_ERR_FAIL_PARTKEY_INSERT_NOT_SUPPORT 不支持InsertByPartkey
-18957 SVR_ERR_FAIL_SQL_FILTER_FAILED 分布式索引中,执行sql过滤失败
-33541 TXHDB_ERR_ADD_LSIZE_EXCEEDS_MAX_TSD_VALUE_BUFF_SIZE 内部错误,请联系管理员
-34053 TXHDB_ERR_TOO_BIG_KEY_BIZ_SIZE key超过最大限制1KB
-34309 TXHDB_ERR_TOO_BIG_VALUE_BIZ_SIZE value超过最大限制, 10MB
-34565 TXHDB_ERR_INDEX_NO_EXIST 索引不存在
-39685 TXHDB_ERR_FILE_EXCEEDS_LSIZE_LIMIT 单数据分片超过256GB的最大限制,写入失败

已知问题和SQL局限性

SQL语法的限制

假设数据表demo共有六个字段:key1,key2,key3,value1,value2,其中,key1,key2为partkey,key1,key2,key3组成fullkey。

插入操作

插入操作必须显示指定所有字段的值,除非在表定义中指定了其默认值。 插入单条记录的SQL语句形式如下: INSERT INTO demo (key1,key2,key3,value1,value2) values (x1,x2,x3,x4,x5); 插入多条记录的SQL语句形式如下: INSERT INTO demo (key1,key2,key3,value1,value2) values (x1,x2,x3,x4,x5); INSERT INTO demo (key1,key2,key3,value1,value2) values (x6,x7,x8,x9,x10); ### where子句语法限制

在未配置全局索引的情况下,where子句中的过滤字段由两部分组成:1、必选部分:partkey或fullkey;2、可选部分:过滤条件。 partkey或fullkey:只能进行等值查询,且组成partkey或fullkey的各个字段之间只能用AND连接; 过滤条件:支持NOT、=、>、<、!=、>=、<=运算符,且多个过滤条件之间可以用AND或OR连接,支持key字段或value字段。 1、使用fullkey进行删改查时的where子句形式如下: WHERE key1=x1 AND key2=x2 AND key3=x3; 2、使用fullkey+过滤条件进行删改查时的where子句形式如下,若过滤条件中包含OR运算符,则必须对过滤条件加括号: WHERE key1=x1 AND key2=x2 AND key3=x3 AND (过滤条件); 3、使用partkey进行删改查时的where子句形式如下: WHERE key1=x1 AND key2=x2; 4、使用partkey+过滤条件进行删改查时的where子句形式如下,若过滤条件中包含OR运算符,则必须对过滤条件加括号: WHERE key1=x1 AND key2=x2 AND (过滤条件); 当where子句中的必选部分为partkey时,where子句的执行结果可能是多条记录。

删除操作

1、通过fullkey删除单条记录时,SQL语句有以下两种形式:

DELETE FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3;
DELETE FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3 AND (过滤条件);

2、通过fullkey批量删除记录时,SQL语句形式如下: DELETE FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3; DELETE FROM demo WHERE key1=x4 AND key2=x5 AND key3=x6; 删除/批量删除操作不支持partkey,批量删除操作暂不支持过滤条件。

更新操作

1、通过fullkey更新单条记录时,SQL语句有以下两种形式:

UPDATE demo SET value1=x1, value2=x2 WHERE key1=x1 AND key2=x2 AND key3=x3;
UPDATE demo SET value1=x1, value2=x2 WHERE key1=x1 AND key2=x2 AND key3=x3 AND (过滤条件);

2、通过fullkey批量更新记录时,SQL语句形式如下: UPDATE demo SET value1=x1, value2=x2 WHERE key1=x3 AND key2=x4 AND key3=x5; UPDATE demo SET value1=x6, value2=x7 WHERE key1=x8 AND key2=x9 AND key3=x10; 更新/批量更新操作不支持partkey,批量更新操作暂不支持过滤条件。

查询操作

1、通过fullkey查询单条记录时,SQL语句有以下四种形式:

SELECT * FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3;
SELECT * FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3 AND (过滤条件);
SELECT key1,value1 FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3;
SELECT key1,value1 FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3 AND (过滤条件);

2、通过partkey查询多条记录时,SQL语句有以下四种形式:

SELECT * FROM demo WHERE key1=x1 AND key2=x2;
SELECT * FROM demo WHERE key1=x1 AND key2=x2 AND (过滤条件);
SELECT key1,value1 FROM demo WHERE key1=x1 AND key2=x2;
SELECT key1,value1 FROM demo WHERE key1=x1 AND key2=x2 AND (过滤条件);

3、通过fullkey批量查询记录时,SQL语句的形式如下: SELECT * FROM demo WHERE key1=x1 AND key2=x2 AND key3=x3 OR key1=x4 AND key2=x5 AND key3=x6; 批量查询操作暂不支持过滤条件。 4、通过partkey批量查询记录时,SQL语句的形式如下: SELECT * FROM demo WHERE key1=x1 AND key2=x2 OR key1=x3 AND key2=x4; 批量查询操作暂不支持过滤条件。

全局索引查询

TcaplusDB提供sql查询语句进行索引查询,其中,sql查询条件中的字段必须是建立了全局索引的字段,另外,如果是聚合查询,那么聚合查询的字段也必须是建立了全局索引的字段; 一个索引查询请求,当前限制最多返回3000条记录;

支持的sql查询语句

条件查询

支持 =, >, >=, <, <=, !=, between, in, not in, like, not like, and, or , 比如:

SELECT * FROM `mail` WHERE user_id>="10004" AND server_id=100;
SELECT * FROM `mail` WHERE user_id BETWEEN 10000 AND 10003 AND server_id=100;
SELECT * FROM `mail` WHERE user_id="10000" AND server_id=100 AND mail_id LIKE "210507%";
SELECT * FROM `mail` WHERE user_id>="10004" OR server_id<=200;

注意:between查询时,between a and b,对应的查询范围为[a, b],比如 between 1 and 100, 是会包含1和100这两个值的,即查询范围为[1,100] 注意:like查询是支持模糊匹配,其中"%"通配符,匹配0个或者多个字符; “_”通配符,匹配1个字符;

分页查询

支持limit offset分页查询,比如: SELECT * FROM mail WHERE user_id>"10000" LIMIT 100 OFFSET 2; 注意:当前limit必须与offset搭配使用,即不支持limit 1 或者 limit 0,1这种;

聚合查询

当前支持的聚合查询包括:sum, count, max, min, avg,比如: SELECT server_id, COUNT(DISTINCT user_id), COUNT(*), SUM(state) FROM \mail` WHERE user_id>="10000" AND server_id=100;` 注意:聚合查询不支持limit offset,即limit offset 不生效; 注意:目前只有count支持distinct,即 select count(distinct(a)) from table where a > 1000; 其他情况均不支持distinct

部分字段查询

支持查询部分字段的值,比如: SELECT user_id, \subject` FROM mail WHERE user_id>="10000";` ### 不支持的sql查询语句

不支持聚合查询与非聚合查询混用

select , a, b from table where a > 1000; select sum(a), a, b from table where a > 1000; select count(), * from table where a > 1000;

不支持order by查询

select * from table where a > 1000 order by a;

不支持group by查询

select * from table where a > 1000 group by a;

不支持having查询

select sum(a) from table where a > 1000 group by a having sum(a) > 10000;

不支持多表联合查询

select * from table1 where table1.a > 1000 and table1.a = table2.b;

不支持嵌套select查询

select * from table where a > 1000 and b in (select b from table where b < 5000);

不支持的其他查询

(1)不支持join查询; (2)不支持union查询; (3)不支持类似 select a+b from table where a > 1000 的查询; (4)不支持类似 select from table where a+b > 1000 的查询; (5) 不支持类似 select from table where a >= b 的查询; (6)不支持其他未提到的查询;

事务支持

TcaplusDB暂不支持跨数据行的事务。 调用TcaplusDB SQL Driver/C++的Connection.commit()方法,实际上是将多条增删改语句(从上次commit到当前时间通过Statement.executeUpdate()方法执行的语句)一并提交给服务端执行。这里需要注意的是,由于多条语句是在同一个请求中发送到服务端,受请求包大小的限制,这里当前限制每次提交的语句上限是100条。 由于暂不支持跨数据行的事务,同一批提交的语句,有可能部分成功,部分失败,此时可以先通过Statement.getUpdateCount()方法,获取实际增删改的数据条,判断是否符合预期,与些同时,也可以通过Statement.getResultSet()获取增删改失败的数据主键信息,后台会通过该接口将失败的数据的主键列的值返回给应用。

特定平台考虑因素

Windows

在Windows上,可以在不同的构建配置中构建应用程序,这些配置确定最终可执行文件使用的C++运行时库的类型:

 

  • 应用程序可以在32位或64位模式下构建.

  • 可以在发布或调试模式下构建应用程序。

  • 您可以在动态运行时库( /MD 链接器选项)或静态运行库( /MT 链接器选项)。MSVC编译器的不同版本也使用运行时库的不同版本。

要构建TcaplusDB SQL Driver/C++应用程序,使用Windows的构建人员必须满足以下条件:

 

  • 需要MicrosoftVisualStudio的可接受版本。

  • 应用程序应该使用与构建TcaplusDB SQL Driver/C++相同的构建配置。生成配置包括构建模式(发布模式或调试模式)和链接器选项(例如, /MD/MDd ).

  • 运行客户端应用程序的目标主机必须具有可接受版本的Visual C++。

以下部分提供了有关构建TcaplusDB SQL Driver/C++应用程序的几个方面的其他详细信息:

应用程序构建配置必须与TcaplusDB SQL Driver/C++匹配

使用兼容的编译器版本构建应用程序和TcaplusDB SQL Driver/C++非常重要。使用与构建TcaplusDB SQL Driver/C++相同的构建配置构建应用程序也很重要。也就是说,应用程序应该使用相同的构建模式和链接器选项,以确保TcaplusDB SQL Driver/C++和应用程序使用相同的运行时库。 下表显示了适用于构建模式和运行时库的每个组合的链接器选项。它还显示了每个组合是否可以从TcaplusDB获得TcaplusDB SQL Driver/C++二进制包。(如果不是,您必须自己构建TcaplusDB SQL Driver/C++。) 表5.1每个构建模式和运行时库的TcaplusDB SQL Driver/C++链接器选项

构建模式运行库链接器选项二进制包可用
释放 动态 /MD
调试 动态 /MDd
释放 静态 /MT 否(从源头构建)
调试 静态 /MTd 否(从源头构建)

表5.2目前支持的版本信息对应关系

TcaplusDB SQL Driver/C++ 版本TcaplusDB版本VC版本tsf4g版本链接器选项
Tcaplus_SQLDriver_3.53.1.24f9d0e62f_Win64Vc14MT_Release_xxxxxxx 3.53.1 VC14 TSF4G_BASE-2.7.30.191616_Win64Vc14Mt_Release /MT
Tcaplus_SQLDriver_3.53.1.24f9d0e62f_Win64Vc14MD_Release_xxxxxxx 3.53.1 VC14 TSF4G_BASE-2.7.30.191616_Win64Vc14Md_Release /MD

 

发布包在windows下的使用
  • tsf4gbase库,下载对应版本,请注意VC的版本,采用MD(多线程DLL)或MT(多线程静态),还有Debug或Release版本

  • 添加tsf4gbase库目录:工程---属性---配置属性---VC++目录---库目录:加上lib文件存放目录.

  • 解压TcaplusDB SQL Driver/C++发布包,vs2015(及以上版本)新建工程.

  • 添加工程的头文件目录:工程---属性---配置属性---c/c++---常规---附加包含目录:加上头文件存放目录.

  • 添加文件引用的lib静态库路径:工程---属性---配置属性---链接器---常规---附加库目录:加上lib文件存放目录.

  • 然后添加工程引用的lib文件名:工程---属性---配置属性---链接器---输入---附加依赖项:加上lib文件名

当前支持接口

Connection

/*
Creates a Statement object for sending SQL statements to the database. SQL statements without parameters are normally executed using Statement objects. 
If the same SQL statement is executed many times, it may be more efficient to use a PreparedStatement object.
Returns:
    a new default Statement object
Throws:
    SQLException - if a database access error occurs or this method is called on a closed connection
*/
sql::Statement * createStatement();
/*
Retrieves the driver that produced this connection object.
Returns:
    the driver that produced this connection object
Throws:
    SQLException - if a database access error occurs
*/
Driver *getDriver();
/*
Releases this Connection object's database 
Specified by:
    close in interface AutoCloseable
Throws:
    SQLException - SQLException if a database access error occurs
*/
void close();
/*
Retrieves a DatabaseMetaData object that contains metadata about the database to which this Connection object represents a connection. 
The metadata includes information about the database's tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on.
Returns:
    a DatabaseMetaData object for this Connection object
Throws:
    SQLException - if a database access error occurs or this method is called on a closed connection
*/
sql::DatabaseMetaData * getMetaData();
/*
Retrieves whether this Connection object has been closed. A connection is closed if the method close has been called on it or if certain fatal errors have occurred. 
This method is guaranteed to return true only when it is called after the method Connection.close has been called.
This method generally cannot be called to determine whether a connection to a database is valid or invalid. 
A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted.
Returns:
    true if this Connection object is closed; false if it is still open
Throws:
    SQLException - if a database access error occurs
*/
bool isClosed();
/*
Creates a PreparedStatement object for sending parameterized SQL statements to the database.
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. 
This object can then be used to efficiently execute this statement multiple times.
Parameters:
    sql - an SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
    a new default PreparedStatement object containing the pre-compiled SQL statement
Throws:
    SQLException - if a database access error occurs or this method is called on a closed connection
*/
sql::PreparedStatement * prepareStatement(const sql::SQLString& sql);

 

DatabaseMetaData

/*
Retrieves a description of the tables available in the connection. 
Each table description has the following columns:
TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
REMARKS String => explanatory comment on the table
TYPE_CAT String => the types catalog (may be null)
TYPE_SCHEM String => the types schema (may be null)
TYPE_NAME String => type name (may be null)
SELF_REFERENCING_COL_NAME String => name of the designated "identifier" column of a typed table (may be null)
REF_GENERATION String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)
Note: Some databases may not return information for all tables.
Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; (not support)
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; (not support)
tableNamePattern - a table name pattern; must match the table name as it is stored in the database; (not support)
types - a list of table types, which must be from the list of table types returned from getTableTypes(),to include; (not support)
Returns:
    ResultSet - each row is a table description
Throws:
    SQLException - if a database access error occurs
*/
sql::ResultSet * getTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, std::list<sql::SQLString> &types);
/*
Retrieves a description of table columns available in the connection.
Each column description has the following columns:
TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
COLUMN_NAME String => column name
DATA_TYPE int => SQL type from java.sql.Types
TYPE_NAME String => Data source dependent type name, for a UDT the type name is fully qualified
COLUMN_SIZE int => column size.
BUFFER_LENGTH is not used.
DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
NUM_PREC_RADIX int => Radix (typically either 10 or 2)
NULLABLE int => is NULL allowed.
columnNoNulls - might not allow NULL values
columnNullable - definitely allows NULL values
columnNullableUnknown - nullability unknown
REMARKS String => comment describing column (may be null)
COLUMN_DEF String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
SQL_DATA_TYPE int => unused
SQL_DATETIME_SUB int => unused
CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
ORDINAL_POSITION int => index of column in table (starting at 1)
IS_NULLABLE String => ISO rules are used to determine the nullability for a column.
YES --- if the column can include NULLs
NO --- if the column cannot include NULLs
empty string --- if the nullability for the column is unknown
SCOPE_CATALOG String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
SCOPE_SCHEMA String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
SCOPE_TABLE String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
SOURCE_DATA_TYPE short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
IS_AUTOINCREMENT String => Indicates whether this column is auto incremented
YES --- if the column is auto incremented
NO --- if the column is not auto incremented
empty string --- if it cannot be determined whether the column is auto incremented
IS_GENERATEDCOLUMN String => Indicates whether this is a generated column
YES --- if this a generated column
NO --- if this not a generated column
empty string --- if it cannot be determined whether this is a generated column
The COLUMN_SIZE column specifies the column size for the given column. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. Null is returned for data types where the column size is not applicable.
Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; (not support)
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; (not support)
tableNamePattern - a table name pattern; must match the table name as it is stored in the database
columnNamePattern - a column name pattern; must match the column name as it is stored in the database (not support)
Returns:
ResultSet - each row is a column description
Throws:
SQLException - if a database access error occurs
*/
sql::ResultSet * getColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, const sql::SQLString& columnNamePattern);
/*
Retrieves the connection that produced this metadata object.
Returns:
    the connection that produced this metadata object
Throws:
    SQLException - if a database access error occurs
*/
sql::Connection * getConnection();

 

Statement

/*
Retrieves the connection that produced this statement object.
Returns:
    the connection that produced this statement object
Throws:
    SQLException - if a database access error occurs
*/
sql::Connection * getConnection();
/*
Releases this Statement object
Specified by:
    close in interface AutoCloseable
Throws:
    SQLException - if a database access error occurs
*/
void close();
/*
Executes the given SQL statement, which may return multiple results. In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. 
Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.
The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, 
and getMoreResults to move to any subsequent result(s).
Note:This method cannot be called on a PreparedStatement or CallableStatement.
Parameters:
    sql - any SQL statement
Returns:
    true if the first result is a ResultSet object; false if it is an update count or there are no results
Throws:
    SQLException - if a database access error occurs, this method is called on a closed Statement, the method is called on a PreparedStatement or CallableStatement
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
bool execute(const sql::SQLString& sql);
/*
Executes the given SQL statement, which returns a single ResultSet object.
Note:This method cannot be called on a PreparedStatement or CallableStatement.
Parameters:
    sql - an SQL statement to be sent to the database, typically a static SQL SELECT statement
Returns:
    a ResultSet object that contains the data produced by the given query; never null
Throws:
    SQLException - if a database access error occurs, this method is called on a closed Statement, the given SQL statement produces anything other than a single ResultSet object, 
    the method is called on a PreparedStatement or CallableStatement
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
sql::ResultSet * executeQuery(const sql::SQLString& sql);
/*
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.
Note:This method cannot be called on a PreparedStatement or CallableStatement.
Parameters:
    sql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.
Returns:
    either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
Throws:
    SQLException - if a database access error occurs, this method is called on a closed Statement, the given SQL statement produces a ResultSet object, 
    the method is called on a PreparedStatement or CallableStatement
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
int executeUpdate(const sql::SQLString& sql);
/*
Retrieves the current result as a ResultSet object. This method should be called only once per result.
Returns:
    the current result as a ResultSet object or null if the result is an update count or there are no more results
Throws:
    SQLException - if a database access error occurs or this method is called on a closed Statement
*/
sql::ResultSet * getResultSet();
/*
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned. This method should be called only once per result.
Returns:
    the current result as an update count; -1 if the current result is a ResultSet object or there are no more results
Throws:
    SQLException - if a database access error occurs or this method is called on a closed Statement
*/
uint64_t getUpdateCount();
/*
Retrieves the number of seconds the driver will wait for a Statement object to execute.(default 5 second) If the limit is exceeded, a SQLException is thrown.
Returns:
    the current query timeout limit in seconds; zero means there is no limit
Throws:
    SQLException - if a database access error occurs or this method is called on a closed Statement
*/
unsigned int getQueryTimeout();
/*
Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds. By default there is 5 second
Parameters:
    seconds - the new query timeout limit in seconds; zero means there is no limit
Throws:
    SQLException - if a database access error occurs, this method is called on a closed Statement or the condition seconds >= 0 is not satisfied
*/
void setQueryTimeout(unsigned int seconds);

 

PreparedStatement

/*
Retrieves the connection that produced this prepared statement object.
Returns:
    the connection that produced this prepared statement object
Throws:
    SQLException - if a database access error occurs
*/
sql::Connection *getConnection();
/*
Clears the current parameter values immediately.
In general, parameter values remain in force for repeated use of a statement. Setting a parameter value automatically clears its previous value. 
However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the method clearParameters.
Throws:
    SQLException - if a database access error occurs or this method is called on a closed PreparedStatement
*/
void clearParameters();
/*
Releases this Prepared Statement object
Specified by:
    close in interface AutoCloseable
Throws:
    SQLException - SQLException if a database access error occurs
*/
void close();
/*
Executes the SQL statement in this PreparedStatement object, which may be any kind of SQL statement. Some prepared statements return multiple results; 
the execute method handles these complex statements as well as the simpler form of statements handled by the methods executeQuery and executeUpdate.
The execute method returns a boolean to indicate the form of the first result. You must call either the method getResultSet or getUpdateCount to retrieve the result; 
you must call getMoreResults to move to any subsequent result(s).
Returns:
    true if the first result is a ResultSet object; false if the first result is an update count or there is no result
Throws:
    SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or an argument is supplied to this method
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
bool execute();
/*
Executes the SQL statement in this PreparedStatement object, which may be any kind of SQL statement. Some prepared statements return multiple results; 
the execute method handles these complex statements as well as the simpler form of statements handled by the methods executeQuery and executeUpdate.
The execute method returns a boolean to indicate the form of the first result. You must call either the method getResultSet or getUpdateCount to retrieve the result; 
you must call getMoreResults to move to any subsequent result(s).
Parameters:
    sql - an SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
    true if the first result is a ResultSet object; false if the first result is an update count or there is no result
Throws:
    SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or an argument is supplied to this method
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
bool execute(const sql::SQLString& sql);
/*
Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.
Returns:
a ResultSet object that contains the data produced by the query; never null
Throws:
    SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement does not return a ResultSet object
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
sql::ResultSet *executeQuery();
/*
Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.
Parameters:
    sql - an SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
a ResultSet object that contains the data produced by the query; never null
Throws:
    SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement does not return a ResultSet object
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
sql::ResultSet *executeQuery(const sql::SQLString& sql);
/*
Executes the SQL statement in this PreparedStatement object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; 
or an SQL statement that returns nothing, such as a DDL statement.
Returns:
    either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
Throws:
    SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement returns a ResultSet object
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
int executeUpdate();
/*
Executes the SQL statement in this PreparedStatement object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; 
or an SQL statement that returns nothing, such as a DDL statement.
Parameters:
    sql - an SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
    either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
Throws:
    SQLException - if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement returns a ResultSet object
    SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least 
    attempted to cancel the currently running Statement
*/
int executeUpdate(const sql::SQLString& sql);
/*
Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds. By default there is 5 second
Parameters:
    seconds - the new query timeout limit in seconds; zero means there is no limit
Throws:
    SQLException - if a database access error occurs, this method is called on a closed Statement or the condition seconds >= 0 is not satisfied
*/
void setQueryTimeout(unsigned int seconds);
/*
Retrieves the number of seconds the driver will wait for a Statement object to execute.(default 5 second) If the limit is exceeded, a SQLException is thrown.
Returns:
    the current query timeout limit in seconds; zero means there is no limit
Throws:
    SQLException - if a database access error occurs or this method is called on a closed Statement
*/
unsigned int getQueryTimeout();
/*
Retrieves the current result as a ResultSet object. This method should be called only once per result.
Returns:
    the current result as a ResultSet object or null if the result is an update count or there are no more results
Throws:
    SQLException - if a database access error occurs or this method is called on a closed Statement
*/
sql::ResultSet * getResultSet();
/*
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned. This method should be called only once per result.
Returns:
    the current result as an update count; -1 if the current result is a ResultSet object or there are no more results
Throws:
    SQLException - if a database access error occurs or this method is called on a closed Statement
*/
uint64_t getUpdateCount();
/*
Sets the designated parameter to a istream object. The driver converts this to an SQL VARBINARY value when it sends it to the database.
Parameters:
    parameterIndex - index of the first parameter is 1, the second is 2, ...
    inputStream - An object that contains the data to set the parameter value to.
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setBlob(unsigned int parameterIndex, std::istream * inputStream);
/*
Sets the designated parameter to the given data time value. e.g '2016:08:02 12:12:30' The driver converts this to an SQL BIGINT value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setDateTime(unsigned int parameterIndex, const sql::SQLString& value);
/*
Sets the designated parameter to the given double value. The driver converts this to an SQL DOUBLE value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setDouble(unsigned int parameterIndex, double value);
/*
Sets the designated parameter to the given int32_t value. The driver converts this to an SQL INTEGER value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setInt(unsigned int parameterIndex, int32_t value);
/*
Sets the designated parameter to the given uint32_t value. The driver converts this to an SQL INTEGER value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setUInt(unsigned int parameterIndex, uint32_t value);
/*
Sets the designated parameter to the given int64_t value. The driver converts this to an SQL BIGINT value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setInt64(unsigned int parameterIndex, int64_t value);
/*
Sets the designated parameter to the given uint64_t value. The driver converts this to an SQL BIGINT value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setUInt64(unsigned int parameterIndex, uint64_t value);
/*
Sets the designated parameter to the given String value. The driver converts this to an SQL VARCHAR when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    x - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setString(unsigned int parameterIndex, const sql::SQLString& value);
/*
Sets the designated parameter to the given int8_t value. The driver converts this to an SQL TINYINT when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    x - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setInt8(unsigned int parameterIndex, int8_t value);
/*
Sets the designated parameter to the given uint8_t value. The driver converts this to an SQL TINYINT when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    x - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setUInt8(unsigned int parameterIndex, uint8_t value);
/*
Sets the designated parameter to the given int16_t value. The driver converts this to an SQL SMALLINT when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    x - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setInt16(unsigned int parameterIndex, int16_t value);
/*
Sets the designated parameter to the given uint16_t value. The driver converts this to an SQL SMALLINT when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    x - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setUInt16(unsigned int parameterIndex, uint16_t value);
/*
Sets the designated parameter to the given float value. The driver converts this to an SQL REAL value when it sends it to the database.
Parameters:
    parameterIndex - the first parameter is 1, the second is 2, ...
    value - the parameter value
Throws:
    SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement; 
    if a database access error occurs or this method is called on a closed PreparedStatement
*/
void setFloat(unsigned int parameterIndex, float value);

 

ResultSet

/*
Releases this ResultSet object
When a ResultSet is closed, any ResultSetMetaData instances that were created by calling the getMetaData method remain accessible.
Calling the method close on a ResultSet object that is already closed is a no-op.
Specified by:
    close in interface AutoCloseable
Throws:
    SQLException - if a database access error occurs
*/
void close();
/*
Maps the given ResultSet column label to its ResultSet column index.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column index of the given column name
Throws:
    SQLException - if the ResultSet object does not contain a column labeled columnLabel, a database access error occurs or this method is called on a closed result set
*/
uint32_t findColumn(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a Blob istream.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    a Blob object representing the SQL BLOB value in the specified column
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
    SQLFeatureNotSupportedException - if the JDBC driver does not support this method
*/
std::istream * getBlob(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a Blob istream.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    a Blob object representing the SQL BLOB value in the specified column
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
    SQLFeatureNotSupportedException - if the JDBC driver does not support this method
*/
std::istream * getBlob(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a bool type.
If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, 
a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or 
BIGINT and contains a 1, a value of true is returned.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is false
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
bool getBoolean(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a bool type.
If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, 
a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or 
BIGINT and contains a 1, a value of true is returned.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is false
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
bool getBoolean(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a double type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
long double getDouble(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a double type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
long double getDouble(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int32_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
int32_t getInt(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int32_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
int32_t getInt(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint32_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint32_t getUInt(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint32_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint32_t getUInt(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int64_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
int64_t getInt64(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int64_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
int64_t getInt64(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint64_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint64_t getUInt64(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint64_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint64_t getUInt64(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int8_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
int8_t getInt8(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int8_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
int8_t getInt8(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint8_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint8_t getUInt8(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint8_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint8_t getUInt8(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int16_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
int16_t getInt16(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an int16_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
int16_t getInt16(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint16_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint16_t getUInt16(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an uint16_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
uint16_t getUInt16(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an float type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
float getFloat(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as an float type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
float getFloat(const sql::SQLString& columnLabel) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a String type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is ""
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
SQLString getString(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a String type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is ""
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
SQLString getString(const sql::SQLString& columnLabel) const;
/*
Retrieves the number, types and properties of this ResultSet object's columns.
Returns:
    the description of this ResultSet object's columns
Throws:
    SQLException - if a database access error occurs or this method is called on a closed result set
*/
sql::ResultSetMetaData * getMetaData() const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a time_t type.
Parameters:
    columnIndex - the first column is 1, the second is 2, ...
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
*/
time_t getTimestamp(uint32_t columnIndex) const;
/*
Retrieves the value of the designated column in the current row of this ResultSet object as a time_t type.
Parameters:
    columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
    the column value; if the value is SQL NULL, the value returned is 0
Throws:
    SQLException - if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
*/
time_t getTimestamp(const sql::SQLString& columnLabel) const;
/*
Moves the cursor froward one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes 
the first row the current row; the second call makes the second row the current row, and so on.
When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result 
in a SQLException being thrown. If the result set type is TYPE_FORWARD_ONLY, it is vendor specified whether their JDBC driver implementation will return false or 
throw an SQLException on a subsequent call to next.
Returns:
    true if the new current row is valid; false if there are no more rows
Throws:
    SQLException - if a database access error occurs or this method is called on a closed result set
*/
bool next();
/*
Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the method close has been called on it, or if it is automatically closed.
Returns:
    true if this ResultSet object is closed; false if it is still open
Throws:
    SQLException - if a database access error occurs
*/
bool isClosed() const;

 

ResultSetMetaData

/*
Returns the number of columns in this ResultSet object.
Returns:
    the number of columns
Throws:
    SQLException - if a database access error occurs
*/
unsigned int getColumnCount();
/*
Gets the designated column's suggested title for use in printouts and displays. The suggested title is usually specified by the SQL AS clause. 
If a SQL AS is not specified, the value returned from getColumnLabel will be the same as the value returned by the getColumnName method.
Parameters:
    column - the first column is 1, the second is 2, ...
Returns:
    the suggested column title
Throws:
    SQLException - if a database access error occurs
*/
SQLString getColumnLabel(unsigned int columnIndex);
/*
Get the designated column's name.
Parameters:
    column - the first column is 1, the second is 2, ...
Returns:
    column name
Throws:
    SQLException - if a database access error occurs
*/
SQLString getColumnName(unsigned int columnIndex);
/*
Retrieves the designated column's SQL type.
Parameters:
    column - the first column is 1, the second is 2, ...
Returns:
    SQL type from java.sql.Types
Throws:
    SQLException - if a database access error occurs
*/
int getColumnType(unsigned int columnIndex);
/*
Retrieves the designated column's database-specific type name.
Parameters:
    column - the first column is 1, the second is 2, ...
Returns:
    type name used by the database. If the column type is a user-defined type, then a fully-qualified type name is returned.
Throws:
    SQLException - if a database access error occurs
*/
SQLString getColumnTypeName(unsigned int columnIndex);

img

TcaplusDB是腾讯出品的分布式NoSQL数据库,存储和调度的代码完全自研。具备缓存+落地融合架构、PB级存储、毫秒级时延、无损水平扩展和复杂数据结构等特性。同时具备丰富的生态、便捷的迁移、极低的运维成本和五个九高可用等特点。客户覆盖游戏、互联网、政务、金融、制造和物联网等领域。

标签:Tcaplus,ERR,database,column,TcaplusDB,Driver,value,SQL,method
来源: https://www.cnblogs.com/TcaplusDBers/p/16381000.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有