Jump to content

Macros/Base/py002

From The Document Foundation Wiki
This page is a translated version of the page Macros/Base/py002 and the translation is 100% complete.

Descrizione

Esegue un aggiornamento nel database corrente

Codice Python

import uno

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()
    return