diff options
Diffstat (limited to 'doc/html/sqltable-example.html')
-rw-r--r-- | doc/html/sqltable-example.html | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/doc/html/sqltable-example.html b/doc/html/sqltable-example.html index 858319725..d84b9fe30 100644 --- a/doc/html/sqltable-example.html +++ b/doc/html/sqltable-example.html @@ -33,7 +33,7 @@ body { background: #ffffff; color: black; } <p> -This example shows how to use a <a href="qdatatable.html">TQDataTable</a> to browse data in a SQL database. +This example shows how to use a <a href="ntqdatatable.html">TQDataTable</a> to browse data in a SQL database. <p> <hr> <p> Implementation: <p> <pre>/**************************************************************************** @@ -45,11 +45,11 @@ This example shows how to use a <a href="qdatatable.html">TQDataTable</a> to bro ** *****************************************************************************/ -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qsqldatabase-h.html">qsqldatabase.h</a>> -#include <<a href="qdatatable-h.html">qdatatable.h</a>> -#include <<a href="qsqlcursor-h.html">qsqlcursor.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qsqldatabase-h.html">ntqsqldatabase.h</a>> +#include <<a href="qdatatable-h.html">ntqdatatable.h</a>> +#include <<a href="qsqlcursor-h.html">ntqsqlcursor.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> /* Modify the following to match your environment */ #define DRIVER "TQSQLITE" /* see the TQt SQL documentation for a list of available drivers */ @@ -58,54 +58,54 @@ This example shows how to use a <a href="qdatatable.html">TQDataTable</a> to bro #define PASSWORD "" /* password for USER */ #define HOST "" /* host on which the database is running */ -class SimpleCursor : public <a href="qsqlcursor.html">TQSqlCursor</a> +class SimpleCursor : public <a href="ntqsqlcursor.html">TQSqlCursor</a> { public: - SimpleCursor () : <a href="qsqlcursor.html">TQSqlCursor</a>( "simpletable" ) {} + SimpleCursor () : <a href="ntqsqlcursor.html">TQSqlCursor</a>( "simpletable" ) {} protected: - <a href="qsqlrecord.html">TQSqlRecord</a>* primeInsert() + <a href="ntqsqlrecord.html">TQSqlRecord</a>* primeInsert() { /* a real-world application would use sequences, or the like */ -<a name="x2453"></a> <a href="qsqlrecord.html">TQSqlRecord</a>* buf = TQSqlCursor::<a href="qsqlcursor.html#primeInsert">primeInsert</a>(); - <a href="qsqlquery.html">TQSqlQuery</a> q( "select max(id)+1 from simpletable" ); - if ( q.<a href="qsqlquery.html#next">next</a>() ) -<a name="x2464"></a> buf-><a href="qsqlrecord.html#setValue">setValue</a>( "id", q.<a href="qsqlquery.html#value">value</a>(0) ); +<a name="x2453"></a> <a href="ntqsqlrecord.html">TQSqlRecord</a>* buf = TQSqlCursor::<a href="ntqsqlcursor.html#primeInsert">primeInsert</a>(); + <a href="ntqsqlquery.html">TQSqlQuery</a> q( "select max(id)+1 from simpletable" ); + if ( q.<a href="ntqsqlquery.html#next">next</a>() ) +<a name="x2464"></a> buf-><a href="ntqsqlrecord.html#setValue">setValue</a>( "id", q.<a href="ntqsqlquery.html#value">value</a>(0) ); return buf; } }; int main( int argc, char ** argv ) { - <a href="qapplication.html">TQApplication</a> a( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); -<a name="x2454"></a> <a href="qsqldatabase.html">TQSqlDatabase</a> * db = TQSqlDatabase::<a href="qsqldatabase.html#addDatabase">addDatabase</a>( DRIVER ); -<a name="x2457"></a> db-><a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>( DATABASE ); -<a name="x2460"></a> db-><a href="qsqldatabase.html#setUserName">setUserName</a>( USER ); -<a name="x2459"></a> db-><a href="qsqldatabase.html#setPassword">setPassword</a>( PASSWORD ); -<a name="x2458"></a> db-><a href="qsqldatabase.html#setHostName">setHostName</a>( HOST ); +<a name="x2454"></a> <a href="ntqsqldatabase.html">TQSqlDatabase</a> * db = TQSqlDatabase::<a href="ntqsqldatabase.html#addDatabase">addDatabase</a>( DRIVER ); +<a name="x2457"></a> db-><a href="ntqsqldatabase.html#setDatabaseName">setDatabaseName</a>( DATABASE ); +<a name="x2460"></a> db-><a href="ntqsqldatabase.html#setUserName">setUserName</a>( USER ); +<a name="x2459"></a> db-><a href="ntqsqldatabase.html#setPassword">setPassword</a>( PASSWORD ); +<a name="x2458"></a> db-><a href="ntqsqldatabase.html#setHostName">setHostName</a>( HOST ); -<a name="x2456"></a> if( !db-><a href="qsqldatabase.html#open">open</a>() ){ -<a name="x2455"></a> db-><a href="qsqldatabase.html#lastError">lastError</a>().showMessage( "An error occured. Please read the README file in the sqltable" +<a name="x2456"></a> if( !db-><a href="ntqsqldatabase.html#open">open</a>() ){ +<a name="x2455"></a> db-><a href="ntqsqldatabase.html#lastError">lastError</a>().showMessage( "An error occured. Please read the README file in the sqltable" "dir for more information.\n\n" ); return 1; } -<a name="x2461"></a> if (!db-><a href="qsqldatabase.html#tables">tables</a>().contains("simpletable")) { - <a href="qsqlquery.html">TQSqlQuery</a> q("create table simpletable(id int, name varchar(20), address varchar(20))", db); +<a name="x2461"></a> if (!db-><a href="ntqsqldatabase.html#tables">tables</a>().contains("simpletable")) { + <a href="ntqsqlquery.html">TQSqlQuery</a> q("create table simpletable(id int, name varchar(20), address varchar(20))", db); } SimpleCursor cursor; - <a href="qdatatable.html">TQDataTable</a> table( &cursor ); /* data table uses our cursor */ -<a name="x2451"></a> table.<a href="qdatatable.html#addColumn">addColumn</a>( "name", "Name" ); - table.<a href="qdatatable.html#addColumn">addColumn</a>( "address", "Address" ); -<a name="x2465"></a> table.<a href="qtable.html#setSorting">setSorting</a>( TRUE ); + <a href="ntqdatatable.html">TQDataTable</a> table( &cursor ); /* data table uses our cursor */ +<a name="x2451"></a> table.<a href="ntqdatatable.html#addColumn">addColumn</a>( "name", "Name" ); + table.<a href="ntqdatatable.html#addColumn">addColumn</a>( "address", "Address" ); +<a name="x2465"></a> table.<a href="ntqtable.html#setSorting">setSorting</a>( TRUE ); - a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &table ); -<a name="x2452"></a> table.<a href="qdatatable.html#refresh">refresh</a>(); /* load data */ - table.<a href="qwidget.html#show">show</a>(); /* show widget */ + a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &table ); +<a name="x2452"></a> table.<a href="ntqdatatable.html#refresh">refresh</a>(); /* load data */ + table.<a href="ntqwidget.html#show">show</a>(); /* show widget */ - return a.<a href="qapplication.html#exec">exec</a>(); + return a.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |