MFC issues with ODBC

Поиск
Список
Период
Сортировка
От Amarsh M
Тема MFC issues with ODBC
Дата
Msg-id 9ffd866c0507151610411bf275@mail.gmail.com
обсуждение исходный текст
Список pgsql-odbc
Hello,

I have an issue with ODBC connectivity. I am using the latest version
of PostGreSQL  with VC++  and using  ODBC to connect. I use the MFC
object namely CRecordset to get the records from the DB, this code was
working great when it was intially written a couple of months ago. I
started to work on it again this week and the code doesnt work
anymore, esp the CRecordset::Open method fails.

A brief snippet of my code

recordptr=new CRecordset(this);
this->ExecuteSQL("insert into test values (3,'three');");
AfxMessageBox("Executed the statement");
ret=recordptr->Open(CRecordset::snapshot,SQL.Trim(),CRecordset::none);

In the above code the last line fails all others including executeSQL
on the CDatabase object work fine. Also it gives no error message it
just gives a blank message box.

Upon looking into the code I found the crash was happening  when it
was trying to get a record, specifically in MoveNext(); function
inside  dbcore.cpp (which is a MS class).

I cant make much of the log, but here is the actual failure part
"Select project name from master;" is the SQL statement I am trying to
execute and there is data in the table.

Thanks in advance

   a14-ea0    ENTER SQLPrepare
        HSTMT               01742520
        UCHAR *             0x013BDA40 [      -3] "Select projectname from master;\ 0"
        SDWORD                    -3

     a14-ea0    ENTER SQLPrepare
        HSTMT               01742520
        UCHAR *             0x00378E10 [      31] "Select projectname from master;"
        SDWORD                    31

     a14-ea0    EXIT  SQLPrepare  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520
        UCHAR *             0x00378E10 [      31] "Select projectname from master;"
        SDWORD                    31

     a14-ea0    EXIT  SQLPrepare  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520
        UCHAR *             0x013BDA40 [      -3] "Select projectname from master;\ 0"
        SDWORD                    -3

    a14-ea0    ENTER SQLExecute
        HSTMT               01742520

    a14-ea0    ENTER SQLExecute
        HSTMT               01742520

     a14-ea0    EXIT  SQLExecute  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520

     a14-ea0    ENTER SQLNumResultCols
        HSTMT               01742520
        SWORD *             0x0037E97E
     a14-ea0    EXIT  SQLNumResultCols  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520
        SWORD *             0x0037E97E (1)

    a14-ea0    EXIT  SQLExecute  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520

    a14-ea0    ENTER SQLNumResultCols
        HSTMT               01742520
        SWORD *             0x013BD7B8

    a14-ea0    EXIT  SQLNumResultCols  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520
        SWORD *             0x013BD7B8 (1)

     a14-ea0    ENTER SQLDescribeCol
        HSTMT               01742520
        UWORD                        1
        UCHAR *             0x013BDB48
        SWORD                      256
        SWORD *             0x0012EC3C
        SWORD *             0x013BDA98
        SQLULEN *           0x013BDA9C
        SWORD *             0x013BDAA0
        SWORD *             0x013BDAA2

    a14-ea0    EXIT  SQLDescribeCol  with return code 0 (SQL_SUCCESS)
        HSTMT               01742520
        UWORD                        1
        UCHAR *             0x013BDB48 [      11] "projectname"
        SWORD                      256
        SWORD *             0x0012EC3C (11)
        SWORD *             0x013BDA98 (-9)
        SQLULEN *           0x013BDA9C (200)
        SWORD *             0x013BDAA0 (0)
        SWORD *             0x013BDAA2 (1)

     a14-ea0    ENTER SQLExtendedFetch
        HSTMT               01742520
        UWORD                        1 <SQL_FETCH_NEXT>
        SQLLEN                     1
        SQLULEN *           0x013BD840
        UWORD *             0x013B8E58

     a14-ea0    EXIT  SQLExtendedFetch  with return code -1 (SQL_ERROR)
        HSTMT               01742520
        UWORD                        1 <SQL_FETCH_NEXT>
        SQLLEN                     1
        SQLULEN *           0x013BD840
        UWORD *             0x013B8E58

    a14-ea0    ENTER SQLErrorW
        HENV                01741540
        HDBC                017415E8
        HSTMT               01742520
        WCHAR *             0x0012E870 (NYI)
         SDWORD *            0x0012EB44
        WCHAR *             0x0012E470
        SWORD                      511
        SWORD *             0x0012E934
    a14-ea0    EXIT  SQLErrorW  with return code 100 (SQL_NO_DATA_FOUND)
        HENV                01741540
        HDBC                017415E8
        HSTMT               01742520
        WCHAR *             0x0012E870 (NYI)
         SDWORD *            0x0012EB44
        WCHAR *             0x0012E470
        SWORD                      511
        SWORD *             0x0012E934

     a14-ea0    ENTER SQLFreeStmt
        HSTMT               01742520
        UWORD                        1 <SQL_DROP>

В списке pgsql-odbc по дате отправления:

Предыдущее
От: "Greg Campbell"
Дата:
Сообщение: Re: Has anyone accessed postgresql in linux from VB code
Следующее
От: lothar.behrens@lollisoft.de
Дата:
Сообщение: Best way of retrieving tablename from a query ?