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
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    数据操作-对数据的增删改查-单表查询和多表查询
    爬虫从入门到放弃
    爬虫从入门到放弃
    创建表的完整语法及表之间的关系
    树链剖分练习总结
    [BZOJ]1984: 月下“毛景树”
    [BZOJ]2243: [SDOI2011]染色
    [BZOJ]4034: [HAOI2015]树上操作
    NOIP2012题解
    CODEVS4633 [Mz]树链剖分练习
  • 原文地址:https://www.cnblogs.com/chhuic/p/2495608.html
Copyright © 2011-2022 走看看