• 爱情文章
  • 亲情文章
  • 友情文章
  • 生活随笔
  • 校园文章
  • 经典文章
  • 人生哲理
  • 励志文章
  • 搞笑文章
  • 心情日记
  • 英语文章
  • 范文大全
  • 作文大全
  • 新闻阅读
  • 当前位置: 山茶花美文网 > 亲情文章 > 正文

    MySQL返回影响行数的测试示例|完整的测试用例excel

    时间:2020-05-28来源:山茶花美文网 本文已影响 山茶花美文网手机站

    found_rows() : select

    row_count() : update delete insert

    注:需要配合相应的操作一起使用,否则返回的值只是1和-1(都是不正确的值)

    示例:

    drop database if exists `mytest`;

    create database `mytest`;

    use `mytest`;

    drop table if exists `MyTestTable`;

    create table `MyTestTable`(`ID` int ,`Name` varchar(10));

    insert into `MyTestTable`(`ID`,`Name`)

    select "1","role1" union all

    select "2","role2" union all

    select "3","role3";

    select row_count(); -- 输出3(返回新添加的记录数),[注:如果使用insert into...values只返回1]

    select * from `MyTestTable`;select found_rows(); -- 输出3(返回选择的行数)

    update `MyTestTable` set `Name`="people";select row_count(); -- 输出3(返回修改的行数)

    delete from `MyTestTable`;select row_count(); -- 输出3(返回删除的行数)

    • MySQL返回影响行数的测试示例|完整的测试用例excel 相关文章:
    • 爱情文章
    • 亲情文章
    • 友情文章
    • 随笔
    • 哲理
    • 励志
    • 范文大全