Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-706

Can't support SQLConfigDataSource(ODBC_ADD_DSN)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: ODBC-9.2.0.0001
    • Fix Version/s: None
    • Component/s: ODBC
    • Labels:
      None

      Description

      When user call

      {code}
      SQLConfigDataSource(NULL, ODBC_ADD_DSN,...{code}

      1 Driver should not pop a dialog
      2 add dsn failed

      1. apis-706.creview
        7 kB
        唐勤
      2. apis-706.creview
        4 kB
        唐勤
      3. CODE_REVIEW.creview
        4 kB
        唐勤

        Activity

        Hide
        cn15800 谢韦华[Bert] added a comment -

        Driver should not pop dialg When app call SQLConfigDataSource(ODBC_ADD_DSN).

        Show
        cn15800 谢韦华[Bert] added a comment - Driver should not pop dialg When app call SQLConfigDataSource(ODBC_ADD_DSN).
        Hide
        cn15800 谢韦华[Bert] added a comment -

        Test Code:

        {code}
        int main()
        {
        wchar_t* szODBCAttributes = (wchar_t*)malloc(1024);
        int wODBCStringLen = _stprintf( szODBCAttributes, _T("DSN=New2;"), "New", _T(';') );
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("uid=accountid%c"), _T(';') );
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("pwd=password%c"), _T(';'));
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("fetch_size=100%c"), _T(';'));
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("port=33000%c"), _T(';'));
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("server=127.0.0.1%c"), _T(';'));
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("db_name=testdb%c"), _T(';'));
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("DESCRIPTION=testdb%c"), _T(';'));
        wODBCStringLen += _stprintf( &szODBCAttributes[wODBCStringLen], _T("CHARSET=utf-8%c"), _T('\0'));


        if(!SQLConfigDataSource(NULL, ODBC_ADD_DSN, _T("CUBRID Driver"), szODBCAttributes))
        { printf("failed!"); return FALSE; }
        }{code}
        Show
        cn15800 谢韦华[Bert] added a comment - Test Code: {code} int main() { wchar_t* szODBCAttributes = (wchar_t*)malloc(1024); int wODBCStringLen = _stprintf( szODBCAttributes, _T("DSN=New2;"), "New", _T(';') ); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("uid=accountid%c"), _T(';') ); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("pwd=password%c"), _T(';')); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("fetch_size=100%c"), _T(';')); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("port=33000%c"), _T(';')); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("server=127.0.0.1%c"), _T(';')); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("db_name=testdb%c"), _T(';')); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("DESCRIPTION=testdb%c"), _T(';')); wODBCStringLen += _stprintf( &szODBCAttributes [wODBCStringLen] , _T("CHARSET=utf-8%c"), _T('\0')); if(!SQLConfigDataSource(NULL, ODBC_ADD_DSN, _T("CUBRID Driver"), szODBCAttributes)) { printf("failed!"); return FALSE; } }{code}
        Hide
        cn15800 谢韦华[Bert] added a comment -

        Test Code(c#)

        {code}
        [DllImport("ODBCCP32.DLL")]
        public static extern int SQLConfigDataSource(IntPtr hwndParent, int fRequest, string lpszDriver, string lpszAttributes);
        static public void case_APIS_706()
        { int err; string conn_dsn_str = "DSN=Test;uid=dba;pwd=;fetch_size=100;port=30000;server=test-db-server;db_name=demodb;CHARSET=utf-8"; //ODBC_ADD_SYS_DSN 4 err = SQLConfigDataSource((IntPtr)0, 4, "CUBRID Driver", conn_dsn_str); Assert.IsTrue(err == 1); String conn_str = @"Dsn=Test;"; OdbcConnection conn_cubrid = new OdbcConnection(conn_str); conn_cubrid.Open(); Assert.IsTrue(conn_cubrid.State == ConnectionState.Open); conn_cubrid.Close(); }{code}
        Show
        cn15800 谢韦华[Bert] added a comment - Test Code(c#) {code} [DllImport("ODBCCP32.DLL")] public static extern int SQLConfigDataSource(IntPtr hwndParent, int fRequest, string lpszDriver, string lpszAttributes); static public void case_APIS_706() { int err; string conn_dsn_str = "DSN=Test;uid=dba;pwd=;fetch_size=100;port=30000;server=test-db-server;db_name=demodb;CHARSET=utf-8"; //ODBC_ADD_SYS_DSN 4 err = SQLConfigDataSource((IntPtr)0, 4, "CUBRID Driver", conn_dsn_str); Assert.IsTrue(err == 1); String conn_str = @"Dsn=Test;"; OdbcConnection conn_cubrid = new OdbcConnection(conn_str); conn_cubrid.Open(); Assert.IsTrue(conn_cubrid.State == ConnectionState.Open); conn_cubrid.Close(); }{code}
        Hide
        ryin005 Ray Yin added a comment -

        Add a case for this issue

        {code}
        [DllImport("ODBCCP32.DLL")]
        public static extern int SQLConfigDataSource(IntPtr hwndParent, int fRequest, string lpszDriver, string lpszAttributes);

        [Test, Description("Test for OdbcDataReader GetName")]
        public void TestSQLConfigDataSource()
        {
        //create a data source name CUBRID_Test
        string conn_dsn_str = "DSN=CUBRID_Test;uid=dba;pwd=;fetch_size=100;port=33000;server=10.34.64.xx;db_name=test_odbc;CHARSET=utf-8";

        //ODBC_ADD_SYS_DSN 4
        int success = SQLConfigDataSource((IntPtr)0, 1, "CUBRID Driver", conn_dsn_str);
        Assert.IsTrue(success == 1);

        String conn_str = @"Dsn=CUBRID_Test;";
        OdbcConnection conn_cubrid = new OdbcConnection(conn_str);
        conn_cubrid.Open();
        Assert.IsTrue(conn_cubrid.State == ConnectionState.Open);
        conn_cubrid.Close();
        }{code}

        Link: http://svn.bds.nhncorp.com/xdbms/cubridqa/branches/RB-9.3.0/interface/ODBC/Cubrid_Odbc_Test_Solusion/TestCases/OdbcDDLReference.cs

        Show
        ryin005 Ray Yin added a comment - Add a case for this issue {code} [DllImport("ODBCCP32.DLL")] public static extern int SQLConfigDataSource(IntPtr hwndParent, int fRequest, string lpszDriver, string lpszAttributes); [Test, Description("Test for OdbcDataReader GetName")] public void TestSQLConfigDataSource() { //create a data source name CUBRID_Test string conn_dsn_str = "DSN=CUBRID_Test;uid=dba;pwd=;fetch_size=100;port=33000;server=10.34.64.xx;db_name=test_odbc;CHARSET=utf-8"; //ODBC_ADD_SYS_DSN 4 int success = SQLConfigDataSource((IntPtr)0, 1, "CUBRID Driver", conn_dsn_str); Assert.IsTrue(success == 1); String conn_str = @"Dsn=CUBRID_Test;"; OdbcConnection conn_cubrid = new OdbcConnection(conn_str); conn_cubrid.Open(); Assert.IsTrue(conn_cubrid.State == ConnectionState.Open); conn_cubrid.Close(); }{code} Link: http://svn.bds.nhncorp.com/xdbms/cubridqa/branches/RB-9.3.0/interface/ODBC/Cubrid_Odbc_Test_Solusion/TestCases/OdbcDDLReference.cs
        Hide
        ryin005 Ray Yin added a comment - - edited

        Test Build: CUBRID 9.3.0.0143
        Test OS: Win7 32bit
        .NET: 4.0
        Driver: cubrid-odbc 9.3.0.0001 (20140314)

        Test Result: Pass

        Close the issue

        Show
        ryin005 Ray Yin added a comment - - edited Test Build: CUBRID 9.3.0.0143 Test OS: Win7 32bit .NET: 4.0 Driver: cubrid-odbc 9.3.0.0001 (20140314) Test Result: Pass Close the issue

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            cn15800 谢韦华[Bert]
            CC (Referrer):
            Esen Sagynov, Isaiah Choe, 唐勤, 户向伟, 范再强, 谢韦华[Bert]
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: