Setting Database Warning Threshold

This function allows you to set a warning threshold for a database using
LotusScript. Just pass it a NotesDatabase object and a warning threshold (in
KB). The sample button code below shows how to set the warning threshold for
the current database to 980 KB:

Sub Click(Source As Button)
Dim session As New NotesSession
Dim wthold&

wthold&=980

If SetWarningThreshold(session.CurrentDatabase, wthold&) Then
Msgbox "Function failed!", 48, "Demo"
Else
Msgbox "Warning threshold set to " & Cstr(wthold&) & " KB.", 0, "Demo"
End If
End Sub
' (Declarations)
Type DBQUOTAINFO
WarningThreshold As Long
SizeLimit As Long
CurrentDbSize As Long
MaxDbSize As Long
End Type

Declare Function OSPathNetConstruct Lib "nnotes" (Byval PortName As String,
Byval ServerName As String, Byval FileName As String, Byval retPathName As
String) As Integer
Declare Function NSFDbQuotaSetExt Lib "nnotes" (Byval Filename As String, Byval
Flags As Long, QuotaInfo As DBQUOTAINFO) As Integer

Const DBQUOTA_NOT_SPECIFIED = -1

Function SetWarningThreshold (db As NotesDatabase, wthold&) As Integer
Dim path$
Dim status%
Dim QuotaInfo As DBQUOTAINFO

path$=Space$(256)

' build API-friendly path to database
status%=OSPathNetConstruct("", db.Server, db.FilePath, path$)

If status%=0 Then
' fill in the DBQUOTAINFO structure
QuotaInfo.WarningThreshold = wthold& * 1024
QuotaInfo.SizeLimit = DBQUOTA_NOT_SPECIFIED
QuotaInfo.CurrentDbSize = DBQUOTA_NOT_SPECIFIED
QuotaInfo.MaxDbSize = DBQUOTA_NOT_SPECIFIED

' set the warning threshold for the db
status%=NSFDbQuotaSetExt(path$, 0, QuotaInfo)
End If

' return status of last API call
SetWarningThreshold=status%
End Function
This was first published in November 2000

Dig deeper on Domino Resources - Part 5

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close