Results 1 to 3 of 3

Thread: Using unsupported buffer type: XX (parameter: XX) QMYSQL3: Unable to bind value

  1. #1
    Join Date
    Oct 2012
    Posts
    3
    Qt products
    Platforms
    Windows

    Default Re: Using unsupported buffer type: XX (parameter: XX) QMYSQL3: Unable to bind value

    I have been seaching google for all day. And I could not find any result.

    Qt Code:
    1. #!/usr/bin/env python
    2. # -*- coding: iso-8859-9 -*-
    3.  
    4. from PyQt4 import QtCore, QtGui, QtSql
    5.  
    6. class Ui_Dialog(object):
    7. def setupUi(self, Dialog):
    8. Dialog.setObjectName("Dialog")
    9. Dialog.setWindowTitle("Dialog")
    10. Dialog.resize(640, 392)
    11. self.verticalLayout = QtGui.QVBoxLayout(Dialog)
    12. self.verticalLayout.setObjectName("vertical_layout")
    13. self.tableView = QtGui.QTableView(Dialog)
    14. self.tableView.setObjectName("table_view")
    15. self.verticalLayout.addWidget(self.tableView)
    16. self.buttonBox = QtGui.QDialogButtonBox(Dialog)
    17. self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
    18. self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
    19. self.buttonBox.setObjectName("button_box")
    20. self.verticalLayout.addWidget(self.buttonBox)
    21.  
    22.  
    23. QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.test)
    24. QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.test)
    25. QtCore.QMetaObject.connectSlotsByName(Dialog)
    26.  
    27. self.open_database()
    28. self.model = QtSql.QSqlTableModel()
    29. self.initializeModel(self.model)
    30. self.tableView.setModel(self.model)
    31. #self.tableView.setItemDelegate(QtSql.QSqlRelationalDelegate(self.tableView))
    32. #self.tableView.hideColumn(0)
    33.  
    34.  
    35. def open_database(self):
    36. self._db = QtSql.QSqlDatabase.addDatabase("QMYSQL3")
    37. self._db.setHostName("localhost")
    38. self._db.setUserName("root")
    39. self._db.setPassword("123456")
    40. self._db.setDatabaseName("my_database")
    41. self._db.open()
    42.  
    43. def initializeModel(self, model):
    44. model.setTable('my_table')
    45.  
    46. model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)
    47. model.select()
    48. #model.removeColumn(0)
    49.  
    50. model.setHeaderData(0, QtCore.Qt.Horizontal, "ID")
    51. model.setHeaderData(1, QtCore.Qt.Horizontal, "First name")
    52. model.setHeaderData(2, QtCore.Qt.Horizontal, "Last name")
    53.  
    54.  
    55. def test(self):
    56. ok = self.model.submitAll()
    57. print (self.model.lastError().text())
    58.  
    59. if __name__ == "__main__":
    60. import sys
    61. app = QtGui.QApplication(sys.argv)
    62. Dialog = QtGui.QDialog()
    63. ui = Ui_Dialog()
    64. ui.setupUi(Dialog)
    65. Dialog.show()
    66. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 


    Any help would be much appreciated.

    Sorry, I have forgotten the error code

    This is the output;

    Using unsupported buffer type: XX (parameter: XX) QMYSQL3: Unable to bind value

  2. #2
    Join Date
    Oct 2012
    Posts
    3
    Qt products
    Platforms
    Windows

    Default Re: Using unsupported buffer type: XX (parameter: XX) QMYSQL3: Unable to bind value

    It is strange. Now I have tested my code on Python 3.3 32 bit and everything works perfect.

    The problem was with Python 3.2 64 bit. Both Mysql db is the same. I could not figure out the problem. Not a clue. The code is working fine now.

  3. #3
    Join Date
    Oct 2012
    Posts
    3
    Qt products
    Platforms
    Windows

    Default Re: Using unsupported buffer type: XX (parameter: XX) QMYSQL3: Unable to bind value

    I have solved the problem. And I am writing in case it helps someone who faces with similar problems.

    The program connects a remote database. And there is another MySQL database installed on my harddrive. I have removed the installed MySQL from my harddrive. And problem solved.

Similar Threads

  1. QODBC Driver - unable to bind variable
    By AlphaWolfXV in forum Qt Programming
    Replies: 0
    Last Post: 14th September 2011, 12:55
  2. QMYSQL3: Unable to bind outvalues
    By sirguyon in forum Qt Programming
    Replies: 8
    Last Post: 19th November 2009, 09:23
  3. QMYSQL3: Unable to fetch data
    By crystlrain in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2009, 07:24
  4. Problem with connect() (enum-type as parameter)
    By alu23 in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 07:46
  5. unable to save QCStrings properly in a buffer
    By nass in forum Qt Programming
    Replies: 13
    Last Post: 15th November 2006, 20:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.