1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/**************************************************
*
*
**************************************************
* This code was created by Peter Harvey @ CodeByDesign.
* Released under GPL 18.FEB.99
*
* Contributions from...
* -----------------------------------------------
* Peter Harvey - pharvey@codebydesign.com
**************************************************/
#include "classODBC.h"
#include "odbc.xpm"
classODBC::classODBC( QListView *pParent, classCanvas *pCanvas )
: classNode( pParent, pCanvas )
{
Init();
}
classODBC::classODBC( QListViewItem *pParent, classCanvas *pCanvas )
: classNode( pParent, pCanvas )
{
Init();
}
classODBC::~classODBC()
{
if (( void * ) hEnv != 0 )
{
SQLFreeEnv( hEnv );
}
}
void classODBC::Init()
{
hEnv = 0;
this->pCanvas = pCanvas;
pDrivers = 0;
pDataSourcesUser = 0;
pDataSourcesSystem = 0;
setPixmap( 0, QPixmap(odbc_xpm) );
setText( 0, "ODBC" );
setText( 1, "" );
setText( 2, "Open Database Connectivity" );
}
void classODBC::setOpen( bool o )
{
if ( o && !childCount() )
{
// CREATE AN ODBC ENVIRONMENT
if ( SQLAllocEnv( &hEnv ) != SQL_SUCCESS )
{
QMessageBox::critical( pCanvas, "Data Manager", "Call to the ODBC Driver Manager failed" );
return;
}
// ADD CHILD NODES; only classODBC knows what they may be
pDrivers = new classDrivers( this, pCanvas, hEnv );
pDataSourcesSystem = new classDataSources( this, pDrivers, pCanvas, classDataSources::System, hEnv );
pDataSourcesUser = new classDataSources( this, pDataSourcesSystem, pCanvas, classDataSources::User, hEnv );
}
QListViewItem::setOpen( o );
}
void classODBC::setup()
{
setExpandable( TRUE );
QListViewItem::setup();
}
void classODBC::selectionChanged( QListViewItem *p )
{
if ( pDrivers ) pDrivers->selectionChanged( p );
if ( pDataSourcesUser ) pDataSourcesUser->selectionChanged( p );
if ( pDataSourcesSystem ) pDataSourcesSystem->selectionChanged( p );
if ( p == this )
{
}
}
|