Jump to content
Fórum Script Brasil
  • 0

Dúvida no código


Question

olá,

Tenho um programa em python que necessita de executar uma funcion no servidor mysql: a funcão não tem parametros de entrada e apenas retorna um inteiro (ver função getNumber).

Como deverá ser o código a seguir à definiçaõ do cursor ?.

Alguém pode ajudar '

Obrigado

 

class DBlib:
    def __init__(self, err=''):
        self._err = err

    @property
    def value(self):
        return self._err

    @value.setter
    def value(self, err):
        self._err = err

    def connect(self, host, dbname, user, psw):  # returns connection object, mysql error
        try:
            connection = mysql.connector.connect(host=host, database=dbname, user=user, password=psw)
            if connection.is_connected():
                self._err = ''              # setting error property
                return connection
        except Error as e:
            self._err = e

    def closeConnection(self, connection):
        connection.close()

    def getNumber(self, connection):
        cursor = connection.cursor()
       
    
Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Cloud Computing


  • Forum Statistics

    • Total Topics
      148681
    • Total Posts
      644509
×
×
  • Create New...