Click here to Skip to main content
15,890,336 members
Home / Discussions / Database
   

Database

 
GeneralRe: Oracle Data Provider Pin
Johan Lombaard29-Oct-02 2:03
Johan Lombaard29-Oct-02 2:03 
GeneralMultiple Inserts in a Stored Procedure Pin
RJS23-Oct-02 11:32
RJS23-Oct-02 11:32 
GeneralRe: Multiple Inserts in a Stored Procedure Pin
Nick Parker23-Oct-02 12:50
protectorNick Parker23-Oct-02 12:50 
GeneralRe: Multiple Inserts in a Stored Procedure Pin
SimonS23-Oct-02 17:44
SimonS23-Oct-02 17:44 
GeneralRe: Multiple Inserts in a Stored Procedure Pin
RJS24-Oct-02 4:17
RJS24-Oct-02 4:17 
GeneralRe: Multiple Inserts in a Stored Procedure Pin
Morten Abrahamsen24-Oct-02 19:45
Morten Abrahamsen24-Oct-02 19:45 
GeneralRe: Multiple Inserts in a Stored Procedure Pin
SimonS25-Oct-02 7:51
SimonS25-Oct-02 7:51 
GeneralMySQL w/ MyODBC - SQLGetCursorName() fails Pin
PJ Arends23-Oct-02 10:09
professionalPJ Arends23-Oct-02 10:09 
This is a followup to my previous question in the VisualC++ forum[^]. As no one was able to help me there (so far) and I have traced my problem to a failed SQLGetCursorName() call, I decided that this may be a better forum for my question.

I traced my problem into the CRecordSet::BuildUpdateSQL() function (Line 3394 of dbcore.cpp)
// Cache cursor name assigned by ODBC
if (m_strCursorName.IsEmpty())
{
    // Get predefined cursor name from datasource
    RETCODE nRetCode;
    TCHAR szCursorName[MAX_CURSOR_NAME+1];
    SWORD nLength = _countof(szCursorName)-1;
    AFX_SQL_SYNC(::SQLGetCursorName(m_hstmt,
        reinterpret_cast<SQLTCHAR *>(szCursorName), _countof(szCursorName), &nLength));
    if (!Check(nRetCode))
       ThrowDBException(nRetCode);   //  <== Exception thrown here
    m_strCursorName = szCursorName;
}
m_strUpdateSQL += m_strCursorName;


Now according to MSDN[^]:

<quote>
Cursor names are used only in positioned update and delete statements (for example, UPDATE table-name ...WHERE CURRENT OF cursor-name). For more information, see "Positioned Update and Delete Statements" in Chapter 12: Updating Data. If the application does not call SQLSetCursorName to define a cursor name, the driver generates a name. This name begins with the letters SQL_CUR.

Note In ODBC 2.x, when there was no open cursor and no name had been set by a call to SQLSetCursorName, a call to SQLGetCursorName returned SQLSTATE HY015 (No cursor name available). In ODBC 3.x, this is no longer true; regardless of when SQLGetCursorName is called, the driver returns the cursor name.
SQLGetCursorName returns the name of a cursor whether or not the name was created explicitly or implicitly. A cursor name is implicitly generated if SQLSetCursorName is not called. SQLSetCursorName can be called to rename a cursor on a statement as long as the cursor is in an allocated or prepared state.

A cursor name that is set either explicitly or implicitly remains set until the StatementHandle with which it is associated is dropped, using SQLFreeHandle with a HandleType of SQL_HANDLE_STMT.
</quote>

So now I can assume that MyODBC is an ODBC version 2.x because of the exception thrown. Now my question is, where would I place a call to SQLSetCursorName() and where do I get the 'statementhandle' needed in the call?

And here I thought this would be easy Dead | X|




CPUA 0x5041

Sonork 100.11743 Chicken Little

"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies

Within you lies the power for good - Use it!
QuestionDatabase not fast enough? Pin
LukeV23-Oct-02 8:51
LukeV23-Oct-02 8:51 
AnswerRe: Database not fast enough? Pin
Daniel Turini23-Oct-02 9:03
Daniel Turini23-Oct-02 9:03 
GeneralRe: Database not fast enough? Pin
LukeV23-Oct-02 10:10
LukeV23-Oct-02 10:10 
GeneralRe: Database not fast enough? Pin
Daniel Turini23-Oct-02 10:17
Daniel Turini23-Oct-02 10:17 
GeneralRe: Database not fast enough? Pin
LukeV23-Oct-02 10:29
LukeV23-Oct-02 10:29 
AnswerRe: Database not fast enough? Pin
Vagif Abilov23-Oct-02 10:33
professionalVagif Abilov23-Oct-02 10:33 
GeneralRe: Database not fast enough? Pin
LukeV23-Oct-02 10:40
LukeV23-Oct-02 10:40 
AnswerRe: Database not fast enough? Pin
Matt Gullett23-Oct-02 11:52
Matt Gullett23-Oct-02 11:52 
GeneralRe: Database not fast enough? Pin
LukeV23-Oct-02 13:05
LukeV23-Oct-02 13:05 
GeneralWorking with DataSet and XSD files Pin
Noam Ben Haim23-Oct-02 6:13
Noam Ben Haim23-Oct-02 6:13 
GeneralConnecting from ASP.Net to MySql Pin
Smitha Nishant23-Oct-02 2:25
protectorSmitha Nishant23-Oct-02 2:25 
GeneralRe: Connecting from ASP.Net to MySql Pin
Morten Abrahamsen24-Oct-02 19:48
Morten Abrahamsen24-Oct-02 19:48 
GeneralRe: Connecting from ASP.Net to MySql Pin
Smitha Nishant24-Oct-02 23:05
protectorSmitha Nishant24-Oct-02 23:05 
GeneralInstalling an Excel Driver Pin
José Luis Sogorb22-Oct-02 23:47
José Luis Sogorb22-Oct-02 23:47 
GeneralRe: Installing an Excel Driver Pin
Paul Riley23-Oct-02 0:31
Paul Riley23-Oct-02 0:31 
GeneralRe: Installing an Excel Driver Pin
José Luis Sogorb23-Oct-02 6:54
José Luis Sogorb23-Oct-02 6:54 
GeneralRe: Installing an Excel Driver Pin
Paul Riley23-Oct-02 7:36
Paul Riley23-Oct-02 7:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.