sqlbuilder

Generic SQL builder .NET

拥有回忆 提交于 2019-12-08 17:56:30
问题 I'm looking for a way to write an SQL statement in C# targeting different providers. A typical example of SQL statements differentiating is the LIMIT in PostgreSQL vs. TOP in MSSQL. Is the only way to solve SQL-syntax like the two above to write if-statements depending on which provider the user selects or using try catch statements as flow control ( LIMIT didn't work, I'll try TOP instead )? I've seen the LINQ Take method, but I'm wondering if one can do this without LINQ? In other words,

How do I build a dynamic sql query with Dapper.SqlBuilder and OrWhere

泪湿孤枕 提交于 2019-12-06 04:12:07
问题 I am attempting to build a dynamic Sql query for multiple search terms. I understand in general how to use the builder, but am not sure what to do in the loop since I actually need the @term to be different each time (I think). Not just in the query, but in the anonymous type as well to match. I could use a string.Format in the query string, but not sure how to match it in the anonymous type? public async Task<List<Thing>> Search(params string[] searchTerms) { var builder = new SqlBuilder();

D语言(Dlang)ORM

眉间皱痕 提交于 2019-12-03 09:47:20
前言 为了让Dlang像 Java / PHP / C# 一样具有非常好的数据库操作体验,我们了解了 PDO、JDBC、HIBERNATE、ADO.NET,最终发现大家的设计都不是很统一,只有 Java 最新的持久化标准 JPA 是真正的具有可移植性,所以我们准备自己实现一套 JPA 机制,命名为 dlang-entity。 分析 分析的时候发现 dlang 官方没有任何标准的数据库操作接口,也就是像 PDO / JDBC / ADO.NET 这样的东东都不存在…… 继续分析发现上层还有 SQL BUILDER ,最上层还有 Entity 的一系列管理,最终我们把 ORM 分成了 4 个层,分别是 Database / DBAL / CriteriaQuery/ Entity 层次功能 Database 负责基础的数据库访问,接收 SQL 语句,类似于 PDO、JDBC、ADO.NET; DBAL 负责实现 SQL BUILDER,依赖 Database; CriteriaQuery 是调用 DBAL 层,和 Entity 的实体进行关系绑定; Entity 见名之意就是实体,下面依赖 DBAL 和 CriteriaQuery。 难点分析 上面的架构是分层实现,但是对于功能来说是从外而内,Database 和 Entity 是同步设计的,目前参考了 JPA 的接口设计

SQL Builder for PHP, with JOIN support?

流过昼夜 提交于 2019-11-29 11:13:04
Are any of you aware of a library that helps you build/manipulate SQL queries, that supports JOIN's? It would give a lot of flexibility i'd think if you have something where you could return an object, that has some query set, and still be able to apply JOIN's to it, subqueries and such. I've search around, and have only found SQL Builder, which seems very basic, and doesn't support joins. Which would be a major feature that would really make it useful. Maybe you can try an ORM , like Propel or Doctrine , they have a nice programmatic query language, and they return you arrays of objects that

sharding-jdbc之SQL改写

风流意气都作罢 提交于 2019-11-29 07:26:33
【引用官网】在包含分表的场景中,需要将分表配置中的逻辑表名称改写为路由之后所获取的真实表名称。仅分库则不需要表名称的改写。除此之外,还包括补列和分页信息修正等内容,如图: 本文主要以SELECT i.* FROM t_order_1 o, t_order_item_1 i WHERE o.order_id = i.order_id and o.order_id = ? and o.user_id = ?一个简单查询语句,来分析ss大致如何来改写sql的,不同类型sql改写需自行查看对应的sql token生成器 比如分页查看OffsetTokenGenerator 1.BaseShardingEngine#shard执行改写,主要查看rewriteAndConvert方法 @RequiredArgsConstructor public abstract class BaseShardingEngine { //分库分表规则 private final ShardingRule shardingRule; //分片参数 private final ShardingProperties shardingProperties; //分片元数据 private final ShardingMetaData metaData; //路由钩子 private final

SQL Builder for PHP, with JOIN support?

≡放荡痞女 提交于 2019-11-28 05:02:47
问题 Are any of you aware of a library that helps you build/manipulate SQL queries, that supports JOIN's? It would give a lot of flexibility i'd think if you have something where you could return an object, that has some query set, and still be able to apply JOIN's to it, subqueries and such. I've search around, and have only found SQL Builder, which seems very basic, and doesn't support joins. Which would be a major feature that would really make it useful. 回答1: Maybe you can try an ORM, like

Is there any good dynamic SQL builder library in Java? [closed]

空扰寡人 提交于 2019-11-26 19:25:37
Anyone knows some good SQL builder library for Java like Squiggle (not maintained anymore it seems). Preferably, a project in active development. Preferably with syntax like Zend_Db_Select , something that will allow to make a query like String query = db.select().from('products').order('product_id'); ponzao Querydsl and jOOQ are two popular choices. Christopher Klewes I can recommend jOOQ . It provides a lot of great features, also a intuitive DSL for SQL and a extremly customable reverse-engineering approach. jOOQ effectively combines complex SQL, typesafety, source code generation, active

Is there any good dynamic SQL builder library in Java? [closed]

自闭症网瘾萝莉.ら 提交于 2019-11-26 12:16:58
问题 Anyone knows some good SQL builder library for Java like Squiggle (not maintained anymore it seems). Preferably, a project in active development. Preferably with syntax like Zend_Db_Select, something that will allow to make a query like String query = db.select().from(\'products\').order(\'product_id\'); 回答1: Querydsl and jOOQ are two popular choices. 回答2: I can recommend jOOQ. It provides a lot of great features, also a intuitive DSL for SQL and a extremly customable reverse-engineering