Q3SqlSelectCursor Class

The Q3SqlSelectCursor class provides browsing of general SQL SELECT statements. 更多...

头: #include <Q3SqlSelectCursor>
继承: Q3SqlCursor

公共函数

Q3SqlSelectCursor (const QString & query = QString(), QSqlDatabase db = QSqlDatabase())
Q3SqlSelectCursor (const Q3SqlSelectCursor & other )
~Q3SqlSelectCursor ()

重实现保护函数

virtual int update (const QString & filter , bool invalidate = true)

详细描述

The Q3SqlSelectCursor class provides browsing of general SQL SELECT statements.

Q3SqlSelectCursor is a convenience class that makes it possible to display result sets from general SQL SELECT statements in data-aware Qt widgets. Q3SqlSelectCursor is read-only and does not support INSERT , UPDATE or DELETE operations.

Pass the query in at construction time, or use the Q3SqlSelectCursor::exec () 函数。

范例:

...
Q3SqlSelectCursor* cur = new Q3SqlSelectCursor("SELECT id, firstname, lastname FROM author");
Q3DataTable* table = new Q3DataTable(this);
table->setSqlCursor(cur, true, true);
table->refresh();
...
cur->exec("SELECT * FROM books");
table->refresh();
...
					

成员函数文档编制

Q3SqlSelectCursor:: Q3SqlSelectCursor (const QString & query = QString(), QSqlDatabase db = QSqlDatabase())

Constructs a read only cursor on database db using the query query .

Q3SqlSelectCursor:: Q3SqlSelectCursor (const Q3SqlSelectCursor & other )

构造副本为 other

Q3SqlSelectCursor:: ~Q3SqlSelectCursor ()

Destroys the object and frees any allocated resources

[virtual protected] int Q3SqlSelectCursor:: update (const QString & filter , bool invalidate = true)

重实现自 Q3SqlCursor::update ().

这是重载函数。

Updates the database with the current contents of the cursor edit buffer using the specified filter . Returns the number of records which were updated. For error information, use lastError ().

Only records which meet the filter criteria are updated, otherwise all records in the table are updated.

invalidate is true (the default), the cursor can no longer be navigated. A new select() call must be made before you can move to a valid record.

另请参阅 Q3SqlCursor::update (), primeUpdate (), setMode (),和 lastError ().