如何用ORCA从一个库中删除一个对象?

问题描述 投票:0回答:1

我需要从一些特定的库中删除一些对象,我已经找到了一个实用程序,我在PowerBuilder中开发,但没有简单的方法,我可以通过脚本删除对象。

ORCA 我从来没有使用过,不知道如何使用它。

我正在阅读 ORCA GUIDE,但没有一个完整的例子来说明""。图书馆条目删除"

我的实用程序返回对象的位置,我想把它传递给 图书馆条目删除 方法来删除对象。

谁能帮我提供以下代码示例 图书馆条目删除?

PB12.x

powerbuilder orca
1个回答
0
投票

我知道,这是一个老问题,但也许有人看这个。

有一些在C#中的灵感。

public class Orca
{
// Orca Session
 [DllImport("pborc170.dll", EntryPoint = "PBORCA_SessionOpen", CharSet = CharSet.Unicode, SetLastError = true)]
        private static unsafe extern int PBORCA_SessionOpen170();

//Session close
   [DllImport("pborc170.dll", EntryPoint = "PBORCA_SessionClose", CharSet = CharSet.Unicode, SetLastError = true)]
        private static unsafe extern void PBORCA_SessionClose170(int hORCASession);

// Entry Delete
  [DllImport("pborc170.dll", EntryPoint = "PBORCA_LibraryEntryDelete", CharSet = CharSet.Unicode, SetLastError = true)]
        private static unsafe extern int PBORCA_LibraryEntryDelete170(int hORCASession, [MarshalAs(UnmanagedType.LPTStr)] string lpszLibName, [MarshalAs(UnmanagedType.LPTStr)] string lpszEntryName, PBORCA_TYPE otEntryType);

//set the entry type enums
 private enum PBORCA_ENTRY_TYPE
        {
            PBORCA_APPLICATION,
            PBORCA_DATAWINDOW,
            PBORCA_FUNCTION,
            PBORCA_MENU,
            PBORCA_QUERY,
            PBORCA_STRUCTURE,
            PBORCA_USEROBJECT,
            PBORCA_WINDOW,
            PBORCA_PIPELINE,
            PBORCA_PROJECT,
            PBORCA_PROXYOBJECT,
            PBORCA_BINARY
        }

public static void LibraryEntryDelete(string pbl= "blabla.pbl", string entry = "blablaDatawindow", PBORCA_ENTRY_TYPE entryType= PBORCA_ENTRY_TYPE.PBORCA_DATAWINDOW)
{

//Open Session
    int orcaSession = PBORCA_SessionOpen170();

//delete entry
       PBORCA_LibraryEntryDelete170(orcaSession, pbl, entry, entryType);

//close session
    PBORCA_SessionClose170(orcaSession );
}

}

.NET中的ORCA函数有巨大的潜力。也许可以看看github的PBDotNet项目,以获得更多的信息。

© www.soinside.com 2019 - 2024. All rights reserved.