f_connetdb_nexe.srf 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. $PBExportHeader$f_connetdb_nexe.srf
  2. global type f_connetdb_nexe from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_connetdb_nexe ()
  6. end prototypes
  7. global function integer f_connetdb_nexe ();//f_connetdb_nexe
  8. environment lenv_env // holds environment information
  9. //string ls_startupfile // holds name of start-up file
  10. // Get the environment information
  11. if ( GetEnvironment(lenv_env) <> 1 ) then
  12. MessageBox( "Application: Open", &
  13. "Unable to get environment information.~nHalting ..." )
  14. halt
  15. end if
  16. // Select start-up file by operating system
  17. choose case lenv_env.ostype
  18. case windows!, windowsnt!
  19. // ls_startupfile = "car_wiz.ini"
  20. // if ( lenv_env.charset = charsetunicode! ) then
  21. // ls_startupfile = "pbu.ini"
  22. // end if
  23. case else
  24. MessageBox( "Application: Open", &
  25. "Unrecognized operating system.~nHalting ..." )
  26. halt
  27. end choose
  28. //Populate sqlca from current preference-file settings
  29. sqlca.DBMS = ProfileString (sys_inifilename, "database", "dbms", "")
  30. sqlca.database = ProfileString (sys_inifilename, "database", "database", "")
  31. sqlca.userid = ProfileString (sys_inifilename, "database", "userid", "")
  32. sqlca.dbpass = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbpass", ""),1,sys_power_key)
  33. sqlca.logid = ProfileString (sys_inifilename, "database", "logid", "")
  34. sqlca.logpass = f_psw_bczh(ProfileString (sys_inifilename, "database", "LogPassWord", ""),1,sys_power_key)
  35. sqlca.servername = ProfileString (sys_inifilename, "database", "servername", "")
  36. sqlca.dbparm = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbparm", ""),1,sys_power_key)
  37. if sqlca.database='' or sqlca.servername='' then
  38. //Messagebox("系统提示","连接数据库失败!")
  39. //openWITHPARM(w_set_sqlca,1) //0 只设连接信息 1 并允许自动新建数据库(启动首次调用)
  40. //open(w_set_sqlca)
  41. halt
  42. end if
  43. connect using sqlca;
  44. If SQLCA.SQLCode<0 Then
  45. //Messagebox("系统提示","连接数据库失败!")
  46. //openWITHPARM(w_set_sqlca,1) //0 只设连接信息 1 并允许自动新建数据库(启动首次调用)
  47. halt
  48. End if
  49. String strkey
  50. strkey = 'I~'m LongJoe'
  51. EXECUTE Immediate :strkey USING sqlca; // 验证语句
  52. execute immediate "set transaction isolation level READ UNCOMMITTED";
  53. //messagebox("",sqlca.sqlcode)
  54. if sqlca.sqlcode<>0 then
  55. //messagebox("系统提示","设置SQL服务器系统属性失败!"+SQLCA.sqlerrtext)
  56. halt;
  57. end if
  58. //set transaction isolation level readcommitted;
  59. return 0
  60. end function