tws0002 / blur-dev

Automatically exported from code.google.com/p/blur-dev
0 stars 0 forks source link

how to use QtSql? #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. copy C:\WINDOWS\system32\blur64\sqldrivers *.dll to 
C:\python26_64\Lib\site-packages\PyQt4\plugins\sqldrivers

2. pure PyQt:

app = QApplication(sys.argv)
filename = os.path.join(os.path.dirname(__file__), "phonelog.db")    db = 
QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName(filename)

works fine, "phonelog.db" is created.

3. PyQt in Max:

# empty window class HelloWorldDialog 
blurdev.launch(HelloWorldDialog)
filename = os.path.join("C:\\phonelog.db")
db = QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName(filename)
db.open()

nothing is created, no errors. 

What version of the product are you using? On what operating system?
max 2009, win 64

Please provide any additional information below.
So, how should i use QtSql? :)
thank you

Original issue reported on code.google.com by michael....@gmail.com on 11 Jan 2012 at 5:42

GoogleCodeExporter commented 9 years ago
I am using sqlite in 3dsmax, I use:

import sqlite3
con = sqlite3.connect(self.dbPath)
    with con:
        cur = con.cursor()
        cur.execute("SELECT...")

works for me. 
don't see an advantage in using the QtSql

Original comment by purest...@gmail.com on 5 Apr 2013 at 11:05