九、库管理函数

九、库管理函数

1、LibraryCreate()

功  能:创建一个空的PowerBuilder应用库,并可根据需要在创建应用库的同时添加库注解。

语  法:LibraryCreate ( libraryname{, comments } )

参  数:libraryname:string类型,指定要创建应用库的名称,可以带上路径,不带路径时在当前目录下创建应用库;

comments:string类型,可选项,指定要创建的应用库的注解。

返回值:Integer。函数执行成功时返回1,发生错误时返回-1。如果任何参数的值为NULL,LibraryCreate()函数返回NULL。

用  法:LibraryCreate()函数在指定路径下创建一个空的PowerBuilder应用库(PBL)。如果在指定应用库名称时没有指定文件的扩展名,那么该函数自动加上扩展名.PBL。

示  例:This statement in Windows NT creates a library named dwTemp in the PB directory on drive C and associates a comment with the library:

LibraryCreate("c:\pb\dwTemp.pbl", "Temporary library for dynamic DataWindows")

 

2、LibraryDelete()

功  能:删除应用库库文件或应用库中的数据窗口对象。

语  法:LibraryDelete ( libraryname{, objectname, objecttype } )

参  数:libraryname:string类型,指定库名,可以带上路径,不带路径时在系统搜索路径下查找应用库;

objectname:string类型,可选项,指定要从库中删除的数据窗口对象的名称;

objecttype:LibImportType类型,可选项,指定要删除对象的类型,目前仅支持ImportDataWindow!。

返回值:Integer。函数执行成功时返回1,发生错误时返回-1。如果任何参数的值为NULL,LibraryDelete()函数返回NULL。

用  法:执行LibraryDelete()函数时,如果未指定后两个参数,那么该函数删除指定的应用库;如果指定了后两个参数,那么该函数删除指定应用库中指定的数据窗口对象。LibraryDelete()函数只能删除应用库中的数据窗口对象,如果想删除其它对象,那么只能在PowerBuilder开发环境中使用库管理画笔(Library Painter)来实现了。

示  例:This statement deletes a library called dwTemp in the current directory and on the current application library path:

LibraryDelete("dwTemp.pbl")

 

3、LibraryDirectory()

功  能:得到应用库中指定对象的信息列表,内容包括对象名称、最近修改日期和时间、以及对象的注释。

语  法:LibraryDirectory ( libraryname, objecttype )

参  数:libraryname:string类型,指定PowerBuilder应用库的名称,如果名称中未指定路径,那么该函数根据操作系统标准的文件搜索路径查找指定文件。

objecttype:LibDirType枚举类型,指定希望函数列出的对象类型,有效取值请参看用法。

返回值:String。函数执行成功时返回一个字符串,每个对象占用一行,行中各信息之间使用Tab字符(~t)分隔。行中信息格式为:

对象名~t修改日期/时间~t注释~n

发生错误时函数返回空字符串("")。如果任何参数的值为NULL,LibraryDirectory()函数返回NULL。

用  法:LibraryDirectory()函数的objecttype参数是个LibDirType枚举类型的量,其有效取值为:

DirAll!         -- 得到所有对象的信息;

DirApplication! -- 得到应用对象的信息;

DirDataWindow!  -- 得到所有数据窗口对象的信息;

DirFunction!    -- 得到所有函数对象的信息;

DirMenu!        -- 得到所有菜单对象的信息;

DirPipeline!    -- 得到所有数据管道对象的信息;

DirProject!     -- 得到工程对象的信息;

DirQuery!       -- 得到所有查询对象的信息;

DirStructure!   -- 得到所有结构对象的信息;

DirUserObject!  -- 得到所有用户对象的信息;

DirWindow!      -- 得到所有窗口对象的信息。

使用LibraryDirectory()函数得到指定对象的名称、修改日期/时间以及可能的注释后,应用程序既可以使用Pos()函数进行定位和字符串分割,也可以使用数据窗口的ImportString()函数将结果显示在数据窗口中。

示  例:This code imports the string returned by LibraryDirectory to the DataWindow dw_list and then redraws the dw_list. The DataWindow was defined with an external source and three string columns:

String ls_entries

ls_entries = LibraryDirectory("c:\pb\dwTemp.pbl", DirUserObject!)

dw_list.SetRedraw(FALSE)

dw_list.Reset( )

dw_list.ImportString(ls_Entries)

dw_list.SetRedraw(TRUE)

 

4、LibraryDirectoryEx()

功  能:得到应用库中一系列对象的信息列表,内容包括对象名称、最近修改日期和时间、对象的注释、以及对象的类型。使用该函数,应用程序既可以得到所有对象的信息,也可以只得到指定对象的信息。

语  法:LibraryDirectoryEx ( libraryname, objecttype )

参  数:libraryname:string类型,指定PowerBuilder应用库的名称,如果名称中未指定路径,那么该函数根据操作系统标准的文件搜索路径查找指定文件。

objecttype:LibDirType枚举类型,指定希望函数列出的对象类型,有效取值请参看用法。

返回值:String。函数执行成功时返回一个字符串,每个对象占用一行,行中各信息之间使用Tab字符(~t)分隔。行中信息格式为:

对象名~t修改日期/时间~t注释~n

发生错误时函数返回空字符串("")。如果任何参数的值为NULL,LibraryDirectory()函数返回NULL。

用  法:LibraryDirectory()函数的objecttype参数是个LibDirType枚举类型的量,其有效取值为:

DirAll!         -- 得到所有对象的信息;

DirApplication! -- 得到应用对象的信息;

DirDataWindow!  -- 得到所有数据窗口对象的信息;

DirFunction!    -- 得到所有函数对象的信息;

DirMenu!        -- 得到所有菜单对象的信息;

DirPipeline!    -- 得到所有数据管道对象的信息;

DirProject!     -- 得到工程对象的信息;

DirQuery!       -- 得到所有查询对象的信息;

DirStructure!   -- 得到所有结构对象的信息;

DirUserObject!  -- 得到所有用户对象的信息;

DirWindow!      -- 得到所有窗口对象的信息。

使用LibraryDirectory()函数得到指定对象的名称、修改日期/时间以及可能的注释后,应用程序既可以使用Pos()函数进行定位和字符串分割,也可以使用数据窗口的ImportString()函数将结果显示在数据窗口中。

示  例:This code imports the string returned by LibraryDirectoryEx to the DataWindow dw_list and then redraws the dw_list. The DataWindow was defined with an external source and four string columns:

String ls_entries

 

5、LibraryExport()

功  能:从指定应用库中以对象的语法定义格式卸出对象。

语  法:LibraryExport ( libraryname, objectname, objecttype )

参  数:libraryname:string类型,指定要移出对象的应用库的名称,如果名称中未指定路径,那么该函数根据操作系统标准的文件搜索路径查找指定文件;

objectname:string类型,指定要移出对象的名称;

objecttype :LibExportType枚举类型,指定要移出对象的类型,具体取值请参看用法。

返回值:String。函数执行成功时返回指定对象的语法,该语法与使用库管理画笔(Library Painter)移出对象时的语法相同,区别在于LibraryExport()函数省略了移出语法的头部。如果发生错误,则函数返回空字符串("")。如果任何参数的值为NULL,LibraryExport()函数返回NULL。

用  法:LibraryExport()的objecttype参数的可能取值为:

ExportApplication! -- 应用对象;

ExportDataWindow!  -- 数据窗口对象;

ExportFunction!    -- 函数对象;

ExportMenu!        -- 菜单对象;

ExportPipeline!    -- 数据管道对象;

ExportProject!     -- 工程对象;

ExportQuery!       -- 查询对象;

ExportStructure!   -- 结构对象;

ExportUserObject!  -- 用户对象;

ExportWindow!      -- 窗口对象。

示  例:These statements export the DataWindow object dw_emp from the library called dwTemp to a string named ls_dwsyn and then use it to create a DataWindow:

String ls_dwsyn, ls_errors

ls_dwsyn = LibraryExport("c:\pb\dwTemp.pbl","d_emp", ExportDataWindow!)

dw_1.Create(ls_dwsyn, ls_errors)

 

6、LibraryImport()

功  能:将以语法格式表示的数据窗口对象装入指定的应用库中。

语  法:LibraryImport(libraryname,objectname,objecttype,syntax,errors{,comments } )

参  数:libraryname:string类型,指定要移入对象的应用库的名称,如果名称中未指定路径,那么该函数根据操作系统标准的文件搜索路径查找指定文件;

objectname:string类型,指定要移入的数据窗口对象的名称;

objecttype:LibImportType枚举类型,指定要移入对象的类型,目前该函数只支持

ImportDataWindow!,表示只能向应用库中移入数据窗口对象;

syntax:string类型,指定要移入数据窗口对象的语法;

errors:string类型变量,用于在发生错误时保存出错信息;

comments:string类型,可选项,用于指定移入对象的注解。

返回值:Integer。函数执行成功时返回1,发生错误时返回-1。如果任何参数的值为NULL,LibraryImport()函数返回NULL。

用  法:当应用程序在运行过程中动态创建数据窗口对象后,可以使用LibraryImport()函数把动态数据窗口对象的定义保存到应用库中,以后就可以直接使用该对象了。

示  例:These statements import the DataWindow object d_emp into the library called dwTemp and store any errors in ErrorBuffer. Note that the syntax is obtained by using the Describe function:

string dwsyntax, ErrorBuffer

integer rtncode

dwsyntax = dw_1.Describe("DataWindow.Syntax")

rtncode=LibraryImport("c:\pb\Temp.pbl","d_emp",ImportDataWindow!,dwsyntax,

ErrorBuffer)

       

These statements import the DataWindow object d_emp into the library called dwTemp, store any errors in ErrorBuffer, and associate the comment Employee DataWindow 1 with the entry:

string dwsyntax, ErrorBuffer

integer rtncode

dwsyntax = dw_1.Describe("DataWindow.Syntax")

rtncode = LibraryImport("c:\pb\Temp.pbl","d_emp", ImportDataWindow!, dwsyntax, &

ErrorBuffer,"Employee DataWindow 1")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
数组函数 Pos() CloseChannel() PrintSetFont() lowerBound() Replace() ExeclRemote() PrintSetSpacing() UpperBound() Right() GetDataDDEOrigin() PrintSetup() RightTrim() GetRemote() PrintText() Blob(大二进制对象)函数 Space() OpenChanner() PrintWindth() Blob() Trim() RespondRemote() PrintX() BlobEdit() Upper() SetRemote() PrintY() BlobMid() StartHotLink() Len() 系统与环境函数 StopHotLink() 窗口操作函数 String() Clipboard() Close() CommandParm() DDE服务器函数 CloseWithReturn() 数据类型检查与转换函数 DoScript() GetCommandDDE() Open() Asc() GetApplication() GetCommandDDEOrigin() OpenSheet() Char() GetEnvironment() GetDataDDE() OpenSheetWithParm() Dec() GetFocus() GetDataOrigin() OpenWithParm() Double() Post() RespondRemote() Integer() ProfileInt() SetDataDDE() 国际化函数 Long() ProfileString() StartServerDDE() IsAllArabic() Real() Restart() StopServerDDE() IsAllHebew() Date() Run() IsAnyArabic() DateTime() Send() 文件操作函数 IsAnyHebrew() IsNumber() SetProfileString() FileClose() IsArabic() IsTime() ShowHelp() FileDelete() IsArabicAndNumbers() Time() SignalError() FileExists() IsHebrew() Yield() FileLength() IsHebrewAndNumbers() 数值计算函数 FileOPen() Reverse() Abs() 日期、时间函数 FileRead() ToAnsi() Ceiling() Day() FileSeek() ToUnicode() Cos() DayName() FileWrite() Exp() DayNumber() GetFileOpenName() 其他函数 Fact() DaysAfter() GetFileSaveName() Beep() Int() Hour() ClassName() Log() Minute() 管理函数 DebugBreak() logTen() Month() LibraryCreate() IntLow() Max() Now() LibraryDelete() IsValid() Min() RelativeDate() LibraryDirectory() KeyDown() Mod() RelativeTime() LibraryExport() MessageBox() Pi() Second() LibraryImport() PixelsToUnits() Rand() Today() PopulatError() Randomize() Year() 打印函数 RGB() Round() Print() SetNull() Sign() 注册(Registry)函数 PrintBitmap() SetPointer() Sin() RegistryDelete() PrintCancel() SignalError() Sqrt() RegistryGet() PrintClose() UnitsToPixels() Tan() RegistryKeys() PrintDataWindow() Truncate() RegistrySet() PrintDefineFont() RegistryValues() PrintLine() 字符串操作函数 PrintOpen() Fill() 定时函数 PrintOval() Left() CPU() PrintPage() LeftTrim() Idle() PrintRect() Lower() Timer() PrintRoundRect() Match() PrintScreen() Mid() DDE客户函数 PrintSend()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值