Macros/Base/ba002
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Description
Execute update in current database
Sub main()
doc = ThisComponent
conn = doc.DataSource.getConnection("", "")
sql = "UPDATE ""contactos"" SET ""numbers""=TRIM(""numbers"")"
cursor = conn.prepareStatement(sql)
result = cursor.executeUpdate()
doc.store()
MsgBox result
End Sub
def main():
doc = XSCRIPTCONTEXT.getDocument()
conn = doc.DataSource.getConnection('', '')
sql = 'UPDATE "contactos" SET "numbers"=TRIM("numbers")'
cursor = conn.prepareStatement(sql)
result = cursor.executeUpdate()
doc.store()
print(result) # silent if Python console is absent
return