mybatis 配置文件文件中 <![cdata[ ${value} ]]> 是什么意思

发布网友

我来回答

4个回答

热心网友

value是不是可能包含xml格式的东西,<![CDATA[ ....]]>,这个在xml里表示该部分内容不会被xml解析器解析。

CDATA[ ${value 如果value是sql语句,那这里就是个动态的sql语句了,最终会执行这条sql语句,select from student where id = #{id} 如果你这个id也传入个sql语句,这里就会把它当成一个查询值了<update id = "excute" parameterType="java.lang.String">

<![CDATA[ ${value}]]>

</update><select id = "excute" parameterType="java.lang.String">

select * from student where id = #{id}

</select >include<iostream>

using namespace std;

char *deletechar(char *a)

{int len=strlen(a);

char *b=new char();

int k=0;

for(int i=0;i<len;i++)

{if(a[i]>='0' && a[i]<='9')

{b[k]=a[i];k++;}

热心网友

value是不是可能包含xml格式的东西,<![CDATA[ ....]]>,这个在xml里表示该部分内容不会被xml解析器解析

热心网友

像你<![CDATA[ ${value}]]> 如果value是sql语句,那这里就是个动态的sql语句了,最终会执行这条sql语句。
select * from student where id = #{id} 如果你这个id也传入个sql语句,这里就会把它当成一个查询值了

热心网友

#能做数据类型匹配,$则不可以。
像你<![CDATA[ ${value}]]> 如果value是sql语句,那这里就是个动态的sql语句了,最终会执行这条sql语句。
select * from student where id = #{id} 如果你这个id也传入个sql语句,这里就会把它当成一个查询值了。追问select * from student where id = #{id} 如果你这个id也传入个sql语句,这里就会把它当成一个查询值了?是什么意思?
假如说我id传入的一个参数
session.selectList("queryAllStudent", "(select id from student where name = 'zs' )" );
#{id} ${id} 分别会对他怎么处理?

追答#
select * from student where id =select id from student where name = 'zs'
如果id是数值型,会报错。
$
select * from student where id =select id from student where name = 'zs' )
这里应该是sql错误了

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com