Thanks for the information. This is what I'm working on today:
dim MailboxSQL as String = "select RecID, * from Mailbox where lower(MailboxPath) = lower(?)"
dim MailboxPrepared as VPreparedStatement = theArchive.Prepare(MailboxSQL)
MailboxPrepared.BindText(0, currentMailbox)
MailboxCursor = MailboxPrepared.SqlSelect(EVCursorLocation.kServerSide, EVLockType.kNoLocks, EVCursorDirection.kRandom)
if MailboxCursor = nil then Continue
'mailbox doesn't exist so create new
if MailboxCursor.RecordCount = 0 then
MailboxCursor.SetBlank
MailboxCursor.Field("MailboxPath"
.SetString currentMailbox
MailboxCursor.Field("Username"
.SetString(Username)
call MailboxCursor.AddRecord
end if
The code checks if a record exists and then adds a new one if the record doesn't exist. As far as I can see I have 2 operations irregardless if I use SQL only or not, correct? Can I improve the code for VServer?