java sql 查询中的转义序列不对_在 JDBC 中使用 SQL 转义序列 - SQL Server | Microsoft Docs...

本文详细介绍了在Java JDBC中使用SQL转义序列的场景,包括LIKE通配符文本、函数处理、日期和时间文本、存储过程调用以及外部联接。JDBC驱动程序支持这五种类型的转义序列,使得在SQL语句中处理特殊字符和功能变得更加方便。
摘要由CSDN通过智能技术生成

使用 SQL 转义序列Using SQL escape sequences

08/12/2019

本文内容

按照 JDBC API 的定义,Microsoft JDBC Driver for SQL ServerMicrosoft JDBC Driver for SQL Server 支持使用 SQL 转义序列。The Microsoft JDBC Driver for SQL ServerMicrosoft JDBC Driver for SQL Server supports the use of SQL escape sequences, as defined by the JDBC API. 转义序列用于 SQL 语句内,以告诉驱动程序应以不同的方式处理 SQL 字符串的转义部分。Escape sequences are used within an SQL statement to tell the driver that the escaped part of the SQL string should be handled differently. 当 JDBC 驱动程序处理 SQL 字符串的转义部分时,它会将字符串的这一部分转换为 SQL Server 可以理解的 SQL 代码。When the JDBC driver processes the escaped part of an SQL string, it translates that part of the string into SQL code that SQL Server understands.

JDBC API 需要五种类型的转义序列,JDBC 驱动程序支持所有这些转义序列:There are five types of escape sequences that the JDBC API requires, and all are supported by the JDBC driver:

LIKE 通配符文本LIKE wildcard literals

函数处理Function handling

日期和时间文本Date and time literals

存储过程调用Stored procedure calls

外部联接Outer joins

限制转义语法Limit escape syntax

JDBC 驱动程序使用的转义序列语法如下所示:The escape sequence syntax used by the JDBC driver is the following:

{keyword ...parameters...}

备注

SQL 转义处理对于 JDBC 驱动程序始终是打开的。SQL escape processing is always turned on for the JDBC driver.

以下各部分介绍五种类型的转义序列以及 JDBC 驱动程序如何支持它们。The following sections describe the five types of escape sequences and how they are supported by the JDBC driver.

LIKE 通配符文本LIKE wildcard literals

JDBC 驱动程序支持 {escape 'escape character'} 语法,以便将 LIKE 子句通配符用作文本。The JDB

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值