zoukankan      html  css  js  c++  java
  • pb执行sql文件

    $PBExportHeader$uf_exesqlfile.srf
    global type uf_exesqlfile from function_object
    end type
    forward prototypes
    global function integer uf_exesqlfile (string astr_file, transaction atrs_sql)
    end prototypes
    global function integer uf_exesqlfile (string astr_file, transaction atrs_sql);int f
    string ls_file
    ls_file = astr_file
    f = fileopen(ls_file,linemode!,read!,shared!)
    if f < 0 then 
    //messagebox('错误','打开文件'+ls_file+'错误!')
    return 0
    end if
    string ls_line
    string ls_sql
    int li_rtn,li_exec,li_succ
    li_rtn = fileread(f,ls_line)
    li_exec = 0
    li_succ = 0
    do while li_rtn >=0 
    ls_line = trim(ls_line)
    if left(ls_line,2) = '--' or left(ls_line,2)='//' then
    li_rtn = fileread(f,ls_line)
    continue
    end if
    if right(ls_line,1) = ";" then
    ls_line = left(ls_line,len(ls_line) - 1)
    ls_sql = ls_sql + " " + ls_line
    li_exec ++
    execute immediate :ls_sql using atrs_sql;
    if atrs_sql.sqlcode =0 then
    li_succ ++
    end if
    ls_sql = ""
    else
    ls_sql = ls_sql + " " + ls_line
    end if
    li_rtn = fileread(f,ls_line)
    loop
    commit using atrs_sql;
    fileclose(f)
    if li_exec = li_succ  then
    messagebox('信息','执行'+astr_file+'~r~n执行'+ string(li_exec)+",成功"+string(li_succ)+"。")
    return li_succ
    else
    return - 1
    end if
    end function
  • 相关阅读:
    注册系统
    android登录界面
    android作业 购物界面
    第六周jsp作业
    JSP第四周
    JSP第二次作业
    JSP第一次作业
    第一周软件测试
    第九次安卓
    购物菜单
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/2127629.html
Copyright © 2011-2022 走看看