diff options
Diffstat (limited to 'doc/html/sqltable-example.html')
-rw-r--r-- | doc/html/sqltable-example.html | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/doc/html/sqltable-example.html b/doc/html/sqltable-example.html index d84b9fe30..f64e0b984 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="ntqdatatable.html">TQDataTable</a> to browse data in a SQL database. +This example shows how to use a <a href="tqdatatable.html">TQDataTable</a> to browse data in a SQL database. <p> <hr> <p> Implementation: <p> <pre>/**************************************************************************** @@ -46,9 +46,9 @@ This example shows how to use a <a href="ntqdatatable.html">TQDataTable</a> to b *****************************************************************************/ #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="tqsqldatabase-h.html">tqsqldatabase.h</a>> +#include <<a href="tqdatatable-h.html">tqdatatable.h</a>> +#include <<a href="tqsqlcursor-h.html">tqsqlcursor.h</a>> #include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> /* Modify the following to match your environment */ @@ -58,18 +58,18 @@ This example shows how to use a <a href="ntqdatatable.html">TQDataTable</a> to b #define PASSWORD "" /* password for USER */ #define HOST "" /* host on which the database is running */ -class SimpleCursor : public <a href="ntqsqlcursor.html">TQSqlCursor</a> +class SimpleCursor : public <a href="tqsqlcursor.html">TQSqlCursor</a> { public: - SimpleCursor () : <a href="ntqsqlcursor.html">TQSqlCursor</a>( "simpletable" ) {} + SimpleCursor () : <a href="tqsqlcursor.html">TQSqlCursor</a>( "simpletable" ) {} protected: - <a href="ntqsqlrecord.html">TQSqlRecord</a>* primeInsert() + <a href="tqsqlrecord.html">TQSqlRecord</a>* primeInsert() { /* a real-world application would use sequences, or the like */ -<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) ); +<a name="x2453"></a> <a href="tqsqlrecord.html">TQSqlRecord</a>* buf = TQSqlCursor::<a href="tqsqlcursor.html#primeInsert">primeInsert</a>(); + <a href="tqsqlquery.html">TQSqlQuery</a> q( "select max(id)+1 from simpletable" ); + if ( q.<a href="tqsqlquery.html#next">next</a>() ) +<a name="x2464"></a> buf-><a href="tqsqlrecord.html#setValue">setValue</a>( "id", q.<a href="tqsqlquery.html#value">value</a>(0) ); return buf; } }; @@ -78,31 +78,31 @@ int main( int argc, char ** argv ) { <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); -<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="x2454"></a> <a href="tqsqldatabase.html">TQSqlDatabase</a> * db = TQSqlDatabase::<a href="tqsqldatabase.html#addDatabase">addDatabase</a>( DRIVER ); +<a name="x2457"></a> db-><a href="tqsqldatabase.html#setDatabaseName">setDatabaseName</a>( DATABASE ); +<a name="x2460"></a> db-><a href="tqsqldatabase.html#setUserName">setUserName</a>( USER ); +<a name="x2459"></a> db-><a href="tqsqldatabase.html#setPassword">setPassword</a>( PASSWORD ); +<a name="x2458"></a> db-><a href="tqsqldatabase.html#setHostName">setHostName</a>( HOST ); -<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" +<a name="x2456"></a> if( !db-><a href="tqsqldatabase.html#open">open</a>() ){ +<a name="x2455"></a> db-><a href="tqsqldatabase.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="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); +<a name="x2461"></a> if (!db-><a href="tqsqldatabase.html#tables">tables</a>().contains("simpletable")) { + <a href="tqsqlquery.html">TQSqlQuery</a> q("create table simpletable(id int, name varchar(20), address varchar(20))", db); } SimpleCursor cursor; - <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 href="tqdatatable.html">TQDataTable</a> table( &cursor ); /* data table uses our cursor */ +<a name="x2451"></a> table.<a href="tqdatatable.html#addColumn">addColumn</a>( "name", "Name" ); + table.<a href="tqdatatable.html#addColumn">addColumn</a>( "address", "Address" ); <a name="x2465"></a> table.<a href="ntqtable.html#setSorting">setSorting</a>( TRUE ); a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &table ); -<a name="x2452"></a> table.<a href="ntqdatatable.html#refresh">refresh</a>(); /* load data */ +<a name="x2452"></a> table.<a href="tqdatatable.html#refresh">refresh</a>(); /* load data */ table.<a href="ntqwidget.html#show">show</a>(); /* show widget */ return a.<a href="ntqapplication.html#exec">exec</a>(); |