Access NotesDatabase Options (extended)

GetOption was introduced to the NotesDatabase class in V6. It allows to determine, if specific options are set or not.

By design, it only accesses $dboptions1 from the database. Other options are stored in $dboptions2 – 4.
Those option bits are not accessible using NotesDatabase.getOption(optionName%).

Here is code to access them.

Public Type DBOPTIONS
options (3) As Long
End Type

Public Const W32_LIB = {nnotes.dll}
Public Const TUX_LIB = {libnotes.so}

Declare Function W32_NSFDbGetOptionsExt Lib W32_LIB Alias {NSFDbGetOptionsExt}_
(ByVal hdb As Long, retDbOptions As DBOPTIONS) As Integer
Declare Function W32_NSFDbOpen Lib W32_LIB Alias {NSFDbOpen}_
(ByVal dbName As String, hDb As Long) As Integer
Declare Function W32_NSFDbClose Lib W32_LIB Alias {NSFDbClose}_
(ByVal hDb As Long) As Integer

Declare Function TUX_NSFDbGetOptionsExt Lib TUX_LIB Alias {NSFDbGetOptionsExt}_
(ByVal hdb As Long, retDbOptions As DBOPTIONS) As Integer
Declare Function TUX_NSFDbOpen Lib TUX_LIB Alias {NSFDbOpen}_
(ByVal dbName As String, hDb As Long) As Integer
Declare Function TUX_NSFDbClose Lib TUX_LIB Alias {NSFDbClose}_
(ByVal hDb As Long) As Integer


Public Function NSFDbGetOptionsExt (hDb As Long, retDbOptions As DBOPTIONS)
	If isDefined("WINDOWS") Then
		NSFDbGetOptionsExt = W32_NSFDbGetOptionsExt(hDb, retDbOptions)
	Else
		NSFDbGetOptionsExt = TUX_NSFDbGetOptionsExt(hDb, retDbOptions)
	End If
End Function

Function NSFDbOpen( db As string, hDB As Long) As Integer
	If isDefined("WINDOWS") Then
		NSFDbOpen = W32_NSFDbOpen(db,hDb)
	Else
		NSFDbOpen = TUX_NSFDbOpen(db,hDb)
	End If
End Function

Function NSFDBClose (hDb As Long)
	If isDefined("WINDOWS") Then
		NSFDbClose = W32_NSFDbClose(hDb)
	Else
		NSFDbClose = TUX_NSFDbClose(hDb)
	End If
End Function

Sample:

Const  DBOPT_IS_IMAP = &h01000000

Sub Initialize
	Dim hDb As Long
	Dim rc As Integer
	Dim sDb As String
	
	Dim retDbOptions As DBOPTIONS
	
	sDb = "serv01/singultus!!mail/buser.nsf"
	
	rc = NSFDbOpen(sDb, hDb)
	
	If rc = 0 Then
		rc =  NSFDbGetOptionsExt (hDb, retDbOptions)
		If retDbOptions.options(1) And DBOPT_IS_IMAP Then
			MsgBox "IMAP enabled"
		Else 
			MsgBox "IMAP not enabled"
		End If
		rc = NSFDbClose(hDb)
	End If
End Sub

I have created an enhancement request for an optional method parameter to access the different optionsStores.
If you think, that this might give you some benefit, pls upvote my idea https://domino.ideas.aha.io/ideas/DDXP-I-508


Programmatically Update /Add Database to DQL Design Catalog

For high speed access to internal information about views and view columns, DQL processing uses design data extracted from view notes. Currently this information will be stored in a new database, named GQFdsgn.cat.

It is created using new updall flags. It does not replicate and is solely used as a fast-path tool to access design data at runtime.

Here is some LotusScript code to add / update the design of a named Notes application to the catalog. The NSFDesignHarvest call is currently undocumented. Use it at your own risk.

'DECLARATIONS

Public Const UPDATE_DESIGN_CATALOG = 0
Public Const ADD_TO_DESIGN_CATALOG = 1

Const NNOTES ="nnotes.dll"
Const LIBNOTES ="libnotes.so"

Declare Public Function WIN_NSFDbOpen Lib NNOTES Alias "NSFDbOpen" _
(ByVal dbName As String, hDb As Long) As Integer
Declare Public Function LIN_NSFDbOpen Lib LIBNOTES Alias "NSFDbOpen" _
(ByVal dbName As String, hDb As Long) As Integer
Declare Public Function WIN_NSFDbClose Lib NNOTES Alias "NSFDbClose" _
(ByVal hDb  As Long) As Integer
Declare Public Function LIN_NSFDbClose Lib LIBNOTES Alias "NSFDbClose" _
(ByVal hDb  As Long) As Integer
Declare Public Function WIN_NSFDesignHarvest Lib NNOTES Alias "NSFDesignHarvest" _
(ByVal hDb  As Long, ByVal flag  As Long) As Integer
Declare Public Function LIN_NSFDesignHarvest Lib LIBNOTES Alias "NSFDesignHarvest" _
(ByVal hDb  As Long, ByVal flag  As Long) As Integer

' API FUNCTIONS
Private Function NSFDbOpen( db As String, hDB As Long) As Integer
	If isDefined("WINDOWS") Then
		NSFDbOpen = WIN_NSFDbOpen(db,hDb)
	ElseIf isDefined("LINUX") Then
		NSFDbOpen = LIN_NSFDbOpen(db,hDb)
	End If
End Function

Private Function NSFDbClose (hDb As Long)
	If isDefined("WINDOWS") Then
		NSFDbClose = WIN_NSFDbClose(hDb)
	ElseIf isDefined("LINUX") Then
		NSFDbClose = LIN_NSFDbClose(hDb)
	End If
End Function

Private Function NSFDesignHarvest (hDb As Long, flag As long) As Integer
	If isDefined("WINDOWS") Then
		NSFDesignHarvest = WIN_NSFDesignHarvest(hDb, flag)
	ElseIf isDefined("LINUX") Then
		NSFDesignHarvest = LIN_NSFDesignHarvest(hDb, flag)
	End If
End Function

Public Function catalogDesign(sDb As String, flag As Long) As Integer
	
	Dim hDb As Long
	Dim rc As Integer
	
	If flag > 1 Then flag = 1
	If flag < 0 Then flag = 0
	
	rc = NSFDbOpen(sDb, hDb)
	
	If rc = 0 Then
		rc = NSFDesignHarvest(hDb, flag)
		rc = NSFDbClose(hDb)
	End If
	
	catalogDesign = rc 
	
End Function