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
  • 相关阅读:
    数梦工场:新思维、新技术下的互联网+政务
    计算成就价值_数据实现梦想——达科在DT时代转型历程的分享
    AliSQL开源功能特性
    mysql 索引的使用
    sql经典面试题
    数据库理论知识点
    sql语句面试练习
    数据库范式的选择使用
    sql常用语句
    数据库范式
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/2127629.html
Copyright © 2011-2022 走看看