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
  • 相关阅读:
    Java类加载文章2(z)
    Java类加载文章1(z)
    Java类加载文章2(z)
    网页的文档对象模型
    网页元素的比例长度
    CSS 中三栏布局的实现
    CSS 中双栏布局的实现
    在浏览器中打开本地文件1
    Oracle Oracle UTL_RAW类
    SVN完整安装及简略使用
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/2127629.html
Copyright © 2011-2022 走看看