#global llampex_driver, db #print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #db.setDatabaseName("laperla") #db.setUserName("angel") #db.setPassword("calidae") #db.setHostName("127.0.0.1") #db.setPort(10123) # #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() editor = TableEditor(clientoptions.getTable(), db) editor.show() editor.exec_() del editor clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")
#global llampex_driver, db #print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() plainModel = QtSql.QSqlQueryModel() print ">> Initialize Model" initializeModel(plainModel, db, clientoptions.getTable()) print ">> Create View" createView("Plain Query Model", plainModel) print ">> OK" app.exec_() del view #db.close() clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")
#db.setPassword("llampexpasswd") #db.setHostName("127.0.0.1") #db.setPort(10123) #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() model = QtSql.QSqlTableModel(None, db) initializeModel(model, clientoptions.getTable()) view1 = createView("Table Model (View 1)", model) view2 = createView("Table Model (View 2)", model) view1.show() view2.move(view1.x() + view1.width() + 20, view1.y()) view2.show() app.exec_() del model del view1 del view2 #db.close()
#print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() if not clientoptions.getTable() == "users": print "Sorry, in this example you cannot change the table." print "This example works with the three tables of Llampex DB." else: model = QtSql.QSqlRelationalTableModel(None, db) initializeModel(model) view = createView("Relational Table Model", model) view.show() app.exec_() del model del view clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")
#print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() if not clientoptions.getTable() == "users": print "Sorry, this example is only prepared to work with users table from Llampex DB." else: editableModel = EditableSqlModel(db,clientoptions.getTable()) print ">> Initialize Editable Model" initializeModel(editableModel,db,clientoptions.getTable()) print ">> Create View" createView("Plain Query Model", editableModel) print ">> OK" app.exec_() del editableModel del view #db.close()
#global llampex_driver, db #print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #db.setDatabaseName("laperla") #db.setUserName("angel") #db.setPassword("calidae") #db.setHostName("127.0.0.1") #db.setPort(10123) # #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() editor = TableEditor(clientoptions.getTable(),db) editor.show() editor.exec_() del editor clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")
#db.setPassword("llampexpasswd") #db.setHostName("127.0.0.1") #db.setPort(10123) #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() model = QtSql.QSqlTableModel(None,db) initializeModel(model,clientoptions.getTable()) view1 = createView("Table Model (View 1)", model) view2 = createView("Table Model (View 2)", model) view1.show() view2.move(view1.x() + view1.width() + 20, view1.y()) view2.show() app.exec_() del model del view1 del view2 #db.close()
#global llampex_driver, db #print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() plainModel = QtSql.QSqlQueryModel() print ">> Initialize Model" initializeModel(plainModel,db,clientoptions.getTable()) print ">> Create View" createView("Plain Query Model", plainModel) print ">> OK" app.exec_() del view #db.close() clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")
#print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() if not clientoptions.getTable() == "users": print "Sorry, this example is only prepared to work with users table from Llampex DB." else: editableModel = EditableSqlModel(db, clientoptions.getTable()) print ">> Initialize Editable Model" initializeModel(editableModel, db, clientoptions.getTable()) print ">> Create View" createView("Plain Query Model", editableModel) print ">> OK" app.exec_() del editableModel del view #db.close()
#print #print "*** Testing Llampex Qt Database Driver..." #llampex_driver = qsqlrpc.QSqlLlampexDriver() #print llampex_driver #db = QtSql.QSqlDatabase.addDatabase(llampex_driver, "myconnection") #print ">> Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() if not clientoptions.getTable() == "users": print "Sorry, in this example you cannot change the table." print "This example works with the three tables of Llampex DB." else: model = QtSql.QSqlRelationalTableModel(None,db) initializeModel(model) view = createView("Relational Table Model", model) view.show() app.exec_() del model del view clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")
#db.setDatabaseName("laperla") #db.setUserName("llampexuser") #db.setPassword("llampexpasswd") #db.setHostName("127.0.0.1") #db.setPort(10123) # #print "Database:",db # #if not db.open(): # print "unable to open database" # sys.exit(1) clientoptions.prepareParser() qsqlrpc.DEBUG_MODE = clientoptions.getDebug() db = clientoptions.getDB() query = QtSql.QSqlQuery("select * from "+clientoptions.getTable(),db) #query = QtSql.QSqlQuery("insert into users VALUES (7,'pepito','password','false','false')",db) while query.next(): print "next!" print "-----------------------------------------> "+query.value(0).toString() #db.close() del query clientoptions.db = None del db QtSql.QSqlDatabase.removeDatabase("myconnection")