--增删改查

    --1 db:select() 查询
    local help=CSelectHelp()
    local param=CParamString()
    local sqlSelect=[[select top 10 * from bs_customer where create_time >=:create_time<timestamp>]]
    param:add('2020-01-01 00:00:00')
    if  db:select(sqlSelect,param,help) < 0 then 
        print(db:error());
        return false;
    end  


    --2 db:selectTop() 查询部分数据
    local help=CSelectHelp()
    local param=CParamString()
    local sqlSelect=[[select  * from bs_customer  ]]
    if db:selectTop(0,600,sqlSelect,param:toString(),helpValues) < 0 then
        ui:msg(db:error());
        return;
    end

    --3 db:execSQL 插入,删除,修改 
    local sqlUpdate=[[update bs_customer set customer_id=4 where customer_id=3]]
    if  db:execSQL(sqlUpdate,'') ==false  then 
        print(db:error());
        return false;
    end 

    --4 db:error() 数据库报错信息 
    local help=CSelectHelp()
    local sqlSelect=[[select top 10 * from bs_a_customer]]
    if  db:select(sqlSelect,'',help) < 0 then 
        print(db:error());
        return false;
    end 

    --5 db:getRPCount() --获取生效的行数
    local sqlUpdate=[[update bs_customer set customer_id='1' where customer_id='2' ]]
    if db:execSQL(sqlUpdate,'') ==false  then  
        print(db:error());
        return false;
    end 
    if db:getRPCount() <= 0 then --
        print('无相关更改')
    end


Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""