zoukankan      html  css  js  c++  java
  • InstallShield高级应用获取机机所有ORACLE服务列表

    //=====================================================================//
    // //
    // function GetOracleServerList //
    // 获取机机所有ORACLE服务列表//
    // purpose get the local oracle servers from the tnsnames.ora //
    // from the path %oraclepath%\nerwork\admin //
    // //
    // argment //
    // //
    // return local oracle server list //
    // //
    // author chenhuicong 2010-12-18 //
    // //
    //=====================================================================//


    EXPORT prototype LIST GetOracleServerList();

    function LIST GetOracleServerList()
    NUMBER nvHomeCount,nKeyType, nvSize,nFileHandle;
    LIST listID;
    STRING svOraclePath,svLine,svOraFileName,svOracleItem;
    INT iVal, iLength,iItemLen;
    begin
    //ora filename
    svOraFileName = "tnsnames.ora";
    // defaut regedit root
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

    //oralce regedit path
    if(RegDBGetKeyValueEx ("SOFTWARE\\ORACLE\\ALL_HOMES\\ID0", "PATH",nKeyType, svOraclePath, nvSize) = 0) then
    //oracle path
    svOraclePath= svOraclePath^"network\\admin\\";
    // Create a list to store lines from the file.
    listID = ListCreate (STRINGLIST);
    // Set the file mode to normal.
    OpenFileMode (FILE_MODE_NORMAL);
    // Open the file for editing.
    if(OpenFile (nFileHandle, svOraclePath, svOraFileName) = 0 ) then
    try
    // Get lines from the file into the list.
    while (GetLine (nFileHandle, svLine) = 0)
    if(svLine[0] != "#" && svLine[0] != " " && svLine[0] != "(") then
    iVal = 0;
    iLength = StrLength (svLine);
    while (iVal <= iLength)
    if(svLine[iVal] = "=" || svLine[iVal] = " ") then
    svLine[iVal] = NOTHING;
    endif;
    iVal++;
    endwhile;
    if(iLength > 0 ) then
    ListAddString (listID, svLine, AFTER);
    endif;

    endif;
    endwhile;
    // Close the file.
    CloseFile (nFileHandle);
    // Remove the list from memory.
    //ListDestroy (listID);
    catch
    CloseFile (nFileHandle);
    //ListDestroy (listID);
    endcatch;
    endif;
    endif;

    return listID;
    end;

    作者:chhuic

    出处:http://chhuic.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    day34-python-异常
    day33-python-反射、内置方法、元类、 属性查找
    day31/32待补
    day30-mixin、重载、多态、绑定与非绑定方法、内置函数
    day29-python-property、继承、属性查找、多继承带来的菱形问题
    day28-python-封装
    day27-python-面向对象介绍、实现面向对象编程、查找顺序
    luffy项目
    oc基本数据类型
    iOS 入门了解
  • 原文地址:https://www.cnblogs.com/chhuic/p/2495608.html
Copyright © 2011-2022 走看看