File: main.cpp

package info (click to toggle)
unixodbc 2.2.14p2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 14,628 kB
  • ctags: 12,533
  • sloc: ansic: 104,243; cpp: 38,571; sh: 15,958; makefile: 2,727; sql: 1
file content (58 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (2)
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
/**************************************************
 *
 *
 **************************************************
 * This code was created by Peter Harvey @ CodeByDesign.
 * Released under GPL 31.JAN.99
 *
 * Contributions from...
 * -----------------------------------------------
 * Peter Harvey		- pharvey@codebydesign.com
 **************************************************/

#include <odbcinst.h>
#include <odbcinstext.h>

#ifdef QT_V4LAYOUT
#include <Qt/qapplication.h>
#include <Qt/qmessagebox.h>
#else
#include <qapp.h>
#include <qmessagebox.h>
#endif

int main( int argc, char **argv )
{
    QApplication::setDesktopSettingsAware( true );             // try to use desktop colors

    QApplication    oApplication( argc, argv );
    int             nReturn;
    ODBCINSTWND     odbcinstwnd;

#ifdef QT_V4LAYOUT
	strcpy( odbcinstwnd.szUI, "odbcinstQ4" );
#else
	strcpy( odbcinstwnd.szUI, "odbcinstQ" );
#endif
    odbcinstwnd.hWnd = qApp->desktop();

    nReturn = SQLManageDataSources( (HWND)(&odbcinstwnd) );
    if ( !nReturn )
    {
        for ( WORD nError = 1; nError < 10; nError++ )
        {
            DWORD   nErrorCode;
            char    szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
            RETCODE nRetCode = SQLInstallerError( nError, &nErrorCode, szErrorMsg, SQL_MAX_MESSAGE_LENGTH, NULL );
            if ( !SQL_SUCCEEDED( nRetCode ) )
            {
                QMessageBox::critical( 0, "ODBCConfig",  "failed: no more errors to report" );
                break;
            }
            QMessageBox::critical( 0, "ODBCConfig",  szErrorMsg );
        }
    }

    return nReturn;
}