diff options
Diffstat (limited to 'sip/tqtsql')
-rw-r--r-- | sip/tqtsql/copying.sip | 51 | ||||
-rw-r--r-- | sip/tqtsql/tqdatabrowser.sip | 144 | ||||
-rw-r--r-- | sip/tqtsql/tqdatatable.sip | 185 | ||||
-rw-r--r-- | sip/tqtsql/tqdataview.sip | 54 | ||||
-rw-r--r-- | sip/tqtsql/tqeditorfactory.sip | 49 | ||||
-rw-r--r-- | sip/tqtsql/tqsql.sip | 74 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlcursor.sip | 140 | ||||
-rw-r--r-- | sip/tqtsql/tqsqldatabase.sip | 135 | ||||
-rw-r--r-- | sip/tqtsql/tqsqldriver.sip | 86 | ||||
-rw-r--r-- | sip/tqtsql/tqsqleditorfactory.sip | 51 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlerror.sip | 62 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlfield.sip | 91 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlform.sip | 68 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlindex.sip | 60 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlpropertymap.sip | 59 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlquery.sip | 103 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlrecord.sip | 171 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlresult.sip | 69 | ||||
-rw-r--r-- | sip/tqtsql/tqsqlselectcursor.sip | 88 | ||||
-rw-r--r-- | sip/tqtsql/tqtsqlmod.sip | 88 |
20 files changed, 1828 insertions, 0 deletions
diff --git a/sip/tqtsql/copying.sip b/sip/tqtsql/copying.sip new file mode 100644 index 0000000..49b4531 --- /dev/null +++ b/sip/tqtsql/copying.sip @@ -0,0 +1,51 @@ +// This is the SIP file defining the PyTQt license. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%Copying +Copyright (c) 2007 + Riverbank Computing Limited <info@riverbankcomputing.co.uk> + +This file is part of PyTQt. + +This copy of PyTQt is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%End + + +%OptionalInclude pytqt-internal.sip +%OptionalInclude pytqt-gpl.sip +%OptionalInclude pytqt-commercial.sip +%OptionalInclude pytqt-edu.sip +%OptionalInclude pytqt-eval.sip +%OptionalInclude pytqt-nc.sip +%OptionalInclude pytqt-tkc.sip diff --git a/sip/tqtsql/tqdatabrowser.sip b/sip/tqtsql/tqdatabrowser.sip new file mode 100644 index 0000000..4aa7281 --- /dev/null +++ b/sip/tqtsql/tqdatabrowser.sip @@ -0,0 +1,144 @@ +// This is the SIP interface definition for TQDataBrowser. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQDataBrowser (TQt v3+)</Title> +<FuncSynopsis> + <FuncDef>virtual void <Function>del</Function></FuncDef> + <ParamDef></ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>delOnCursor</Literal> in Python. +</Para> +</Sect2> +%End + + +class TQDataBrowser : TQWidget +{ +%TypeHeaderCode +#include <tqdatabrowser.h> +%End + +public: + TQDataBrowser(TQWidget * /TransferThis/ = 0,const char * = 0,WFlags = 0); + + enum Boundary { + Unknown, + None, + BeforeBeginning, + Beginning, + End, + AfterEnd + }; + + Boundary boundary(); + void setBoundaryChecking(bool); + bool boundaryChecking() const; + + void setSort(const TQSqlIndex &); + void setSort(const TQStringList &); + TQStringList sort() const; + void setFilter(const TQString &); + TQString filter() const; + + virtual void setSqlCursor(TQSqlCursor * /GetWrapper/,bool = 0); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->TQDataBrowser::setSqlCursor(a0, a1) : sipCpp->setSqlCursor(a0, a1); + Py_END_ALLOW_THREADS + + // Transfer ownership of the cursor if the autoDelete flag is + // set. + if (a0 && a1) + sipTransferTo(a0Wrapper,sipSelf); +%End + + TQSqlCursor* sqlCursor() const; + virtual void setForm(TQSqlForm *); + TQSqlForm* form(); + + virtual void setConfirmEdits(bool); + virtual void setConfirmInsert(bool); + virtual void setConfirmUpdate(bool); + virtual void setConfirmDelete(bool); + virtual void setConfirmCancels(bool); + bool confirmEdits() const; + bool confirmInsert() const; + bool confirmUpdate() const; + bool confirmDelete() const; + bool confirmCancels() const; + + virtual void setReadOnly(bool); + bool isReadOnly() const; + virtual void setAutoEdit(bool); + bool autoEdit() const; + + virtual bool seek(int,bool = 0) /ReleaseGIL/; + +signals: + void firstRecordAvailable(bool); + void lastRecordAvailable(bool); + void nextRecordAvailable(bool); + void prevRecordAvailable(bool); + + void currentChanged(const TQSqlRecord *); + void primeInsert(TQSqlRecord *); + void primeUpdate(TQSqlRecord *); + void primeDelete(TQSqlRecord *); + void beforeInsert(TQSqlRecord *); + void beforeUpdate(TQSqlRecord *); + void beforeDelete(TQSqlRecord *); + void cursorChanged(TQSqlCursor::Mode); + +public slots: + virtual void refresh(); + + virtual void insert() /ReleaseGIL/; + virtual void update() /ReleaseGIL/; + virtual void del() /PyName=delOnCursor, ReleaseGIL/; + + virtual void first() /ReleaseGIL/; + virtual void last() /ReleaseGIL/; + virtual void next() /ReleaseGIL/; + virtual void prev() /ReleaseGIL/; + + virtual void readFields(); + virtual void writeFields(); + virtual void clearValues(); + + void updateBoundary(); + +protected: + virtual bool insertCurrent() /ReleaseGIL/; + virtual bool updateCurrent() /ReleaseGIL/; + virtual bool deleteCurrent() /ReleaseGIL/; + virtual bool currentEdited(); + + virtual TQSql::Confirm confirmEdit(TQSql::Op) /ReleaseGIL/; + virtual TQSql::Confirm confirmCancel(TQSql::Op) /ReleaseGIL/; + + virtual void handleError(const TQSqlError &) /ReleaseGIL/; + +private: + TQDataBrowser(const TQDataBrowser &); +}; diff --git a/sip/tqtsql/tqdatatable.sip b/sip/tqtsql/tqdatatable.sip new file mode 100644 index 0000000..5840f3e --- /dev/null +++ b/sip/tqtsql/tqdatatable.sip @@ -0,0 +1,185 @@ +// This is the SIP interface definition for TQDataTable. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQDataTable (TQt v3+)</Title> +<Para> +<Literal>TQDataTable</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQDataTable : TQTable +{ +%TypeHeaderCode +#include <tqdatatable.h> +%End + +public: + TQDataTable(TQWidget* /TransferThis/ = 0,const char * = 0); + TQDataTable(TQSqlCursor *,bool = 0,TQWidget * /TransferThis/ = 0, + const char * = 0); + + virtual void addColumn(const TQString &,const TQString & = TQString::null, + int = -1,const TQIconSet & = TQIconSet()); + virtual void removeColumn(uint); + virtual void setColumn(uint,const TQString &, + const TQString & = TQString::null,int = -1, + const TQIconSet & = TQIconSet()); + + TQString nullText() const; + TQString trueText() const; + TQString falseText() const; + DateFormat dateFormat() const; + bool confirmEdits() const; + bool confirmInsert() const; + bool confirmUpdate() const; + bool confirmDelete() const; + bool confirmCancels() const; + bool autoDelete() const; + bool autoEdit() const; + TQString filter() const; + TQStringList sort() const; + + virtual void setSqlCursor(TQSqlCursor * /GetWrapper/ = 0,bool = 0,bool = 0); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->TQDataTable::setSqlCursor(a0, a1, a2) : sipCpp->setSqlCursor(a0, a1, a2); + Py_END_ALLOW_THREADS + + // Transfer ownership of the cursor if the autoDelete flag is + // set. + if (a0 && a2) + sipTransferTo(a0Wrapper,sipSelf); +%End + + TQSqlCursor *sqlCursor() const; + + virtual void setNullText(const TQString &); + virtual void setTrueText(const TQString &); + virtual void setFalseText(const TQString &); + virtual void setDateFormat(const DateFormat); + virtual void setConfirmEdits(bool); + virtual void setConfirmInsert(bool); + virtual void setConfirmUpdate(bool); + virtual void setConfirmDelete(bool); + virtual void setConfirmCancels(bool); + virtual void setAutoDelete(bool); + virtual void setAutoEdit(bool); + virtual void setFilter(const TQString &); + virtual void setSort(const TQStringList &); + virtual void setSort(const TQSqlIndex &); + + enum Refresh { + RefreshData, + RefreshColumns, + RefreshAll + }; + + void refresh(Refresh); + void sortColumn(int,bool = 1,bool = 0); + TQString text(int,int) const; + TQVariant value(int,int) const; + TQSqlRecord *currentRecord() const; + + void installEditorFactory(TQSqlEditorFactory * /Transfer/); + void installPropertyMap(TQSqlPropertyMap * /Transfer/); + + int numCols() const; + int numRows() const; + void setNumCols(int); + void setNumRows(int); + bool findBuffer(const TQSqlIndex &,int = 0); + + void hideColumn(int); + void showColumn(int); + +signals: + void currentChanged(TQSqlRecord *); + void primeInsert(TQSqlRecord *); + void primeUpdate(TQSqlRecord *); + void primeDelete(TQSqlRecord *); + void beforeInsert(TQSqlRecord *); + void beforeUpdate(TQSqlRecord *); + void beforeDelete(TQSqlRecord *); + void cursorChanged(TQSql::Op); + +public slots: + virtual void find(const TQString &,bool,bool); + virtual void sortAscending(int); + virtual void sortDescending(int); + virtual void refresh(); + void setColumnWidth(int,int); + void adjustColumn(int); + void setColumnStretchable(int,bool); + void swapColumns(int,int,bool = 0); + +protected: + virtual bool insertCurrent(); + virtual bool updateCurrent(); + virtual bool deleteCurrent(); + + virtual TQSql::Confirm confirmEdit(TQSql::Op); + virtual TQSql::Confirm confirmCancel(TQSql::Op); + + virtual void handleError(const TQSqlError &); + + virtual bool beginInsert(); + virtual TQWidget *beginUpdate(int,int,bool); + + bool eventFilter(TQObject *,TQEvent *); + void keyPressEvent(TQKeyEvent *); + void resizeEvent(TQResizeEvent *); + void contentsMousePressEvent(TQMouseEvent *); + void contentsContextMenuEvent(TQContextMenuEvent *); + void endEdit(int,int,bool,bool); + + // We don't specify /Factory/ for this because the returned TQWidget + // will always have a parent which will own it. + TQWidget *createEditor(int,int,bool) const; + + void activateNextCell(); + int indexOf(uint) const; + void reset(); + void setSize(TQSqlCursor *); + void repaintCell(int,int); + void paintCell(TQPainter *,int,int,const TQRect &,bool, + const TQColorGroup &); + virtual void paintField(TQPainter *,const TQSqlField *,const TQRect &, + bool); + void drawContents(TQPainter *,int,int,int,int); + virtual int fieldAlignment(const TQSqlField *); + void columnClicked(int); + void resizeData(int); + + TQTableItem *item(int,int) const; + void setItem(int,int,TQTableItem *); + void clearCell(int,int); + void setPixmap(int,int,const TQPixmap &); + void takeItem(TQTableItem *); + +private: + TQWidget *beginEdit(int,int,bool); + + TQDataTable(const TQDataTable &); +}; diff --git a/sip/tqtsql/tqdataview.sip b/sip/tqtsql/tqdataview.sip new file mode 100644 index 0000000..cfa3c98 --- /dev/null +++ b/sip/tqtsql/tqdataview.sip @@ -0,0 +1,54 @@ +// This is the SIP interface definition for TQDataView. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQDataView (TQt v3+)</Title> +<Para> +<Literal>TQDataView</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQDataView : TQWidget +{ +%TypeHeaderCode +#include <tqdataview.h> +%End + +public: + TQDataView(TQWidget * /TransferThis/ = 0,const char * = 0,WFlags = 0); + + virtual void setForm(TQSqlForm *); + TQSqlForm *form(); + virtual void setRecord(TQSqlRecord *); + TQSqlRecord *record(); + +public slots: + virtual void refresh(TQSqlRecord *); + virtual void readFields(); + virtual void writeFields(); + virtual void clearValues(); + +private: + TQDataView(const TQDataView &); +}; diff --git a/sip/tqtsql/tqeditorfactory.sip b/sip/tqtsql/tqeditorfactory.sip new file mode 100644 index 0000000..4208d90 --- /dev/null +++ b/sip/tqtsql/tqeditorfactory.sip @@ -0,0 +1,49 @@ +// This is the SIP interface definition for TQEditorFactory. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQEditorFactory (TQt v3+)</Title> +<Para> +<Literal>TQEditorFactory</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQEditorFactory : TQObject +{ +%TypeHeaderCode +#include <tqeditorfactory.h> +%End + +public: + TQEditorFactory(TQObject * /TransferThis/ = 0,const char * = 0); + + virtual TQWidget *createEditor(TQWidget * /TransferThis/, + const TQVariant &) /Factory/; + + static TQEditorFactory *defaultFactory(); + static void installDefaultFactory(TQEditorFactory * /Transfer/); + +private: + TQEditorFactory(const TQEditorFactory &); +}; diff --git a/sip/tqtsql/tqsql.sip b/sip/tqtsql/tqsql.sip new file mode 100644 index 0000000..727134e --- /dev/null +++ b/sip/tqtsql/tqsql.sip @@ -0,0 +1,74 @@ +// This is the SIP interface definition for TQSql. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSql (TQt v3+)</Title> +<Para> +<Literal>TQSql</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSql +{ +%TypeHeaderCode +#include <tqsql.h> +%End + +public: + TQSql(); + + enum Op { + None, + Insert, + Update, + Delete + }; + + enum Location { + BeforeFirst, + AfterLast + }; + + enum Confirm { + Cancel, + No, + Yes + }; + + enum ParameterType { + In, + Out, + InOut + }; + + enum TableType { + Tables, + SystemTables, + Views, + AllTables + }; + +private: + TQSql(const TQSql &); +}; diff --git a/sip/tqtsql/tqsqlcursor.sip b/sip/tqtsql/tqsqlcursor.sip new file mode 100644 index 0000000..76f258e --- /dev/null +++ b/sip/tqtsql/tqsqlcursor.sip @@ -0,0 +1,140 @@ +// This is the SIP interface definition for TQSqlCursor. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlCursor (TQt v3+)</Title> +<FuncSynopsis> + <FuncDef>virtual int <Function>del</Function></FuncDef> + <ParamDef>bool <Parameter>invalidate</Parameter> = TRUE</ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>delRecords</Literal> in Python. +</Para> + +<FuncSynopsis> + <FuncDef>virtual int <Function>del</Function></FuncDef> + <ParamDef>const TQString &<Parameter>filter</Parameter></ParamDef> + <ParamDef>bool <Parameter>invalidate</Parameter> = TRUE</ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>delRecords</Literal> in Python. +</Para> + +<FuncSynopsis> + <FuncDef>bool <Function>exec</Function></FuncDef> + <ParamDef>const TQString &<Parameter>query</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>execQuery</Literal> in Python. +</Para> +</Sect2> +%End + + +class TQSqlCursor : TQSqlRecord, TQSqlQuery +{ +%TypeHeaderCode +#include <tqsqlcursor.h> +%End + +public: + TQSqlCursor(const TQString & = TQString::null,bool = 1,TQSqlDatabase * = 0); + TQSqlCursor(const TQSqlCursor &); + + enum Mode { + ReadOnly, + Insert, + Update, + Delete, + Writable + }; + + TQVariant value(int) const; + TQVariant value(const TQString &) const; + void setValue(int,const TQVariant &); + void setValue(const TQString &,const TQVariant &); + virtual TQSqlIndex primaryIndex(bool = 1) const; + virtual TQSqlIndex index(const TQStringList &) const; + TQSqlIndex index(const TQString &) const; +// TQSqlIndex index(const char *) const; + virtual void setPrimaryIndex(const TQSqlIndex &); + + virtual void append(const TQSqlFieldInfo &); + virtual void insert(int,const TQSqlFieldInfo &); + void remove(int); + void clear(); + void setGenerated(const TQString &,bool); + void setGenerated(int,bool); + + virtual TQSqlRecord *editBuffer(bool = 0); + virtual TQSqlRecord *primeInsert(); + virtual TQSqlRecord *primeUpdate(); + virtual TQSqlRecord *primeDelete(); + virtual int insert(bool = 1) /ReleaseGIL/; + virtual int update(bool = 1) /ReleaseGIL/; + virtual int del(bool = 1) /PyName=delRecords, ReleaseGIL/; + + virtual void setMode(int); + int mode() const; + virtual void setCalculated(const TQString &,bool); + bool isCalculated(const TQString &) const; + virtual void setTrimmed(const TQString &,bool); + bool isTrimmed(const TQString &) const; + + bool isReadOnly() const; + bool canInsert() const; + bool canUpdate() const; + bool canDelete() const; + + bool select() /ReleaseGIL/; + bool select(const TQSqlIndex &) /ReleaseGIL/; + bool select(const TQSqlIndex &,const TQSqlIndex &) /ReleaseGIL/; + virtual bool select(const TQString &,const TQSqlIndex & = TQSqlIndex()) /ReleaseGIL/; + + virtual void setSort(const TQSqlIndex &); + TQSqlIndex sort() const; + virtual void setFilter(const TQString &); + TQString filter() const; + virtual void setName(const TQString &,bool = 1); + TQString name() const; + TQString toString(const TQString & = TQString::null, + const TQString & = ",") const; + + bool isNull(int) const; + bool isNull(const TQString &) const; + +protected: + void afterSeek(); + bool exec(const TQString &) /PyName=execQuery, ReleaseGIL/; + + virtual TQVariant calculateField(const TQString &); + virtual int update(const TQString &,bool = 1); + virtual int del(const TQString &,bool = 1) /PyName=delRecords, ReleaseGIL/; + + virtual TQString toString(const TQString &,TQSqlField *, + const TQString &) const; + virtual TQString toString(TQSqlRecord *,const TQString &,const TQString &, + const TQString &) const; + virtual TQString toString(const TQSqlIndex &,TQSqlRecord *, + const TQString &,const TQString &, + const TQString &) const; +}; diff --git a/sip/tqtsql/tqsqldatabase.sip b/sip/tqtsql/tqsqldatabase.sip new file mode 100644 index 0000000..cab38d2 --- /dev/null +++ b/sip/tqtsql/tqsqldatabase.sip @@ -0,0 +1,135 @@ +// This is the SIP interface definition for TQSqlDatabase. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlDatabase (TQt v3+)</Title> +<FuncSynopsis> + <FuncDef>TQSqlQuery <Function>exec</Function></FuncDef> + <ParamDef>const TQString &<Parameter>query</Parameter> = TQString::null</ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>execStatement</Literal> in Python. +</Para> +</Sect2> +%End + + +class TQSqlDatabase : TQObject +{ +%TypeHeaderCode +#include <tqsqldatabase.h> +%End + +public: +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipWrapperType **type; + int yes, no; + } graph[] = { + {sipName_TQSqlDriver, &sipClass_TQSqlDriver, -1, 1}, + {sipName_TQEditorFactory, &sipClass_TQEditorFactory, 7, 2}, + {sipName_TQSqlDatabase, &sipClass_TQSqlDatabase, -1, 3}, + {sipName_TQSqlForm, &sipClass_TQSqlForm, -1, 4}, + {sipName_TQDataView, &sipClass_TQDataView, -1, 5}, + {sipName_TQDataTable, &sipClass_TQDataTable, -1, 6}, + {sipName_TQDataBrowser, &sipClass_TQDataBrowser, -1, -1}, + {sipName_TQSqlEditorFactory, &sipClass_TQSqlEditorFactory, -1, -1}, + }; + + int i = 0; + + sipClass = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipClass = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + + bool open() /ReleaseGIL/; + bool open(const TQString &,const TQString &) /ReleaseGIL/; + void close(); + bool ping(); + bool isOpen() const; + bool isOpenError() const; + TQStringList tables() const; + TQStringList tables(TQSql::TableType) const; + TQSqlIndex primaryIndex(const TQString &) const; + TQSqlRecord record(const TQString &) const; + TQSqlRecord record(const TQSqlQuery &) const; + TQSqlRecordInfo recordInfo(const TQString &) const; + TQSqlRecordInfo recordInfo(const TQSqlQuery &) const; + TQSqlQuery exec(const TQString & = TQString::null) const /PyName=execStatement, ReleaseGIL/; + TQSqlError lastError() const; + + bool transaction(); + bool commit(); + bool rollback(); + + virtual void setDatabaseName(const TQString &); + virtual void setUserName(const TQString &); + virtual void setPassword(const TQString &); + virtual void setHostName(const TQString &); + virtual void setPort(int); + void setConnectOptions(const TQString & = TQString::null); + TQString databaseName() const; + TQString userName() const; + TQString password() const; + TQString hostName() const; + TQString driverName() const; + int port() const; + TQString connectOptions() const; + + TQSqlDriver *driver() const; + + static TQSqlDatabase *addDatabase(const TQString &, + const TQString & = TQString(TQSqlDatabase::defaultConnection)); + static TQSqlDatabase *addDatabase(TQSqlDriver *, + const TQString & = TQString(TQSqlDatabase::defaultConnection)); + static TQSqlDatabase *database(const TQString & = TQString(TQSqlDatabase::defaultConnection),bool = 1); + static void removeDatabase(const TQString &); + static void removeDatabase(TQSqlDatabase *); + static bool contains(const TQString & = TQString(TQSqlDatabase::defaultConnection)); + static TQStringList drivers(); +// static void registerSqlDriver(const TQString &, +// const TQSqlDriverCreatorBase *); + static bool isDriverAvailable(const TQString &); + +protected: + TQSqlDatabase(const TQString &,const TQString &, + TQObject * /TransferThis/ = 0,const char * = 0); + TQSqlDatabase(TQSqlDriver *,TQObject * /TransferThis/ = 0, + const char * = 0); + +private: + TQSqlDatabase(const TQSqlDatabase &); +}; diff --git a/sip/tqtsql/tqsqldriver.sip b/sip/tqtsql/tqsqldriver.sip new file mode 100644 index 0000000..74aede8 --- /dev/null +++ b/sip/tqtsql/tqsqldriver.sip @@ -0,0 +1,86 @@ +// This is the SIP interface definition for TQSqlDriver. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlDriver (TQt v3+)</Title> +<Para> +<Literal>TQSqlDriver</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlDriver : TQObject +{ +%TypeHeaderCode +#include <tqsqldriver.h> +%End + +public: + enum DriverFeature { + Transactions, + QuerySize, + BLOB, + Unicode, + PreparedQueries, + NamedPlaceholders, + PositionalPlaceholders + }; + + TQSqlDriver(TQObject * /TransferThis/ = 0,const char * = 0); + + bool isOpen() const; + bool isOpenError() const; + + virtual bool beginTransaction(); + virtual bool commitTransaction(); + virtual bool rollbackTransaction(); + virtual TQStringList tables(const TQString &) const; + virtual TQSqlIndex primaryIndex(const TQString &) const; + virtual TQSqlRecord record(const TQString &) const; + virtual TQSqlRecord record(const TQSqlQuery &) const; + virtual TQSqlRecordInfo recordInfo(const TQString &) const; + virtual TQSqlRecordInfo recordInfo(const TQSqlQuery &) const; + virtual TQString nullText() const; + virtual TQString formatValue(const TQSqlField *,bool = 0) const; + TQSqlError lastError() const; + + virtual bool hasFeature(DriverFeature) const = 0; + virtual bool open(const TQString &,const TQString & = TQString::null, + const TQString & = TQString::null, + const TQString & = TQString::null, + int = -1) = 0 /ReleaseGIL/; + virtual void close() = 0; + virtual bool ping() = 0; + virtual TQSqlQuery createQuery() const = 0; + + bool open(const TQString &,const TQString &,const TQString &, + const TQString &,int,const TQString &) /ReleaseGIL/; + +protected: + virtual void setOpen(bool); + virtual void setOpenError(bool); + virtual void setLastError(const TQSqlError &); + +private: + TQSqlDriver(const TQSqlDriver &); +}; diff --git a/sip/tqtsql/tqsqleditorfactory.sip b/sip/tqtsql/tqsqleditorfactory.sip new file mode 100644 index 0000000..cf0d361 --- /dev/null +++ b/sip/tqtsql/tqsqleditorfactory.sip @@ -0,0 +1,51 @@ +// This is the SIP interface definition for TQSqlEditorFactory. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlEditorFactory (TQt v3+)</Title> +<Para> +<Literal>TQSqlEditorFactory</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlEditorFactory : TQEditorFactory +{ +%TypeHeaderCode +#include <tqsqleditorfactory.h> +%End + +public: + TQSqlEditorFactory(TQObject * /TransferThis/ = 0,const char * = 0); + + virtual TQWidget *createEditor(TQWidget * /TransferThis/, + const TQVariant &) /Factory/; + virtual TQWidget *createEditor(TQWidget * /TransferThis/, + const TQSqlField *) /Factory/; + + static TQSqlEditorFactory *defaultFactory(); + static void installDefaultFactory(TQSqlEditorFactory * /Transfer/); + +private: + TQSqlEditorFactory(const TQSqlEditorFactory &); +}; diff --git a/sip/tqtsql/tqsqlerror.sip b/sip/tqtsql/tqsqlerror.sip new file mode 100644 index 0000000..ae9dd70 --- /dev/null +++ b/sip/tqtsql/tqsqlerror.sip @@ -0,0 +1,62 @@ +// This is the SIP interface definition for TQSqlError. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlError (TQt v3+)</Title> +<Para> +<Literal>TQSqlError</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlError +{ +%TypeHeaderCode +#include <tqsqlerror.h> +%End + +public: + enum Type { + None, + Connection, + Statement, + Transaction, + Unknown + }; + + TQSqlError(const TQString & = TQString::null, + const TQString & = TQString::null,int = TQSqlError::None, + int = -1); + TQSqlError(const TQSqlError &); + + TQString driverText() const; + virtual void setDriverText(const TQString &); + TQString databaseText() const; + virtual void setDatabaseText(const TQString &); + int type() const; + virtual void setType(int); + int number() const; + virtual void setNumber(int); + TQString text() const; + void showMessage(const TQString & = TQString::null) const; +}; diff --git a/sip/tqtsql/tqsqlfield.sip b/sip/tqtsql/tqsqlfield.sip new file mode 100644 index 0000000..c54e0f5 --- /dev/null +++ b/sip/tqtsql/tqsqlfield.sip @@ -0,0 +1,91 @@ +// This is the SIP interface definition for TQSqlField and TQSqlFieldInfo. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlField (TQt v3+)</Title> +<Para> +<Literal>TQSqlField</Literal> is fully implemented. +</Para> +</Sect2> + +<Sect2><Title>TQSqlFieldInfo (TQt v3+)</Title> +<Para> +<Literal>TQSqlFieldInfo</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlField +{ +%TypeHeaderCode +#include <tqsqlfield.h> +%End + +public: + TQSqlField(const TQString & = TQString::null, + TQVariant::Type = TQVariant::Invalid ); + TQSqlField(const TQSqlField &); + + virtual void setValue(const TQVariant &); + virtual TQVariant value() const; + virtual void setName(const TQString &); + TQString name() const; + virtual void setNull(); + bool isNull() const; + virtual void setReadOnly(bool); + bool isReadOnly() const; + void clear(bool = 1); + TQVariant::Type type() const; +}; + + +class TQSqlFieldInfo +{ +%TypeHeaderCode +#include <tqsqlfield.h> +%End + +public: + TQSqlFieldInfo(const TQString & = TQString::null, + TQVariant::Type = TQVariant::Invalid,int = -1,int = -1, + int = -1,const TQVariant & = TQVariant(),int = 0,bool = 1, + bool = 0,bool = 0); + TQSqlFieldInfo(const TQSqlFieldInfo &); + TQSqlFieldInfo(const TQSqlField &,bool = 1); + + TQSqlField toField() const; + int isRequired() const; + TQVariant::Type type() const; + int length() const; + int precision() const; + TQVariant defaultValue() const; + TQString name() const; + int typeID() const; + bool isGenerated() const; + bool isTrim() const; + bool isCalculated() const; + + virtual void setTrim(bool); + virtual void setGenerated(bool); + virtual void setCalculated(bool); +}; diff --git a/sip/tqtsql/tqsqlform.sip b/sip/tqtsql/tqsqlform.sip new file mode 100644 index 0000000..9a03610 --- /dev/null +++ b/sip/tqtsql/tqsqlform.sip @@ -0,0 +1,68 @@ +// This is the SIP interface definition for TQSqlForm. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlForm (TQt v3+)</Title> +<Para> +<Literal>TQSqlForm</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlForm : TQObject +{ +%TypeHeaderCode +#include <tqsqlform.h> +%End + +public: + TQSqlForm(TQObject * /TransferThis/ = 0,const char * = 0); + + virtual void insert(TQWidget *,const TQString &); + virtual void remove(const TQString &); + uint count() const; + + TQWidget *widget(uint) const; + TQSqlField *widgetToField(TQWidget *) const; + TQWidget *fieldToWidget(TQSqlField *) const; + + void installPropertyMap(TQSqlPropertyMap * /Transfer/); + + virtual void setRecord(TQSqlRecord *); + +public slots: + virtual void readField(TQWidget *); + virtual void writeField(TQWidget *); + virtual void readFields(); + virtual void writeFields(); + + virtual void clear(); + virtual void clearValues(bool = 0); + +protected: + virtual void insert(TQWidget *,TQSqlField *); + virtual void remove(TQWidget *); + +private: + TQSqlForm(const TQSqlForm &); +}; diff --git a/sip/tqtsql/tqsqlindex.sip b/sip/tqtsql/tqsqlindex.sip new file mode 100644 index 0000000..5e6db25 --- /dev/null +++ b/sip/tqtsql/tqsqlindex.sip @@ -0,0 +1,60 @@ +// This is the SIP interface definition for TQSqlIndex. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlIndex (TQt v3+)</Title> +<Para> +<Literal>TQSqlIndex</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlIndex : TQSqlRecord +{ +%TypeHeaderCode +#include <tqsqlindex.h> +%End + +public: + TQSqlIndex(const TQString & = TQString::null, + const TQString & = TQString::null); + TQSqlIndex(const TQSqlIndex &); + + virtual void setCursorName(const TQString &); + TQString cursorName() const; + virtual void setName(const TQString &); + TQString name() const; + + void append(const TQSqlField &); + virtual void append(const TQSqlField &,bool); + + bool isDescending(int) const; + virtual void setDescending(int,bool); + + TQString toString(const TQString & = TQString::null,const TQString & = ",", + bool = 1) const; + TQStringList toStringList(const TQString & = TQString::null, + bool = 1) const; + + static TQSqlIndex fromStringList(const TQStringList &,const TQSqlCursor *); +}; diff --git a/sip/tqtsql/tqsqlpropertymap.sip b/sip/tqtsql/tqsqlpropertymap.sip new file mode 100644 index 0000000..9e7b9ea --- /dev/null +++ b/sip/tqtsql/tqsqlpropertymap.sip @@ -0,0 +1,59 @@ +// This is the SIP interface definition for TQSqlPropertyMap. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlPropertyMap (TQt v3+)</Title> +<Para> +<Literal>TQSqlPropertyMap</Literal> is fully implemented. However, because PyTQt +does not allow new properties to be defined, it is not possible to implement +custom editor widgets in Python and add them to a property map. These will +simply be ignored. +</Para> + +<Para> +This problem may be addressed in a future release of PyTQt. +</Para> +</Sect2> +%End + + +class TQSqlPropertyMap +{ +%TypeHeaderCode +#include <tqsqlpropertymap.h> +%End + +public: + TQSqlPropertyMap(); + + TQVariant property(TQWidget *); + virtual void setProperty(TQWidget *,const TQVariant &); + + void insert(const TQString &,const TQString &); + void remove(const TQString &); + + static TQSqlPropertyMap *defaultMap(); + static void installDefaultMap(TQSqlPropertyMap * /Transfer/); + +private: + TQSqlPropertyMap(const TQSqlPropertyMap &); +}; diff --git a/sip/tqtsql/tqsqlquery.sip b/sip/tqtsql/tqsqlquery.sip new file mode 100644 index 0000000..8212391 --- /dev/null +++ b/sip/tqtsql/tqsqlquery.sip @@ -0,0 +1,103 @@ +// This is the SIP interface definition for TQSqlQuery. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlQuery (TQt v3+)</Title> +<FuncSynopsis> + <FuncDef>TQMap<TQString,TQVariant> <Function>boundValues</Function> const</FuncDef> + <ParamDef></ParamDef> +</FuncSynopsis> +<Para> +Not yet implemented. (TQt v3.2.0+) +</Para> + +<FuncSynopsis> + <FuncDef>virtual bool <Function>exec</Function></FuncDef> + <ParamDef>const TQString &<Parameter>query</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>execQuery</Literal> in Python. +</Para> + +<FuncSynopsis> + <FuncDef>bool <Function>exec</Function></FuncDef> + <ParamDef></ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>execQuery</Literal> in Python. (TQt v3.1+) +</Para> +</Sect2> +%End + + +class TQSqlQuery +{ +%TypeHeaderCode +#include <tqsqlquery.h> +%End + +public: + TQSqlQuery(TQSqlResult *); + TQSqlQuery(const TQString & = TQString::null,TQSqlDatabase * = 0); + TQSqlQuery(TQSqlDatabase *); + TQSqlQuery(const TQSqlQuery &); + + bool isValid() const; + bool isActive() const; + bool isNull(int) const; + int at() const; + TQString lastQuery() const; + int numRowsAffected() const; + TQSqlError lastError() const; + bool isSelect() const; + int size() const; + const TQSqlDriver *driver() const; + const TQSqlResult *result() const; + bool isForwardOnly() const; + void setForwardOnly(bool); + + virtual bool exec(const TQString &) /PyName=execQuery, ReleaseGIL/; + virtual TQVariant value(int) const; + + virtual bool seek(int,bool = 0) /ReleaseGIL/; + virtual bool next() /ReleaseGIL/; + virtual bool prev() /ReleaseGIL/; + virtual bool first() /ReleaseGIL/; + virtual bool last() /ReleaseGIL/; + + bool exec() /PyName=execQuery, ReleaseGIL/; + bool prepare(const TQString &); + void bindValue(const TQString &,const TQVariant &); + void bindValue(int,const TQVariant &); + void addBindValue(const TQVariant &); + void bindValue(const TQString &,const TQVariant &,TQSql::ParameterType); + void bindValue(int,const TQVariant &,TQSql::ParameterType); + void addBindValue(const TQVariant &,TQSql::ParameterType); + TQVariant boundValue(const TQString &) const; + TQVariant boundValue(int) const; +// TQMap<TQString,TQVariant> boundValues() const; + TQString executedQuery() const; + +protected: + virtual void beforeSeek(); + virtual void afterSeek(); +}; diff --git a/sip/tqtsql/tqsqlrecord.sip b/sip/tqtsql/tqsqlrecord.sip new file mode 100644 index 0000000..4e79fac --- /dev/null +++ b/sip/tqtsql/tqsqlrecord.sip @@ -0,0 +1,171 @@ +// This is the SIP interface definition for TQSqlRecord and TQSqlRecordInfo. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlRecord (TQt v3+)</Title> +<Para> +<Literal>TQSqlRecord</Literal> is fully implemented. +</Para> +</Sect2> + +<Sect2><Title>TQSqlRecordInfo (TQt v3+)</Title> +<Para> +<Literal>TQSqlRecordInfo</Literal> is implemented as a Python list of +<Literal>TQSqlFieldInfo</Literal> instances. +</Para> +</Sect2> +%End + + +class TQSqlRecord +{ +%TypeHeaderCode +#include <tqsqlrecord.h> +%End + +public: + TQSqlRecord(); + TQSqlRecord(const TQSqlRecord &); + + virtual TQVariant value(int) const; + virtual TQVariant value(const TQString &) const; + virtual void setValue(int,const TQVariant &); + virtual void setValue(const TQString &,const TQVariant &); + bool isGenerated(int) const; + bool isGenerated(const TQString &) const; + virtual void setGenerated(const TQString &,bool); + virtual void setGenerated(int,bool); + virtual void setNull(int); + virtual void setNull(const TQString &); + bool isNull(int); + bool isNull(const TQString &); +// bool isNull(int) const; +// bool isNull(const TQString &) const; + + int position(const TQString &) const; + TQString fieldName(int) const; + TQSqlField *field(int); + TQSqlField *field(const TQString &); +// const TQSqlField *field(int) const; +// const TQSqlField *field(const TQString &) const; + + virtual void append(const TQSqlField &); + virtual void insert(int,const TQSqlField &); + virtual void remove(int); + + bool isEmpty() const; + bool contains(const TQString &) const; + virtual void clear(); + virtual void clearValues(bool = 0); + uint count() const; + virtual TQString toString(const TQString & = TQString::null, + const TQString & = ",") const; + virtual TQStringList toStringList(const TQString & = TQString::null) const; +}; + + +%MappedType TQSqlRecordInfo +{ +%TypeHeaderCode +#include <tqsqlrecord.h> +%End + +%ConvertFromTypeCode + // Convert to a Python list of TQSqlFieldInfo instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + TQValueListConstIterator<TQSqlFieldInfo> it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new TQSqlFieldInfo(*it),sipClass_TQSqlFieldInfo,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + + +%ConvertToTypeCode + // Convert a Python list of TQSqlFieldInfo instances to a TQSqlRecordInfo + // on the heap. + + if (sipIsErr == NULL) + { + if (!PyList_Check(sipPy)) + return 0; + + for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) + if (!sipCanConvertToInstance(PyList_GET_ITEM(sipPy,i),sipClass_TQSqlFieldInfo,SIP_NOT_NONE)) + return 0; + + return 1; + } + + TQSqlRecordInfo *qri = new TQSqlRecordInfo; + + for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) + { + int iserr = 0, state; + + // We apply the transfer to the list itself, not the elements. + TQSqlFieldInfo *itm = reinterpret_cast<TQSqlFieldInfo *>(sipConvertToInstance(PyList_GET_ITEM(sipPy,i),sipClass_TQSqlFieldInfo,0,SIP_NOT_NONE,&state,&iserr)); + + if (iserr) + { + sipReleaseInstance(itm,sipClass_TQSqlFieldInfo,state); + + *sipIsErr = 1; + delete qri; + + return 0; + } + + qri -> append(*itm); + + sipReleaseInstance(itm,sipClass_TQSqlFieldInfo,state); + } + + *sipCppPtr = qri; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/tqtsql/tqsqlresult.sip b/sip/tqtsql/tqsqlresult.sip new file mode 100644 index 0000000..144f355 --- /dev/null +++ b/sip/tqtsql/tqsqlresult.sip @@ -0,0 +1,69 @@ +// This is the SIP interface definition for TQSqlResult. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlResult (TQt v3+)</Title> +<Para> +<Literal>TQSqlResult</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQSqlResult +{ +%TypeHeaderCode +#include <tqsqlresult.h> +%End + +protected: + TQSqlResult(const TQSqlDriver *); + + int at() const; + TQString lastQuery() const; + TQSqlError lastError() const; + bool isValid() const; + bool isActive() const; + bool isSelect() const; + bool isForwardOnly() const; + const TQSqlDriver *driver() const; + virtual void setAt(int); + virtual void setActive(bool); + virtual void setLastError(const TQSqlError &); + virtual void setQuery(const TQString &); + virtual void setSelect(bool); + virtual void setForwardOnly(bool); + + virtual TQVariant data(int) = 0; + virtual bool isNull(int) = 0; + virtual bool reset(const TQString &) = 0; + virtual bool fetch(int) = 0; + virtual bool fetchNext(); + virtual bool fetchPrev(); + virtual bool fetchFirst() = 0; + virtual bool fetchLast() = 0; + virtual int size() = 0; + virtual int numRowsAffected() = 0; + +private: + TQSqlResult(const TQSqlResult &); +}; diff --git a/sip/tqtsql/tqsqlselectcursor.sip b/sip/tqtsql/tqsqlselectcursor.sip new file mode 100644 index 0000000..a33fee3 --- /dev/null +++ b/sip/tqtsql/tqsqlselectcursor.sip @@ -0,0 +1,88 @@ +// This is the SIP interface definition for TQSqlSelectCursor. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSqlSelectCursor (TQt v3.2.0+)</Title> +<FuncSynopsis> + <FuncDef>int <Function>del</Function></FuncDef> + <ParamDef>bool <Parameter>invalidate</Parameter> = TRUE</ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>delRecords</Literal> in Python. +</Para> + +<FuncSynopsis> + <FuncDef>bool <Function>exec</Function></FuncDef> + <ParamDef>const TQString &<Parameter>query</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This has been renamed <Literal>execQuery</Literal> in Python. +</Para> +</Sect2> +%End + + +class TQSqlSelectCursor : TQSqlCursor +{ +%TypeHeaderCode +#include <tqsqlselectcursor.h> +%End + +public: + TQSqlSelectCursor(const TQString & = TQString::null,TQSqlDatabase * = 0); + TQSqlSelectCursor(const TQSqlSelectCursor &); + ~TQSqlSelectCursor(); + + bool exec(const TQString &) /PyName=execQuery, ReleaseGIL/; + bool select() /ReleaseGIL/; + +protected: + TQSqlIndex primaryIndex(bool = 1) const; + TQSqlIndex index(const TQStringList &) const; + TQSqlIndex index(const TQString &) const; +// TQSqlIndex index(const char *) const; + void setPrimaryIndex(const TQSqlIndex &); + void append(const TQSqlFieldInfo &); + void insert(int,const TQSqlFieldInfo &); + void remove(int); + void clear(); + void setGenerated(const TQString &,bool); + void setGenerated(int,bool); + TQSqlRecord *editBuffer(bool = 0); + TQSqlRecord *primeInsert(); + TQSqlRecord *primeUpdate(); + TQSqlRecord *primeDelete(); + int insert(bool = 1) /ReleaseGIL/; + int update(bool = 1) /ReleaseGIL/; + int del(bool = 1) /PyName=delRecords, ReleaseGIL/; + void setMode(int); + + void setSort(const TQSqlIndex &); + TQSqlIndex sort() const; + void setFilter(const TQString &); + TQString filter() const; + void setName(const TQString &,bool = 1); + TQString name() const; + TQString toString(const TQString & = TQString::null, + const TQString & = ",") const; + bool select(const TQString &,const TQSqlIndex & = TQSqlIndex()) /ReleaseGIL/; +}; diff --git a/sip/tqtsql/tqtsqlmod.sip b/sip/tqtsql/tqtsqlmod.sip new file mode 100644 index 0000000..10be45e --- /dev/null +++ b/sip/tqtsql/tqtsqlmod.sip @@ -0,0 +1,88 @@ +// This is the SIP interface definition for the tqtsql module of PyTQt. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%Module PyTQt.tqtsql 1 + +%Import tqt/tqtmod.sip +%Import tqttable/tqttablemod.sip + +%Include copying.sip + + +%Include tqdatabrowser.sip +%Include tqdatatable.sip +%Include tqdataview.sip +%Include tqeditorfactory.sip +%Include tqsql.sip +%Include tqsqlcursor.sip +%Include tqsqldatabase.sip +%Include tqsqldriver.sip +%Include tqsqleditorfactory.sip +%Include tqsqlerror.sip +%Include tqsqlfield.sip +%Include tqsqlform.sip +%Include tqsqlindex.sip +%Include tqsqlpropertymap.sip +%Include tqsqlquery.sip +%Include tqsqlrecord.sip +%Include tqsqlresult.sip +%Include tqsqlselectcursor.sip + + +// The build file template. + +%Makefile tqtsql.pro.in +# The project file for the tqtsql module. +# +# Copyright (c) 2007 +# Riverbank Computing Limited <info@riverbankcomputing.co.uk> +# +# This file is part of PyTQt. +# +# This copy of PyTQt is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. +# +# PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +TEMPLATE = lib +TARGET = @BLX_TARGET_LIB@ +DESTDIR = @PYTQT_MODDIR@ +CONFIG += @BLX_CONFIG_LIB@ @PYTQT_WARN@ +INCLUDEPATH = @BLX_INCLUDEPATH@ +DEFINES = @BLX_DEFINES@ +LIBS += @PYTQT_TQTTABLE_MODULE@ @BLX_LIBS@ +macx:QMAKE_LFLAGS += -framework Python + +SOURCES = $B + +HEADERS = $H +%End |