I'm converting all my SQL statements to use the VPreparedStatement. I don't understand how the Init/AddRow combo is supposed to go together.
The code below should get the child rows of the currently selected row in a hierarchical listbox and then delete them. However, only the first child row is deleted and not the rest:
dim SelectedRow as AppleListboxRow = getSelectedRow
dim theChildRows(-1) as AppleListboxRow = SelectedRow.GetAllChildren
theSQL = "Delete from Mailbox where MailboxPath = ?"
thePrepared = theDatabase.Prepare(theSQL)
'for each theMailbox as AppleListboxRow in theChildRows
for currentBox as Integer = 0 to UBound(theChildRows)
if currentBox = 0 then
thePrepared.Init
else
thePrepared.AddRow
end if
thePrepared.BindText(0, theChildRows(currentBox).Tag)
call thePrepared.SqlExecute
next
And as usual the documentation is a bit special:
VSQLPreparedStatement is called VSQLStatement. AddRow is AddBindRow.
Do I need to understand why there are both Init and AddRow?
A happy new year to you! I've got other SQL to fix so this isn't urgent.
Valentina 7.5.6 I think. Xojo 2017r1, El Capitan.
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals