开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
2 Star 0 Fork 0

万里数据库/GreatSQL-Cluster

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
标签 (1)
master
greatsql-cluster-8.4.4-4
GreatSQL-Cluster-8.4.4-4
master
分支 (2)
标签 (1)
master
greatsql-cluster-8.4.4-4
GreatSQL-Cluster-8.4.4-4
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
标签 (1)
master
greatsql-cluster-8.4.4-4
GreatSQL-Cluster-8.4.4-4
GreatSQL-Cluster
/
plugin
/
x
/
src
/
statement_builder.h
GreatSQL-Cluster
/
plugin
/
x
/
src
/
statement_builder.h
statement_builder.h 5.95 KB
一键复制 编辑 原始数据 按行查看 历史
GreatSQL 提交于 2025年11月15日 22:14 +08:00 . first commit for GreatSQL Cluster 8.4.4-4
/*
* Copyright (c) 2015, 2024, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PLUGIN_X_SRC_STATEMENT_BUILDER_H_
#define PLUGIN_X_SRC_STATEMENT_BUILDER_H_
#include <algorithm>
#include <functional>
#include <string>
#include "plugin/x/generated/mysqlx_error.h"
#include "plugin/x/src/expr_generator.h"
#include "plugin/x/src/ngs/error_code.h"
#include "plugin/x/src/ngs/protocol/protocol_protobuf.h"
#include "plugin/x/src/ngs/protocol_fwd.h"
namespace xpl {
class Statement_builder {
public:
template <typename T>
using Repeated_field_list = Expression_generator::Repeated_field_list<T>;
explicit Statement_builder(const Expression_generator &gen)
: m_builder(gen) {}
protected:
using Collection = ::Mysqlx::Crud::Collection;
void add_collection(const Collection &table) const;
bool is_prep_stmt_mode() const { return m_builder.m_gen.is_prep_stmt_mode(); }
template <typename T>
void add_alias(const T &item) const {
if (item.has_alias()) m_builder.put(" AS ").put_identifier(item.alias());
}
class Generator {
public:
explicit Generator(const Expression_generator &gen)
: m_gen(gen), m_qb(gen.query_string_builder()) {}
template <typename T>
const Generator &put_expr(const T &expr) const {
m_gen.feed(expr);
return *this;
}
template <typename I, typename Op>
const Generator &put_each(I begin, I end, Op generate) const {
std::for_each(begin, end, generate);
return *this;
}
template <typename L, typename Op>
const Generator &put_each(const L &list, Op generate) const {
return put_each(list.begin(), list.end(), generate);
}
template <typename I, typename Op>
const Generator &put_list(I begin, I end, Op generate,
const std::string &separator = ",") const {
if (std::distance(begin, end) == 0) return *this;
generate(*begin);
for (++begin; begin != end; ++begin) {
m_qb.put(separator);
generate(*begin);
}
return *this;
}
template <typename L, typename Op>
const Generator &put_list(const L &list, Op generate,
const std::string &separator = ",") const {
return put_list(list.begin(), list.end(), generate, separator);
}
template <typename T>
const Generator &put_list(const Repeated_field_list<T> &list,
const Generator &(Generator::*put_fun)(const T &)
const,
const std::string &separator = ",") const {
return put_list(list.begin(), list.end(),
std::bind(put_fun, this, std::placeholders::_1),
separator);
}
template <typename T>
const Generator &put(const T &str) const {
m_qb.put(str);
return *this;
}
const Generator &put(const Query_string_builder &str) const {
m_qb.put(str.get());
return *this;
}
const Generator &put_identifier(const std::string &str) const {
m_qb.quote_identifier(str);
return *this;
}
const Generator &put_quote(const std::string &str) const {
m_qb.quote_string(str);
return *this;
}
const Generator &dot() const {
m_qb.dot();
return *this;
}
Expression_generator::Arg_list args() const { return m_gen.args(); }
const Expression_generator &m_gen;
Query_string_builder &m_qb;
} m_builder;
};
class Crud_statement_builder : public Statement_builder {
public:
explicit Crud_statement_builder(const Expression_generator &gen)
: Statement_builder(gen) {}
protected:
using Filter = ::Mysqlx::Expr::Expr;
using Limit = ::Mysqlx::Crud::Limit;
using LimitExpr = ::Mysqlx::Crud::LimitExpr;
using Order_item = ::Mysqlx::Crud::Order;
using Order_list = Repeated_field_list<Order_item>;
void add_filter(const Filter &filter) const;
void add_order(const Order_list &order) const;
void add_limit_field(const Limit &limit, const bool disallow_offset) const;
void add_limit_expr_field(const LimitExpr &limit,
const bool disallow_offset) const;
void add_order_item(const Order_item &item) const;
template <typename Message>
void add_limit(const Message &msg, const bool disallow_offset) const;
};
template <typename Message>
void Crud_statement_builder::add_limit(const Message &msg,
const bool disallow_offset) const {
if (msg.has_limit() && msg.has_limit_expr()) {
throw ngs::Error_code(ER_X_BAD_MESSAGE,
"Invalid message, one of 'limit' and 'limit_expr' "
"fields is allowed. Received both");
}
if (msg.has_limit()) add_limit_field(msg.limit(), disallow_offset);
if (msg.has_limit_expr())
add_limit_expr_field(msg.limit_expr(), disallow_offset);
}
} // namespace xpl
#endif // PLUGIN_X_SRC_STATEMENT_BUILDER_H_
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

GreatSQL Cluster是GreatSQL社区开源的分布式关系型数据库,具备卓越的水平扩展能力、金融级的数据一致性、秒级故障自动无损容灾能力以及完整SQL语法支持等重要特性。
取消

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/GreatSQL/GreatSQL-Cluster.git
git@gitee.com:GreatSQL/GreatSQL-Cluster.git
GreatSQL
GreatSQL-Cluster
GreatSQL-Cluster
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /