Macros/Base/py002

    From The Document Foundation Wiki
    < Macros‎ | Base
    This page is a translated version of the page Macros/Base/py002 and the translation is 100% complete.
    Other languages:

    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