From 4978511ebb7e8d31dab64485d1ac87b6e004be81 Mon Sep 17 00:00:00 2001 From: aneejit1 Date: Thu, 28 Jul 2022 15:46:19 +0000 Subject: Remove Qt V2 support and example files Build files for pyuic2 have been removed along with the examples for version 2 of Qt and the build/configure scripts have been amended accordingly. The "examples3" directory has been renamed to just "examples". Signed-off-by: aneejit1 (cherry picked from commit e602246539fd7435aaeb440fcb7f852c92c8426b) --- examples/SQL/README | 76 ++++++++++ examples/SQL/connect.ui | 238 ++++++++++++++++++++++++++++++ examples/SQL/connect.ui.h | 21 +++ examples/SQL/dbconnect.py | 82 +++++++++++ examples/SQL/dbpar.py | 22 +++ examples/SQL/form1.ui | 77 ++++++++++ examples/SQL/form2.ui | 327 ++++++++++++++++++++++++++++++++++++++++++ examples/SQL/frmconnect.py | 120 ++++++++++++++++ examples/SQL/frmconnect.ui | 245 +++++++++++++++++++++++++++++++ examples/SQL/runform1.py | 21 +++ examples/SQL/runform2.py | 21 +++ examples/SQL/runsqlex.py | 151 +++++++++++++++++++ examples/SQL/sqlcustom1.py | 94 ++++++++++++ examples/SQL/sqlex.ui | 303 ++++++++++++++++++++++++++++++++++++++ examples/SQL/sqlex.ui.h | 35 +++++ examples/SQL/sqlsubclass5.py | 151 +++++++++++++++++++ examples/SQL/sqltable4.py | 118 +++++++++++++++ examples/SQL/testdb_mysql.sql | 57 ++++++++ examples/SQL/testdb_pg.sql | 232 ++++++++++++++++++++++++++++++ 19 files changed, 2391 insertions(+) create mode 100644 examples/SQL/README create mode 100644 examples/SQL/connect.ui create mode 100644 examples/SQL/connect.ui.h create mode 100755 examples/SQL/dbconnect.py create mode 100644 examples/SQL/dbpar.py create mode 100644 examples/SQL/form1.ui create mode 100644 examples/SQL/form2.ui create mode 100644 examples/SQL/frmconnect.py create mode 100644 examples/SQL/frmconnect.ui create mode 100755 examples/SQL/runform1.py create mode 100755 examples/SQL/runform2.py create mode 100755 examples/SQL/runsqlex.py create mode 100755 examples/SQL/sqlcustom1.py create mode 100644 examples/SQL/sqlex.ui create mode 100644 examples/SQL/sqlex.ui.h create mode 100755 examples/SQL/sqlsubclass5.py create mode 100755 examples/SQL/sqltable4.py create mode 100644 examples/SQL/testdb_mysql.sql create mode 100644 examples/SQL/testdb_pg.sql (limited to 'examples/SQL') diff --git a/examples/SQL/README b/examples/SQL/README new file mode 100644 index 0000000..862e608 --- /dev/null +++ b/examples/SQL/README @@ -0,0 +1,76 @@ +This directory contains some translated sql examples from TQt 3.x. + +runform1.py, form1.ui: + + A simple designer generated TQDataTable. Run "pyuic form1.ui -o form1.py". + +runform2.py, form2.ui: + + A simple designer generated TQDataBrowser. Run "pyuic form2.ui -o form2.py". + +sqlcustom1.py: + + TQSqlForm based form with a simple custom editor forcing all input to + be uppercase + +sqltable4.py: + + Custom TQDataTable with reimplemented paintField method, combined with + a TQComboBox based custom field editor (StatusPicker), gathering its + items from a different table (status) and a calculated column (monsalary). + Note, that TQSqlEditorFactory based field editors are somewhat restricted, + because TQt's TQ_PROPERTY feature isn't supported, yet. I've circumvented + this limitation by choosing the status table ids corresponding to the + index in the TQComboBox. + +sqlsubclass5.py: + + Similar to the former, and even more deviated from its qt ancestor, + because the sense escaped me. This could be related to the different + database layout needed for MySQL (Trolltech used PostgreSQL sequences, + while we're using the simpler, but less powerful auto_increment here). + If you enter and invalid date (e.g. day: 0) in the Paid column, it is + shown as "not yet", but produces some qt warnings. + +runsqlex.py, sqlex.ui, sqlex.ui.h, connect.ui, connect.ui.h: + + This one is a most advanced example, showing the use of a TQSqlCursor + driven by TQSqlQuery and iterating through database tables and fields. + Definitely worth a look. + +Unfortunately you will have to make sure that these prerequisites are met +before trying the examples: + + - Install MySQL or PostgreSQL and any development packages + + - Create a database user with sufficient rights + + - Create the testdb database + - For MySQL, run: mysql -u user -p password < testdb_mysql.sql + - For PostgreSQL, run: psql -U user template1 -f testdb_pg.sql + + - Build TQt with the mysql and/or psql modules activated. + +Now you should be ready for the fun part. You can run dbconnect.py from +a command line and try to connect to the database. If all went well, +'ok' should be printed after pressing OK. If you don't want to enter all +your data over and over again, create a file named local_dbpar.py here, +with the following keys (with your own data, of course): + +DB_HOSTNAMES = ["localhost"] +DB_DATABASES = ["testdb"] +DB_USERNAME = "name" +DB_PASSWORD = "pass" + +The dbconnect.py script is generated from dbconnect.ui, which was created +with qt's designer. You can find it also in Boudewijn Rempt's book +"GUI Programming with Python, using the TQt Toolkit". Although you won't find +the SQL widgets discussed there, for the simple reason of the book being +written before they appeared, it is a valuable source for anybody new in +this area. + +Please direct any comments, patches and questions to . + +Good luck + +Hans-Peter Jansen diff --git a/examples/SQL/connect.ui b/examples/SQL/connect.ui new file mode 100644 index 0000000..d33a783 --- /dev/null +++ b/examples/SQL/connect.ui @@ -0,0 +1,238 @@ + +ConnectDialog + + + ConnectDialog + + + + 0 + 0 + 303 + 251 + + + + Connect... + + + + unnamed + + + 11 + + + 6 + + + + GroupBox3 + + + Connection settings + + + + unnamed + + + 11 + + + 6 + + + + editDatabase + + + + + TextLabel3 + + + Database Name: + + + comboDatabase + + + + + editPassword + + + Password + + + + + TextLabel4 + + + &Username: + + + editUsername + + + + + TextLabel4_2 + + + &Password: + + + editPassword + + + + + comboDriver + + + + + editUsername + + + + + editHostname + + + + + TextLabel5 + + + &Hostname: + + + editHostname + + + + + TextLabel5_2 + + + P&ort: + + + portSpinBox + + + + + portSpinBox + + + Default + + + 65535 + + + -1 + + + -1 + + + + + TextLabel2 + + + D&river + + + comboDriver + + + + + + + Layout25 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + + PushButton1 + + + &OK + + + true + + + + + PushButton2 + + + &Cancel + + + + + + + + + PushButton1 + clicked() + ConnectDialog + accept() + + + PushButton2 + clicked() + ConnectDialog + reject() + + + + comboDriver + editDatabase + editUsername + editPassword + editHostname + portSpinBox + PushButton1 + PushButton2 + + + connect.ui.h + + + init() + destroy() + + + diff --git a/examples/SQL/connect.ui.h b/examples/SQL/connect.ui.h new file mode 100644 index 0000000..ceff8dc --- /dev/null +++ b/examples/SQL/connect.ui.h @@ -0,0 +1,21 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use TQt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void ConnectDialog::init() +{ +from python_tqt.qtsql import TQSqlDatabase +#qDebug("ConnectDialog init") +self.comboDriver.clear() +self.comboDriver.insertStringList(TQSqlDatabase.drivers()) +} + +void ConnectDialog::destroy() +{ + +} diff --git a/examples/SQL/dbconnect.py b/examples/SQL/dbconnect.py new file mode 100755 index 0000000..d1c1baf --- /dev/null +++ b/examples/SQL/dbconnect.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from frmconnect import frmConnect +from dbpar import * + +TRUE = 1 +FALSE = 0 + +def createConnection(): + driver = DB_DRIVER + # all qt examples use TQSqlDatabase::addDatabase, but + # this never returns NULL in my experience + drivers = list(map(str, TQSqlDatabase.drivers())) + if driver in drivers: + dlg = dbConnect(driver) + #TODO: make connection parameters accessible + return dlg.exec_loop() + else: + TQMessageBox.warning(None, "Database Error", + "<%s> database driver not found!\n\n" + "Please make sure, that this database adaptor\n" + "is available in your TQt installation.\n" % + (driver), TQMessageBox.Abort | TQMessageBox.Escape) + return FALSE + +class dbConnect(frmConnect): + def __init__(self, driver, parent = None): + frmConnect.__init__(self, parent) + self.hostnames = DB_HOSTNAMES + self.hostname = DB_HOSTNAMES[0] + self.databases = DB_DATABASES + self.database = DB_DATABASES[0] + self.username = DB_USERNAME + self.password = DB_PASSWORD + self.dbdriver = driver + + self.txtName.setText(self.username) + self.txtPasswd.setText(self.password) + list(map(self.cmbServer.insertItem, self.hostnames)) + list(map(self.cmbDatabase.insertItem, self.databases)) + self.connect(self.buttonHelp, SIGNAL("clicked()"), + self.buttonHelp_clicked) + + def accept(self): + self.hostname = self.cmbServer.currentText() + self.database = self.cmbDatabase.currentText() + self.username = self.txtName.text() + self.password = self.txtPasswd.text() + db = TQSqlDatabase.addDatabase(self.dbdriver) + if db: + db.setHostName(self.hostname) + db.setDatabaseName(self.database) + db.setUserName(self.username) + db.setPassword(self.password) + if db.open(): + frmConnect.accept(self) + else: + TQMessageBox.warning(self, "Database Error", + "Cannot open %s database on %s!\n\n%s\n%s\n" % + (self.database, self.hostname, + db.lastError().driverText(), + db.lastError().databaseText()), " Ooops ") + + + def buttonHelp_clicked(self): + TQMessageBox.information(self, "About Connecting", + "Here you specify userid, password, host and database\n" + "for the PyTQt sql examples. If you encounter any problems,\n" + "please read the README file in this folder before posting.\n\n" + "Thanks,\nHans-Peter Jansen \n") + + +if __name__ == "__main__": + app = TQApplication(sys.argv) + if createConnection(): + print("ok") + else: + print("cancel") diff --git a/examples/SQL/dbpar.py b/examples/SQL/dbpar.py new file mode 100644 index 0000000..19e6d9b --- /dev/null +++ b/examples/SQL/dbpar.py @@ -0,0 +1,22 @@ +# sql examples default database parameter + +# you can create a local_dbpar.py module with definitons +# of your own parameters to overrule these defaults + +#DB_DRIVER = "TQPSQL7" +DB_DRIVER = "TQMYSQL3" +# list of servers +DB_HOSTNAMES = ["localhost"] +# list of databases +DB_DATABASES = ["testdb"] +# database user id +DB_USERNAME = "" +# database password +DB_PASSWORD = "" + +# remove this in your local_dbpar.py +try: + from local_dbpar import * +except: + pass + diff --git a/examples/SQL/form1.ui b/examples/SQL/form1.ui new file mode 100644 index 0000000..118a84e --- /dev/null +++ b/examples/SQL/form1.ui @@ -0,0 +1,77 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 370 + + + + Form1 + + + + + Forename + + + forename + + + + + Surname + + + surname + + + + + Salary + + + salary + + + + + Statusid + + + statusid + + + + DataTable2 + + + + 0 + 0 + 600 + 370 + + + + true + + + true + + + + (default) + staff + + + + + + diff --git a/examples/SQL/form2.ui b/examples/SQL/form2.ui new file mode 100644 index 0000000..4856e39 --- /dev/null +++ b/examples/SQL/form2.ui @@ -0,0 +1,327 @@ + +Form2 + + + Form2 + + + + 0 + 0 + 367 + 152 + + + + Form2 + + + + DataBrowser1 + + + + 0 + 0 + 366 + 150 + + + + + surname ASC + forename ASC + + + + + (default) + staff + + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + labelSurname + + + Surname + + + + + TQSpinBoxStatusid + + + 2147483647 + + + + (default) + staff + statusid + + + + + + TQLineEditSurname + + + + (default) + staff + surname + + + + + + labelStatusid + + + Statusid + + + + + labelForename + + + Forename + + + + + TQLineEditSalary + + + AlignRight + + + + (default) + staff + salary + + + + + + labelSalary + + + Salary + + + + + TQLineEditForename + + + + (default) + staff + forename + + + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + PushButtonFirst + + + |< &First + + + + + PushButtonPrev + + + << &Prev + + + + + PushButtonNext + + + &Next >> + + + + + PushButtonLast + + + &Last >| + + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + PushButtonInsert + + + &Insert + + + + + PushButtonUpdate + + + &Update + + + + + PushButtonDelete + + + &Delete + + + + + + + + + + PushButtonFirst + clicked() + DataBrowser1 + first() + + + DataBrowser1 + firstRecordAvailable( bool ) + PushButtonFirst + setEnabled(bool) + + + PushButtonPrev + clicked() + DataBrowser1 + prev() + + + DataBrowser1 + prevRecordAvailable( bool ) + PushButtonPrev + setEnabled(bool) + + + PushButtonNext + clicked() + DataBrowser1 + next() + + + DataBrowser1 + nextRecordAvailable( bool ) + PushButtonNext + setEnabled(bool) + + + PushButtonLast + clicked() + DataBrowser1 + last() + + + DataBrowser1 + lastRecordAvailable( bool ) + PushButtonLast + setEnabled(bool) + + + PushButtonInsert + clicked() + DataBrowser1 + insert() + + + PushButtonUpdate + clicked() + DataBrowser1 + update() + + + PushButtonDelete + clicked() + DataBrowser1 + del() + + + + TQLineEditForename + TQLineEditSurname + TQLineEditSalary + TQSpinBoxStatusid + PushButtonFirst + PushButtonPrev + PushButtonNext + PushButtonLast + PushButtonInsert + PushButtonUpdate + PushButtonDelete + + + diff --git a/examples/SQL/frmconnect.py b/examples/SQL/frmconnect.py new file mode 100644 index 0000000..97fb406 --- /dev/null +++ b/examples/SQL/frmconnect.py @@ -0,0 +1,120 @@ +# Form implementation generated from reading ui file 'frmconnect.ui' +# +# Created: Sam Jul 6 12:47:10 2002 +# by: The PyTQt User Interface Compiler (pyuic) +# +# WARNING! All changes made in this file will be lost! + + +from python_tqt.qt import * + + +class frmConnect(TQDialog): + def __init__(self,parent = None,name = None,modal = 0,fl = 0): + TQDialog.__init__(self,parent,name,modal,fl) + + if name == None: + self.setName("frmConnect") + + self.resize(415,154) + self.setCaption(self.trUtf8("Connecting")) + self.setSizeGripEnabled(1) + + frmConnectLayout = TQGridLayout(self,1,1,11,6,"frmConnectLayout") + + Layout7 = TQVBoxLayout(None,0,6,"Layout7") + + self.buttonOK = TQPushButton(self,"buttonOK") + self.buttonOK.setText(self.trUtf8("&OK")) + self.buttonOK.setAutoDefault(1) + self.buttonOK.setDefault(1) + TQToolTip.add(self.buttonOK,self.trUtf8("Connect to Database")) + Layout7.addWidget(self.buttonOK) + + self.buttonCancel = TQPushButton(self,"buttonCancel") + self.buttonCancel.setText(self.trUtf8("&Cancel")) + TQToolTip.add(self.buttonCancel,self.trUtf8("Cancel Connecting")) + Layout7.addWidget(self.buttonCancel) + + self.buttonHelp = TQPushButton(self,"buttonHelp") + self.buttonHelp.setText(self.trUtf8("&Help")) + TQToolTip.add(self.buttonHelp,self.trUtf8("About Connecting")) + Layout7.addWidget(self.buttonHelp) + spacer = TQSpacerItem(0,0,TQSizePolicy.Minimum,TQSizePolicy.Expanding) + Layout7.addItem(spacer) + + frmConnectLayout.addLayout(Layout7,0,1) + + self.grpConnection = TQGroupBox(self,"grpConnection") + self.grpConnection.setTitle(self.trUtf8("")) + self.grpConnection.setColumnLayout(0,TQt.Vertical) + self.grpConnection.layout().setSpacing(6) + self.grpConnection.layout().setMargin(11) + grpConnectionLayout = TQGridLayout(self.grpConnection.layout()) + grpConnectionLayout.setAlignment(TQt.AlignTop) + + self.txtName = TQLineEdit(self.grpConnection,"txtName") + self.txtName.setMaxLength(16) + TQToolTip.add(self.txtName,self.trUtf8("Database User ID")) + + grpConnectionLayout.addWidget(self.txtName,0,1) + + self.lblDatabase = TQLabel(self.grpConnection,"lblDatabase") + self.lblDatabase.setText(self.trUtf8("&Database")) + + grpConnectionLayout.addWidget(self.lblDatabase,3,0) + + self.lblServer = TQLabel(self.grpConnection,"lblServer") + self.lblServer.setText(self.trUtf8("&Server")) + + grpConnectionLayout.addWidget(self.lblServer,2,0) + + self.lblName = TQLabel(self.grpConnection,"lblName") + self.lblName.setText(self.trUtf8("&Name")) + + grpConnectionLayout.addWidget(self.lblName,0,0) + + self.cmbDatabase = TQComboBox(0,self.grpConnection,"cmbDatabase") + self.cmbDatabase.setEditable(1) + self.cmbDatabase.setAutoCompletion(1) + self.cmbDatabase.setDuplicatesEnabled(0) + TQToolTip.add(self.cmbDatabase,self.trUtf8("Database Name")) + + grpConnectionLayout.addWidget(self.cmbDatabase,3,1) + + self.txtPasswd = TQLineEdit(self.grpConnection,"txtPasswd") + self.txtPasswd.setMaxLength(16) + self.txtPasswd.setEchoMode(TQLineEdit.Password) + TQToolTip.add(self.txtPasswd,self.trUtf8("Database User Password")) + + grpConnectionLayout.addWidget(self.txtPasswd,1,1) + + self.lblPasswd = TQLabel(self.grpConnection,"lblPasswd") + self.lblPasswd.setText(self.trUtf8("&Password")) + + grpConnectionLayout.addWidget(self.lblPasswd,1,0) + + self.cmbServer = TQComboBox(0,self.grpConnection,"cmbServer") + self.cmbServer.setEditable(1) + self.cmbServer.setAutoCompletion(1) + self.cmbServer.setDuplicatesEnabled(0) + TQToolTip.add(self.cmbServer,self.trUtf8("Database Server Address")) + + grpConnectionLayout.addWidget(self.cmbServer,2,1) + + frmConnectLayout.addWidget(self.grpConnection,0,0) + + self.connect(self.buttonOK,SIGNAL("clicked()"),self,SLOT("accept()")) + self.connect(self.buttonCancel,SIGNAL("clicked()"),self,SLOT("reject()")) + + self.setTabOrder(self.txtName,self.txtPasswd) + self.setTabOrder(self.txtPasswd,self.cmbServer) + self.setTabOrder(self.cmbServer,self.cmbDatabase) + self.setTabOrder(self.cmbDatabase,self.buttonOK) + self.setTabOrder(self.buttonOK,self.buttonCancel) + self.setTabOrder(self.buttonCancel,self.buttonHelp) + + self.lblDatabase.setBuddy(self.cmbDatabase) + self.lblServer.setBuddy(self.cmbServer) + self.lblName.setBuddy(self.txtName) + self.lblPasswd.setBuddy(self.txtPasswd) diff --git a/examples/SQL/frmconnect.ui b/examples/SQL/frmconnect.ui new file mode 100644 index 0000000..f2017ee --- /dev/null +++ b/examples/SQL/frmconnect.ui @@ -0,0 +1,245 @@ + +frmConnect + + + frmConnect + + + + 0 + 0 + 415 + 154 + + + + Connecting + + + true + + + + unnamed + + + 11 + + + 6 + + + + Layout7 + + + + unnamed + + + 0 + + + 6 + + + + buttonOK + + + &OK + + + true + + + true + + + Connect to Database + + + + + buttonCancel + + + &Cancel + + + Cancel Connecting + + + + + buttonHelp + + + &Help + + + About Connecting + + + + + spacer + + + Vertical + + + Expanding + + + + + + + grpConnection + + + + + + + unnamed + + + 11 + + + 6 + + + + txtName + + + 16 + + + Database User ID + + + + + lblDatabase + + + &Database + + + cmbDatabase + + + + + lblServer + + + &Server + + + cmbServer + + + + + lblName + + + &Name + + + txtName + + + + + cmbDatabase + + + true + + + true + + + false + + + Database Name + + + + + txtPasswd + + + 16 + + + Password + + + Database User Password + + + + + lblPasswd + + + &Password + + + txtPasswd + + + + + cmbServer + + + true + + + true + + + false + + + Database Server Address + + + + + + + + + buttonOK + clicked() + frmConnect + accept() + + + buttonCancel + clicked() + frmConnect + reject() + + + + txtName + txtPasswd + cmbServer + cmbDatabase + buttonOK + buttonCancel + buttonHelp + + + diff --git a/examples/SQL/runform1.py b/examples/SQL/runform1.py new file mode 100755 index 0000000..2e01b7e --- /dev/null +++ b/examples/SQL/runform1.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +from form1 import Form1 +from dbconnect import createConnection + +class mainWindow(Form1): + def __init__(self,parent = None,name = None,fl = 0): + Form1.__init__(self,parent,name,fl) + +if __name__ == "__main__": + a = TQApplication(sys.argv) + if createConnection(): + TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) + w = mainWindow() + a.setMainWidget(w) + w.show() + a.exec_loop() + diff --git a/examples/SQL/runform2.py b/examples/SQL/runform2.py new file mode 100755 index 0000000..0184e9d --- /dev/null +++ b/examples/SQL/runform2.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * + +from form2 import Form2 +from dbconnect import createConnection + +class mainWindow(Form2): + def __init__(self,parent = None,name = None,fl = 0): + Form2.__init__(self,parent,name,fl) + +if __name__ == "__main__": + a = TQApplication(sys.argv) + if createConnection(): + TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) + w = mainWindow() + a.setMainWidget(w) + w.show() + a.exec_loop() + diff --git a/examples/SQL/runsqlex.py b/examples/SQL/runsqlex.py new file mode 100755 index 0000000..2235699 --- /dev/null +++ b/examples/SQL/runsqlex.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from sqlex import SqlEx +from connect import ConnectDialog + +from dbpar import * + +TRUE = 1 +FALSE = 0 + +def showError(err, parent): + errStr = TQString("The database reported an error:\n\n") + if not err.databaseText().isEmpty(): + errStr.append(err.databaseText()) + errStr.append("\n") + if not err.driverText().isEmpty(): + errStr.append(err.driverText()) + errStr.append("\n") + TQMessageBox.warning(parent, "Error", errStr) + +class CustomSqlCursor(TQSqlCursor): + def __init__(self, query = None, autopopulate = TRUE, db = None): + TQSqlCursor.__init__(self, None, autopopulate, db) + self.execQuery(query) + if self.isSelect() and autopopulate: + fields = self.driver().recordInfo(self) + for f in fields: + self.append(f) + self.setMode(TQSqlCursor.ReadOnly) + + def select(self, filter, sort = TQSqlIndex()): + return self.execQuery(self.lastQuery()) + + def primaryIndex(self, prime = TRUE): + return TQSqlIndex() + + def insert(self, invalidate = TRUE): + return FALSE + + def update(self, invalidate = TRUE): + return FALSE + + def delRecords(self, invalidate = TRUE): + return FALSE + + def setName(self, name, autopopulate = TRUE): + return + + +class MainWindow(SqlEx): + def __init__(self,parent = None,name = None,fl = 0): + SqlEx.__init__(self,parent,name,fl) + self.conDiag = ConnectDialog(self, "Connection Dialog", TRUE) + self.firstconn = TRUE + + def dbConnect(self): + if self.firstconn: + self.firstconn = FALSE + self.conDiag.editUsername.setText(DB_USERNAME) + self.conDiag.editPassword.setText(DB_PASSWORD) + self.conDiag.editHostname.setText(DB_HOSTNAMES[0]) + self.conDiag.editDatabase.setText(DB_DATABASES[0]) + for i in range(self.conDiag.comboDriver.count()): + if str(self.conDiag.comboDriver.text(i)) == DB_DRIVER: + self.conDiag.comboDriver.setCurrentItem(i) + break + if self.conDiag.exec_loop() != TQDialog.Accepted: + return + if self.dt.sqlCursor(): + self.dt.setSqlCursor() + + # close old connection (if any) + if TQSqlDatabase.contains("SqlEx"): + oldDb = TQSqlDatabase.database("SqlEx") + oldDb.close() + TQSqlDatabase.removeDatabase("SqlEx") + + # open the new connection + db = TQSqlDatabase.addDatabase(self.conDiag.comboDriver.currentText(), "SqlEx") + if not db: + TQMessageBox.warning(self, "Error", "Could not open database") + return + + db.setHostName(self.conDiag.editHostname.text()) + db.setDatabaseName(self.conDiag.editDatabase.text()) + db.setPort(self.conDiag.portSpinBox.value()) + if not db.open(self.conDiag.editUsername.text(), + self.conDiag.editPassword.text()): + showError(db.lastError(), self) + return + + self.lbl.setText("Double-Click on a table-name to view the contents") + self.lv.clear() + + tables = db.tables() + for t in tables: + lvi = TQListViewItem(self.lv, t) + fields = db.recordInfo(t) + for f in fields: + req = "?" + if f.isRequired() > 0: + req = "Yes" + elif f.isRequired() == 0: + req = "No" + fi = TQListViewItem(lvi, f.name(), TQVariant.typeToName(f.type()), req) + lvi.insertItem(fi) + self.lv.insertItem(lvi) + + self.submitBtn.setEnabled(TRUE) + + def execQuery(self): + cursor = CustomSqlCursor(self.te.text(), TRUE, + TQSqlDatabase.database("SqlEx", TRUE)) + if cursor.isSelect(): + self.dt.setSqlCursor(cursor, TRUE, TRUE) + self.dt.refresh() + txt = TQString("Query OK") + if cursor.size() >= 0: + txt.append(", returned rows: %s" % cursor.size()) + self.lbl.setText(txt) + else: + if not cursor.isActive(): + # an error occured + showError(cursor.lastError(), self) + else: + self.lbl.setText("Query OK, affected rows: %s" % + cursor.numRowsAffected()) + + def showTable(self, item): + i = item.parent() + if not i: + i = item + cursor = TQSqlCursor(i.text(0), TRUE, TQSqlDatabase.database("SqlEx", TRUE)) + self.dt.setSqlCursor(cursor, TRUE, TRUE) + self.dt.setSort(cursor.primaryIndex()) + self.dt.refresh(TQDataTable.RefreshAll) + self.lbl.setText("Displaying table %s" % i.text(0)) + + +if __name__ == "__main__": + a = TQApplication(sys.argv) + TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) + w = MainWindow() + a.setMainWidget(w) + w.show() + a.exec_loop() + diff --git a/examples/SQL/sqlcustom1.py b/examples/SQL/sqlcustom1.py new file mode 100755 index 0000000..4da8f8a --- /dev/null +++ b/examples/SQL/sqlcustom1.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: sqlcustom1.py,v 1.3 2002/07/06 13:35:41 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from dbconnect import createConnection + +TRUE = 1 +FALSE = 0 + +class CustomEdit(TQLineEdit): + def __init__(self, parent = None, name = None): + TQLineEdit.__init__(self, parent, name) + TQObject.connect(self, SIGNAL("textChanged(const TQString &)"), + self.changed) + + def changed(self, line): + self.setUpperLine(line) + + def setUpperLine(self, line): + self.upperLineText = line.upper() + self.setText(self.upperLineText) + + +class FormDialog(TQDialog): + def __init__(self): + TQDialog.__init__(self) + forenameLabel = TQLabel("Forename:", self) + forenameEdit = CustomEdit(self) + surnameLabel = TQLabel("Surname:", self) + surnameEdit = CustomEdit(self) + salaryLabel = TQLabel("Salary:", self) + salaryEdit = TQLineEdit(self) + salaryEdit.setAlignment(TQt.AlignRight) + saveButton = TQPushButton("&Save", self) + self.connect(saveButton, SIGNAL("clicked()"), self.save) + + grid = TQGridLayout(self) + grid.addWidget(forenameLabel, 0, 0) + grid.addWidget(forenameEdit, 0, 1) + grid.addWidget(surnameLabel, 1, 0) + grid.addWidget(surnameEdit, 1, 1) + grid.addWidget(salaryLabel, 2, 0) + grid.addWidget(salaryEdit, 2, 1) + grid.addWidget(saveButton, 3, 0) + grid.activate() + + self.staffCursor = TQSqlCursor("staff") + self.staffCursor.setTrimmed("forename", TRUE) + self.staffCursor.setTrimmed("surname", TRUE) + self.idIndex = self.staffCursor.index("id") + self.staffCursor.select(self.idIndex) + self.staffCursor.first() + + self.propMap = TQSqlPropertyMap() + self.propMap.insert(forenameEdit.className(), "upperLine") + + self.sqlForm = TQSqlForm() + self.sqlForm.setRecord(self.staffCursor.primeUpdate()) + self.sqlForm.installPropertyMap(self.propMap) + self.sqlForm.insert(forenameEdit, "forename") + self.sqlForm.insert(surnameEdit, "surname") + self.sqlForm.insert(salaryEdit, "salary") + self.sqlForm.readFields() + + def save(self): + self.sqlForm.writeFields() + self.staffCursor.update() + self.staffCursor.select(self.idIndex) + self.staffCursor.first() + + +if __name__=='__main__': + app = TQApplication( sys.argv ) + + if createConnection(): + formDialog = FormDialog() + formDialog.show() + + app.setMainWidget(formDialog) + app.exec_loop() + + diff --git a/examples/SQL/sqlex.ui b/examples/SQL/sqlex.ui new file mode 100644 index 0000000..64b3d0f --- /dev/null +++ b/examples/SQL/sqlex.ui @@ -0,0 +1,303 @@ + +SqlEx + + + SqlEx + + + + 0 + 0 + 669 + 438 + + + + SQL Browser + + + + unnamed + + + 11 + + + 6 + + + + Layout23 + + + + unnamed + + + 0 + + + 6 + + + + lbl + + + Press "Connect" to open a database + + + + + conBtn + + + + 0 + 0 + 0 + 0 + + + + + 80 + 0 + + + + &Connect... + + + + + + + vsplit + + + Vertical + + + + hsplit + + + Horizontal + + + + + Tables + + + true + + + true + + + + + Type + + + true + + + true + + + + + Required + + + true + + + true + + + + lv + + + 0 + + + true + + + true + + + LastColumn + + + + + dt + + + false + + + + + + gb + + + SQL Query + + + + unnamed + + + 11 + + + 6 + + + + Layout22 + + + + unnamed + + + 0 + + + 6 + + + + te + + + + + Layout21 + + + + unnamed + + + 0 + + + 6 + + + + Spacer3 + + + Horizontal + + + Expanding + + + + + submitBtn + + + + 5 + 0 + 0 + 0 + + + + + 80 + 0 + + + + &Submit + + + + + clearBtn + + + + 5 + 0 + 0 + 0 + + + + + 80 + 0 + + + + C&lear + + + + + + + + + + + + + + clearBtn + clicked() + te + clear() + + + conBtn + clicked() + SqlEx + dbConnect() + + + lv + returnPressed(TQListViewItem*) + SqlEx + showTable(TQListViewItem*) + + + lv + doubleClicked(TQListViewItem*) + SqlEx + showTable(TQListViewItem*) + + + submitBtn + clicked() + SqlEx + execQuery() + + + + sqlex.ui.h + + + init() + dbConnect() + showTable( TQListViewItem * ) + execQuery() + + + diff --git a/examples/SQL/sqlex.ui.h b/examples/SQL/sqlex.ui.h new file mode 100644 index 0000000..07edcd0 --- /dev/null +++ b/examples/SQL/sqlex.ui.h @@ -0,0 +1,35 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use TQt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void SqlEx::init() +{ +self.hsplit.setSizes([250]) +self.hsplit.setResizeMode(self.lv, TQSplitter.KeepSize) +self.vsplit.setResizeMode(self.gb, TQSplitter.KeepSize) +self.submitBtn.setEnabled(0) +} + + +void SqlEx::dbConnect() +{ + +} + + +void SqlEx::showTable( TQListViewItem * ) +{ + +} + + + +void SqlEx::execQuery() +{ + +} diff --git a/examples/SQL/sqlsubclass5.py b/examples/SQL/sqlsubclass5.py new file mode 100755 index 0000000..0fdc78c --- /dev/null +++ b/examples/SQL/sqlsubclass5.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: sqlsubclass5.py,v 1.3 2002/07/06 13:35:41 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from dbconnect import createConnection + +TRUE = 1 +FALSE = 0 + +class CustomTable(TQDataTable): + def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None): + TQDataTable.__init__(self, cursor, autoPopulate, parent, name) + + def paintField(self, p, field, cr, b): + if not field: + return + fn = str(field.name()) + if fn == "pricesid": + query = TQSqlQuery("SELECT name FROM prices WHERE id=%s" % + field.value().toString()) + value = "" + if next(query): + value = query.value(0).toString() + p.drawText(2, 2, cr.width()-4, cr.height()-4, + self.fieldAlignment(field), value) + elif fn == "quantity": + p.drawText(2, 2, cr.width()-6, cr.height()-4, + TQt.AlignRight|TQt.AlignVCenter, field.value().toString()) + elif fn in ("price", "cost"): + v = field.value().toDouble() + if v < 0: + p.setPen(TQColor("red")) + value = TQString("%.2f \u20ac" % v) + p.drawText(2, 2, cr.width()-6, cr.height()-4, + TQt.AlignRight|TQt.AlignVCenter, value) + elif fn == "paiddate": + if field.value().toDate().isNull(): + v = TQString("not yet") + p.setPen(TQColor("red")) + else: + v = field.value().toDate().toString(TQt.LocalDate) + p.drawText(2, 2, cr.width()-4, cr.height()-4, + TQt.AlignHCenter|TQt.AlignVCenter, v) + else: + TQDataTable.paintField(self, p, field, cr, b) + + +class InvoiceItemCursor(TQSqlCursor): + def __init__(self): + TQSqlCursor.__init__(self, "invoiceitem") + + productPrice = TQSqlFieldInfo("price", TQVariant.Double) + self.append(productPrice) + self.setCalculated(productPrice.name(), TRUE) + + productCost = TQSqlFieldInfo("cost", TQVariant.Double) + self.append(productCost) + self.setCalculated(productCost.name(), TRUE) + + def calculateField(self, name): + fn = str(name) + if fn == "productname": + query = TQSqlQuery("SELECT name FROM prices WHERE id=%d;" % + (self.field("pricesid").value().toInt())) + if next(query): + return query.value(0) + elif fn == "price": + query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" % + (self.field("pricesid").value().toInt())) + if next(query): + return query.value(0) + elif fn == "cost": + query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" % + (self.field("pricesid").value().toInt())) + if next(query): + return TQVariant(query.value(0).toDouble() * + self.value("quantity").toDouble()) + return TQVariant(TQString.null) + + def primeInsert(self): + buffer = self.editBuffer() + buffer.setValue("id", TQVariant(0)) + buffer.setValue("paiddate", TQVariant(TQDate.currentDate())) + buffer.setValue("quantity", TQVariant(1)) + return buffer + + +class ProductPicker(TQComboBox): + def __init__(self, parent = None, name = None): + TQComboBox.__init__(self, parent, name) + cur = TQSqlCursor("prices") + cur.select(cur.index("id")) + while next(cur): + self.insertItem(cur.value("name").toString(), cur.value("id").toInt()) + + +class CustomSqlEditorFactory(TQSqlEditorFactory): + def __init__(self): + TQSqlEditorFactory.__init__(self) + + def createEditor(self, parent, field): + try: + if str(field.name()) == "pricesid": + return ProductPicker(parent) + except AttributeError: + pass + return TQSqlEditorFactory.createEditor(self, parent, field) + +class Table(CustomTable): + def __init__(self): + self.invoiceItemCursor = InvoiceItemCursor() + TQDataTable.__init__(self, self.invoiceItemCursor) + self.propMap = TQSqlPropertyMap() + self.editorFactory = CustomSqlEditorFactory() + self.propMap.insert("ProductPicker", "pricesid") + self.installPropertyMap(self.propMap) + self.installEditorFactory(self.editorFactory) + + for cn, ch in (("pricesid", "Product"), + ("quantity", "Quantity"), + ("price", "Price" ), + ("cost", "Cost"), + ("paiddate", "Paid")): + self.addColumn(cn, ch) + self.setColumnWidth(0 , 150) + self.setColumnWidth(1, 70) + self.resize(600, 250) + self.refresh() + + +if __name__=='__main__': + app = TQApplication(sys.argv) + if createConnection(): + t = Table() + app.setMainWidget(t) + t.show() + app.exec_loop() + + diff --git a/examples/SQL/sqltable4.py b/examples/SQL/sqltable4.py new file mode 100755 index 0000000..a8484c5 --- /dev/null +++ b/examples/SQL/sqltable4.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python + +#**************************************************************************** +#** $Id: sqltable4.py,v 1.3 2002/07/06 13:35:41 phil Exp $ +#** +#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. +#** +#** This file is part of an example program for PyTQt. This example +#** program may be used, distributed and modified without limitation. +#** +#*****************************************************************************/ + +import sys +from python_tqt.qt import * +from python_tqt.qtsql import * + +from dbconnect import createConnection + +TRUE = 1 +FALSE = 0 + +class CustomTable(TQDataTable): + def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None): + TQDataTable.__init__(self, cursor, autoPopulate, parent, name) + + def paintField(self, p, field, cr, b): + if not field: + return + fn = str(field.name()) + if fn in ("salary", "monsalary"): + v = field.value().toDouble() + if v < 0: + p.setPen(TQColor("red")) + value = TQString("%.2f \u20ac" % v) + #print unicode(value).encode("iso-8859-15") + p.drawText(2, 2, cr.width()-6, cr.height()-4, + TQt.AlignRight|TQt.AlignVCenter, value) + elif fn == "statusid": + query = TQSqlQuery("SELECT name FROM status WHERE id=%s" % + field.value().toString()) + value = "" + if next(query): + value = query.value(0).toString() + p.drawText(2, 2, cr.width()-4, cr.height()-4, + self.fieldAlignment(field), value) + else: + TQDataTable.paintField(self, p, field, cr, b) + + +class StatusPicker(TQComboBox): + def __init__(self, parent = None, name = None): + TQComboBox.__init__(self, parent, name) + cur = TQSqlCursor("status") + cur.select(cur.index("id")) + while next(cur): + self.insertItem(cur.value("name").toString(), cur.value("id").toInt()) + + +class CustomSqlEditorFactory(TQSqlEditorFactory): + def __init__(self): + TQSqlEditorFactory.__init__(self) + + def createEditor(self, parent, field): + try: + if str(field.name()) == "statusid": + return StatusPicker(parent) + except AttributeError: + pass + return TQSqlEditorFactory.createEditor(self, parent, field) + + +class StaffCursor(TQSqlCursor): + def __init__(self): + TQSqlCursor.__init__(self, "staff") + monSalary = TQSqlFieldInfo("monsalary", TQVariant.Double) + self.append(monSalary) + self.setCalculated(monSalary.name(), TRUE) + + def calculateField(self, name): + if str(name) == "monsalary": + return TQVariant(self.value("salary").toDouble() / 12) + return TQVariant(TQString.null) + + +class Table(CustomTable): + def __init__(self): + #self.staffCursor = TQSqlCursor("staff") + self.staffCursor = StaffCursor() + TQDataTable.__init__(self, self.staffCursor) + self.propMap = TQSqlPropertyMap() + self.editorFactory = CustomSqlEditorFactory() + self.propMap.insert("StatusPicker", "statusid") + self.installPropertyMap(self.propMap) + self.installEditorFactory(self.editorFactory) + for cn, ch in (("forename", "Forename"), + ("surname", "Surname" ), + ("salary", "Annual Salary"), + ("monsalary","Monthly Salary"), + ("statusid", "Status")): + self.addColumn(cn, ch) + self.order = TQStringList("surname") + self.order.append("forename") + self.setSort(self.order) + self.refresh() + + +if __name__=='__main__': + app = TQApplication(sys.argv) + #app.setFont(TQFont("Verdana", 11)) + + if createConnection(): + t = Table() + app.setMainWidget(t) + t.resize(600, 250) + t.show() + app.exec_loop() + + diff --git a/examples/SQL/testdb_mysql.sql b/examples/SQL/testdb_mysql.sql new file mode 100644 index 0000000..144d4c9 --- /dev/null +++ b/examples/SQL/testdb_mysql.sql @@ -0,0 +1,57 @@ +drop database testdb; +create database testdb; +use testdb; + +create table people (id integer primary key auto_increment, + name char(40)); + +create table staff (id integer primary key auto_increment, + forename char(40), + surname char(40), + salary float(10,2), + statusid integer); + +create table status (id integer primary key, + name char(30)); + +create table creditors (id integer primary key auto_increment, + forename char(40), + surname char(40), + city char(30)); + +create table prices (id integer primary key, + name char(40), + price float); + +create table invoiceitem (id integer primary key auto_increment, + pricesid integer, + quantity integer, + paiddate date); + +insert into staff (forename, surname, salary, statusid) values + ("Hugo", "Hurtig", 123450.50, 0), + ("Alfred E.", "Neumann", 56780.90, 1), + ("Agate", "Schnell-Fertig", 12340.56, 2), + ("Emil", "Dotterschreck", -5670.23, 3), + ("Eugen", "Nutzlos", -7833.56, 3), + ("Harald", "Schmidt", -150000.0, 3), + ("Urmel", "auf dem Eis", 7778.0, 2); + +insert into status (id, name) values + (0, 'Chief'), + (1, 'Programmer'), + (2, 'Secretary'), + (3, 'Driver'); + +insert into prices (id, name, price) values + (0, "Waschbecken", 150.25), + (1, "Wellensittich", 27.95), + (2, "Roter Papagei", 850.0), + (3, "Spam & Eggs", -7.50), + (4, "Renault Espace", 9000.0), + (5, "Tux, der Pinguin", 65.35), + (6, "Makroskop", 985000.0), + (7, "Regenbaum", 1235.65), + (8, "Bluterguß", 23.95), + (9, "Weltmeisterschaft", 2.95), + (10, "Premiere Dekoder", -185.75); diff --git a/examples/SQL/testdb_pg.sql b/examples/SQL/testdb_pg.sql new file mode 100644 index 0000000..73a4270 --- /dev/null +++ b/examples/SQL/testdb_pg.sql @@ -0,0 +1,232 @@ +-- +-- Selected TOC Entries: +-- +-- +-- TOC Entry ID 1 (OID 0) +-- +-- Name: testdb Type: DATABASE Owner: postgres +-- + +CREATE DATABASE "testdb"; + +\connect testdb postgres +-- +-- TOC Entry ID 16 (OID 17332) +-- +-- Name: people Type: TABLE Owner: postgres +-- + +CREATE TABLE "people" ( + "id" integer DEFAULT nextval('people_id_seq'::text) NOT NULL, + "name" character(40), + Constraint "people_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 17 (OID 17335) +-- +-- Name: staff Type: TABLE Owner: postgres +-- + +CREATE TABLE "staff" ( + "id" integer DEFAULT nextval('staff_id_seq'::text) NOT NULL, + "forename" character(40), + "surname" character(40), + "salary" money, + "statusid" integer, + Constraint "staff_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 18 (OID 17338) +-- +-- Name: status Type: TABLE Owner: postgres +-- + +CREATE TABLE "status" ( + "id" integer NOT NULL, + "name" character(30), + Constraint "status_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 19 (OID 17341) +-- +-- Name: creditors Type: TABLE Owner: postgres +-- + +CREATE TABLE "creditors" ( + "id" integer DEFAULT nextval('creditors_id_seq'::text) NOT NULL, + "forename" character(40), + "surname" character(40), + "city" character(30), + Constraint "creditors_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 20 (OID 17344) +-- +-- Name: prices Type: TABLE Owner: postgres +-- + +CREATE TABLE "prices" ( + "id" integer NOT NULL, + "name" character(40), + "price" real, + Constraint "prices_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 21 (OID 17347) +-- +-- Name: invoiceitem Type: TABLE Owner: postgres +-- + +CREATE TABLE "invoiceitem" ( + "id" integer DEFAULT nextval('invoice_id_seq'::text) NOT NULL, + "pricesid" integer, + "quantity" integer, + "paiddate" date, + Constraint "invoiceitem_pkey" Primary Key ("id") +); + +-- +-- TOC Entry ID 2 (OID 17351) +-- +-- Name: people_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "people_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- TOC Entry ID 4 (OID 17353) +-- +-- Name: staff_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "staff_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- TOC Entry ID 6 (OID 17355) +-- +-- Name: creditors_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "creditors_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- TOC Entry ID 8 (OID 17357) +-- +-- Name: invoice_id_seq Type: SEQUENCE Owner: postgres +-- + +CREATE SEQUENCE "invoice_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +-- +-- Data for TOC Entry ID 28 (OID 17332) +-- +-- Name: people Type: TABLE DATA Owner: postgres +-- + + +COPY "people" FROM stdin; +\. +-- +-- Data for TOC Entry ID 29 (OID 17335) +-- +-- Name: staff Type: TABLE DATA Owner: postgres +-- + + +COPY "staff" FROM stdin; +1 Hugo Hurtig $123,450.50 0 +2 Alfred E. Neumann $56,780.90 1 +3 Agate Schnell-Fertig $12,340.56 2 +6 Eugen Nutzlos -$7,833.56 3 +7 Harald Schmidt -$150,000.00 3 +4 Urmel auf dem Eis $7,778.00 2 +5 Emil Dotterschreck -$5,670.23 3 +\. +-- +-- Data for TOC Entry ID 30 (OID 17338) +-- +-- Name: status Type: TABLE DATA Owner: postgres +-- + + +COPY "status" FROM stdin; +0 Chief +1 Programmer +2 Secretary +3 Driver +\. +-- +-- Data for TOC Entry ID 31 (OID 17341) +-- +-- Name: creditors Type: TABLE DATA Owner: postgres +-- + + +COPY "creditors" FROM stdin; +\. +-- +-- Data for TOC Entry ID 32 (OID 17344) +-- +-- Name: prices Type: TABLE DATA Owner: postgres +-- + + +COPY "prices" FROM stdin; +0 Waschbecken 150.25 +1 Wellensittich 27.95 +2 Roter Papagei 850 +3 Spam & Eggs -7.5 +4 Renault Espace 9000 +5 Tux, der Pinguin 65.35 +6 Makroskop 985000 +7 Regenbaum 1235.65 +8 Bluterguß 23.95 +9 Weltmeisterschaft 2.95 +10 Premiere Dekoder -185.75 +\. +-- +-- Data for TOC Entry ID 33 (OID 17347) +-- +-- Name: invoiceitem Type: TABLE DATA Owner: postgres +-- + + +COPY "invoiceitem" FROM stdin; +\. +-- +-- TOC Entry ID 3 (OID 17351) +-- +-- Name: people_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"people_id_seq"', 1, false); + +-- +-- TOC Entry ID 5 (OID 17353) +-- +-- Name: staff_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"staff_id_seq"', 8, true); + +-- +-- TOC Entry ID 7 (OID 17355) +-- +-- Name: creditors_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"creditors_id_seq"', 1, false); + +-- +-- TOC Entry ID 9 (OID 17357) +-- +-- Name: invoice_id_seq Type: SEQUENCE SET Owner: postgres +-- + +SELECT setval ('"invoice_id_seq"', 1, false); + -- cgit v1.2.3