bk commit - Connector/ODBC 3.53 (1.38)
am 12.04.2005 16:50:55 von pharveyBelow is the list of changes that have just been commited into a local
MyODBC 3.53 repository of 'pharvey'. When 'pharvey' does a push, they will
be propogaged to the main repository and within 2 hours after the push
into the public repository.
For more information on how to access the public repository see:
http://www.mysql.com/products/myodbc/faq_2.html#Development_ source
You can also browse the changes from public repository:
Complete repository: http://mysql.bkbits.net:8080/myodbc-3.53/
This changeset : http://mysql.bkbits.net:8080/myodbc-3.53/cset@1.38
ChangeSet
1.38 05/04/12 07:50:55 pharvey@mysql.com +6 -0
- updated doc for revised linked list api
MYODBCRes/MYODBCResLib/MYODBCResInternal.h
1.8 05/04/12 07:50:54 pharvey@mysql.com +3 -26
- updated doc for revised linked list api
MYODBCList/include/MYODBCList.h
1.3 05/04/12 07:50:54 pharvey@mysql.com +340 -100
- updated doc for revised linked list api
MYODBCList/MYODBCListLib/MYODBCListSetPos.c
1.4 05/04/12 07:50:54 pharvey@mysql.com +1 -1
- updated doc for revised linked list api
MYODBCList/MYODBCListLib/MYODBCListLast.c
1.3 05/04/12 07:50:54 pharvey@mysql.com +7 -2
- updated doc for revised linked list api
MYODBCList/MYODBCListLib/MYODBCListGetError.c
1.3 05/04/12 07:50:54 pharvey@mysql.com +1 -1
- updated doc for revised linked list api
MYODBCList/MYODBCListLib/MYODBCListFirst.c
1.3 05/04/12 07:50:54 pharvey@mysql.com +7 -2
- updated doc for revised linked list api
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pharvey
# Host: thinkpad.peterharvey.org
# Root: /home/pharvey/SandBox/MySQL/myodbc-3.53
--- 1.2/MYODBCList/MYODBCListLib/MYODBCListFirst.c 2005-04-09 20:15:30 -07:00
+++ 1.3/MYODBCList/MYODBCListLib/MYODBCListFirst.c 2005-04-12 07:50:54 -07:00
@@ -15,8 +15,13 @@
if ( !hList || MYODBCRttiType( hList ) != MYODBC_RTTI_LIST )
return MYODBCListSetError( NULL, MYODBC_LIST_ARGUMENT, __FILE__, __LINE__, "hList" );
- pList->nItemCurrent = 1;
- pList->pItemCurrent = pList->pItemFirst;
+ if ( pList->nItems )
+ {
+ pList->nItemCurrent = 1;
+ pList->pItemCurrent = pList->pItemFirst;
+ }
+ else
+ return MYODBCListSetError( hList, MYODBC_LIST_EOL, __FILE__, __LINE__, NULL );
return MYODBCListSetError( hList, MYODBC_LIST_SUCCESS, __FILE__, __LINE__, NULL );
}
--- 1.2/MYODBCList/MYODBCListLib/MYODBCListGetError.c 2005-04-09 20:15:30 -07:00
+++ 1.3/MYODBCList/MYODBCListLib/MYODBCListGetError.c 2005-04-12 07:50:54 -07:00
@@ -17,7 +17,7 @@
MYODBC_LIST_PTR pList = (MYODBC_LIST_PTR)hList;
if ( !hList || MYODBCRttiType( hList ) != MYODBC_RTTI_LIST )
- return MYODBC_LIST_ERROR;
+ return MYODBC_LIST_ARGUMENT;
if ( pnReturn )
*pnReturn = pList->nReturn;
--- 1.3/MYODBCList/MYODBCListLib/MYODBCListSetPos.c 2005-04-09 20:15:30 -07:00
+++ 1.4/MYODBCList/MYODBCListLib/MYODBCListSetPos.c 2005-04-12 07:50:54 -07:00
@@ -24,7 +24,7 @@
/*
This is all about scanning and that can be very slow - depending upon the call and
- number of items in the list - excruciatingly slow. So lets try a few, very simple,
+ number of items in the list - painfully slow. So lets try a few, very simple,
things to make us more likley to return faster.
Of course these optimizations are simplistic but should help.
--- 1.2/MYODBCList/MYODBCListLib/MYODBCListLast.c 2005-04-09 20:15:30 -07:00
+++ 1.3/MYODBCList/MYODBCListLib/MYODBCListLast.c 2005-04-12 07:50:54 -07:00
@@ -15,8 +15,13 @@
if ( !hList || MYODBCRttiType( hList ) != MYODBC_RTTI_LIST )
return MYODBCListSetError( NULL, MYODBC_LIST_ARGUMENT, __FILE__, __LINE__, "hList" );
- pList->nItemCurrent = pList->nItems - 1;
- pList->pItemCurrent = pList->pItemLast;
+ if ( pList->nItems )
+ {
+ pList->nItemCurrent = pList->nItems - 1;
+ pList->pItemCurrent = pList->pItemLast;
+ }
+ else
+ return MYODBCListSetError( hList, MYODBC_LIST_EOL, __FILE__, __LINE__, NULL );
return MYODBCListSetError( hList, MYODBC_LIST_SUCCESS, __FILE__, __LINE__, NULL );
}
--- 1.2/MYODBCList/include/MYODBCList.h 2005-04-09 20:15:30 -07:00
+++ 1.3/MYODBCList/include/MYODBCList.h 2005-04-12 07:50:54 -07:00
@@ -13,10 +13,28 @@
we want more of a "black box" API using handles to ease
maintainence. There are other tiny reasons which, ultimately,
add up to a justification of this lib.
+
+ \note This library may not support some features such as concurrent
+ access and multiple cursors. It is expected that such features
+ can be added, as needed, with minimal changes to calling code.
*/
#ifndef MYODBC_LIST_H
#define MYODBC_LIST_H
+/*!
+ \brief Return codes.
+
+ Most functions in this API returns one of these return codes. This
+ is true for all but the most extreme reasons not to. This may make
+ the API a little bit more cumbersome than it otherwise would need
+ to be but the consistency makes the API much easier to understand
+ and encourages calling code to check the status of calls.
+
+ The return code is typedef to make code easier to maintain;
+ - allow strict type checking by the compiler
+ - allow warnings from switch statements which do not handle all
+ viable values
+*/
typedef enum MYODBC_LIST_RETURN
{
MYODBC_LIST_SUCCESS = 0, /* success: general */
@@ -45,6 +63,11 @@
/*!
\brief A list handle.
+
+ Hiding the details behind generic handles is important in making
+ this API a 'black-box'. Developers using this API should not have
+ to get caught up in such details unless there is a bug in the
+ list library code itself.
*/
typedef void *MYODBC_LIST_HANDLE;
@@ -55,6 +78,8 @@
/*!
\brief A list item data pointer.
+
+ This is used to make the code easier to understand.
*/
typedef void *MYODBC_LIST_ITEM_DATA_PTR;
@@ -62,18 +87,23 @@
\internal
\brief Allocates, initializes and returns a new MYODBC_LIST_HANDLE.
+ The current position will be EOL.
+
Unlike most other functions in this API - there will be no
details about a failure to be returned by MYODBCListGetError
as there would be no list to store the information. In such
a case the caller simply relies upon the return code.
-
+
+ \param phList Pointer to a place where we can store the new handle.
+
\return MYODBC_LIST_RETURN
\retval MYODBC_LIST_SUCCESS
\retval MYODBC_LIST_ARGUMENT
\retval MYODBC_LIST_MEMORY
- \sa MYODBCListGetError
+ \sa MYODBCListFree
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListAlloc( MYODBC_LIST_HANDLE *phList );
@@ -81,40 +111,33 @@
\internal
\brief Appends a new item to list.
- Call this function to add an new item to the end of
+ Call this function to add a new item to the end of
the list.
+ The current position will be set to the new item.
+
\param hList List handle allocated with MYODBCListAlloc().
- \param pData Your data.
+ \param pData Pointer to your data.
- \return MYODBC_LIST_ITEM_HANDLE
-
- \code
-typdef struct tMY_DATA
-{
- char szFirstName[50];
- char szLastName[50];
-
-} MY_DATA;
+ \return MYODBC_LIST_RETURN
-void FreeMyData( void *pData )
-{
- MY_DATA *p = (MY_DATA*)pData;
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_MEMORY
- free( p );
-}
+ \sa MYODBCListInsert
+ MYODBCListGetError
+ \code
void main()
{
- MYODBC_LIST_HANDLE hList = MYODBCListAlloc();
- MY_DATA *pData;
-
- MYODBCListFreeFunc( hList, FreeMyData );
+ MYODBC_LIST_HANDLE hList;
- pData = (MY_DATA *)malloc( sizeof(MY_DATA) );
- strcpy( pData->szFirstName, "Peter" );
- strcpy( pData->szLastName, "Harvey");
- MYODBCListAppend( pData );
+ MYODBCListAlloc( &hList );
+ MYODBCListFreeFunc( hList, free );
+
+ MYODBCListAppend( hList, strdup( "item0" ) );
+ MYODBCListAppend( hList, strdup( "item1" ) );
MYODBCListFree( hList );
}
@@ -127,20 +150,29 @@
\brief Deletes all items in the list.
Call this function to delete all items of the
- list. Each item will be passed to free func if
- one set using MYODBCListItemFreeSet()
+ list. Each non-null item data will be passed to
+ free func if one set using MYODBCListItemFreeSet()
otherwise no attempt is made to free the item
data.
Calling this function is more efficient than
- looping with calls to MYODBCListItemDel().
+ looping with calls to MYODBCListDelete().
This function is called automatically by
MYODBCListFree().
+
+ The current position will be EOL.
\param hList List handle allocated with MYODBCListAlloc().
- \return void
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ERROR
+ \retval MYODBC_LIST_ARGUMENT
+
+ \sa MYODBCListDelete
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListClear( MYODBC_LIST_HANDLE hList );
@@ -149,21 +181,28 @@
\brief Delete item from list.
Call this function to delete the given item from the list.
- Any free func set with MYODBCListItemFreeSet() will
+ Any free func set with MYODBCListSetFreeFunc() will
be called.
- This function will return the next item in the
- list or NULL of no next item.
-
- \param hItem The item to delete.
+ The current position will be the next item or EOL.
+
+ \param hList List handle.
- \return MYODBC_LIST_ITEM_HANDLE
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListClear
+ MYODBCListSetFreeFunc
+ MYODBCListGetError
\code
typdef struct tMY_DATA
{
- char szFirstName[50];
- char szLastName[50];
+ char *pszFirstName;
+ char *pszLastName;
} MY_DATA;
@@ -171,35 +210,33 @@
{
MY_DATA *p = (MY_DATA*)pData;
+ if ( p->pszFirstName ) free( p->pszFirstName );
+ if ( p->pszLastName ) free( p->pszLastName );
free( p );
}
void main()
{
- MYODBC_LIST_HANDLE hList = MYODBCListAlloc();
- MYODBC_LIST_ITEM_HANDLE hItem;
- MY_DATA * pData;
-
+ MYODBC_LIST_HANDLE hList;
+ MY_DATA * pData;
+
+ MYODBCListAlloc( &hList );
MYODBCListFreeFunc( hList, FreeMyData );
pData = (MY_DATA *)malloc( sizeof(MY_DATA) );
- strcpy( pData->szFirstName, "Peter" );
- strcpy( pData->szLastName, "Harvey");
- MYODBCListAppend( pData );
+ pData->pszFirstName = strdup( "item0 - A" );
+ pData->pszLastName = strdup( "item0 - B" );
+ MYODBCListAppend( hList, pData );
pData = (MY_DATA *)malloc( sizeof(MY_DATA) );
- strcpy( pData->szFirstName, "Tecumseh" );
- strcpy( pData->szLastName, "");
- MYODBCListAppend( pData );
+ pData->pszFirstName = strdup( "item1 - A" );
+ pData->pszLastName = strdup( "item1 - B" );
+ MYODBCListAppend( hList, pData );
- hItem = MYODBCListFirst( hList );
- while ( hItem )
+ MYODBCListFirst( hList );
+ while ( !MYODBCListIsEOL( hList ) )
{
- pData = (MY_DATA*)MYODBCListGet( hItem);
- if ( strcmp( pData->pszFirstName, "Peter" ) == 0 )
- hItem = MYODBCListDelete( hItem );
- else
- hItem = MYODBCListNext( hItem );
+ MYODBCListDelete( hList );
}
MYODBCListFree( hList );
@@ -211,19 +248,37 @@
/*!
\internal
\brief Delete item from list.
+
+ This is alternative to MYODBCListDelete which allows
+ the caller to work with a list item without knowing,
+ owning, or otherwise having a reference to the list
+ handle.
+
+ \param hListItem List item handle.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListDelete
*/
MYODBC_LIST_RETURN MYODBCListDeleteItem( MYODBC_LIST_ITEM_HANDLE hListItem );
/*!
\internal
- \brief Returns the first item in the list.
+ \brief Sets the current position to the first item.
- Returns the first item in the list
- or NULL of list is empty.
-
\param hList A MYODBC_LIST_HANDLE allocated with MYODBCListAlloc().
- \return MYODBC_LIST_ITEM_HANDLE
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+
+ \sa MYODBCListLast
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListFirst( MYODBC_LIST_HANDLE hList );
@@ -240,7 +295,13 @@
\param hList List handle previously allocated with
MYODBCListAlloc().
- \return void
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+
+ \sa MYODBCListClear
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListFree( MYODBC_LIST_HANDLE hList );
@@ -255,13 +316,19 @@
If the caller frees the data it should also call
MYODBCListSet() to set the data value to NULL or some
- other valid pointer..
+ other, valid, pointer..
- \param hItem The item.
+ \param hList List handle.
+ \param ppData Pointer to a buffer to hold pointer to data.
- \return void *
- \retval data stored in item
- \retval NULL if no data stored in item
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListSet
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListGet( MYODBC_LIST_HANDLE hList, MYODBC_LIST_ITEM_DATA_PTR *ppData );
@@ -273,6 +340,15 @@
less than zero and when equal to zero there are no items in
the list.
+ \param hList List handle.
+ \param pnItems Pointer to a buffer to hold the result.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+
+ \sa MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListGetCount( MYODBC_LIST_HANDLE hList, MYODBC_C_ULONGLONG *pnItems );
@@ -280,6 +356,16 @@
\internal
\brief Retreives information about the last call.
+ \param hList A list handle.
+ \param pnReturn Pointer to a buffer to hold the return value.
+ \param ppszFile Pointer to a buffer to hold pointer to source file name.
+ \param pnLine Pointer to a buffer to hold source line number.
+ \param ppszMessage Pointer to a buffer to hold pointer to message.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
*/
MYODBC_LIST_RETURN MYODBCListGetError( MYODBC_LIST_HANDLE hList,
MYODBC_LIST_RETURN * pnReturn,
@@ -292,69 +378,171 @@
In some cases the caller may want to store an item handle only
and then use it to - for example; delete the item.
+
+ \param hList List Handle.
+ \param phItem Pointer to a buffer to hold list item handle.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListGet
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListGetItem( MYODBC_LIST_HANDLE hList, MYODBC_LIST_ITEM_HANDLE *phItem );
/*!
\internal
- \brief Retrieves the
+ \brief Retrieves the list handle.
+
+ The list handle is the list which 'owns' the list item.
+
+ \param hListItem List item handle.
+ \param phList Pointer to a buffer to hold the list handle.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+
+ \sa MYODBCListGetItem
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListGetList( MYODBC_LIST_ITEM_HANDLE hListItem, MYODBC_LIST_HANDLE *phList );
/*!
\internal
- \brief Retrieves the current item number.
+ \brief Retrieves the current position.
+
+ The position is 0 based. MYODBC_LIST_EOL is returned if the
+ position is invalid.
+
+ \param hList List handle.
+ \param pnItem Pointer to a buffer to hold result.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListSetPos
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListGetPos( MYODBC_LIST_HANDLE hList, MYODBC_C_ULONGLONG *pnItem );
/*!
\internal
\brief Insert a new item into the list.
+
+ Inserts a new item into the list making the new item the
+ current position.
+
+ \param hList List handle.
+ \param nLocation Indicates where the new item should be inserted.
+ \param pData Pointer to the item data.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_MEMORY
+
+ \sa MYODBCListAppend
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListInsert( MYODBC_LIST_HANDLE hList, MYODBC_LIST_INSERT_TYPE nLocation, MYODBC_LIST_ITEM_DATA_PTR pData );
/*!
\internal
\brief Used to determine if the current position is invalid.
+
+ The current position becomes invalid (EOL) if an attempt is made
+ to set current position before the start of the list or after the
+ end of the list.
+
+ \param hList List handle.
+
+ \return MYODBC_C_BOOL
+
+ \retval MYODBC_C_TRUE
+ \retval MYODBC_C_FALSE
+
+ \sa MYODBCListNext
+ MYODBCListPrev
*/
MYODBC_C_BOOL MYODBCListIsEOL( MYODBC_LIST_HANDLE hList );
/*!
\internal
- \brief Returns the last item in the list.
+ \brief Sets current position to last item in the list.
- Returns the last item in the list
- or NULL of list is empty.
-
- \param hList A MYODBC_LIST_HANDLE allocated with MYODBCListAlloc().
+ \param hList List handle.
- \return MYODBC_LIST_ITEM_HANDLE
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListFirst
+ MYODBCListNext
+ MYODBCListPrev
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListLast( MYODBC_LIST_HANDLE hList );
/*!
\internal
- \brief Returns the next item in the list.
+ \brief Sets the current position to the next item.
- Returns the next item in the list
- or NULL if given item is last item.
-
- \param hItem A MYODBC_LIST_ITEM_HANDLE.
+ If the next item does not exist;
+ - current position becomes invalid (EOL)
+ - MYODBC_LIST_EOL is returned
+
+ If current position is EOL;
+ - same as MYODBCListFirst
+
+ \param hList List handle.
- \return MYODBC_LIST_ITEM_HANDLE
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListPrev
+ MYODBCListFirst
+ MYODBCListLast
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListNext( MYODBC_LIST_HANDLE hList );
/*!
\internal
- \brief Returns the previous item in the list.
+ \brief Sets the current position to the previous item.
- Returns the previous item in the list
- or NULL if given item is first item.
-
- \param hItem A MYODBC_LIST_ITEM_HANDLE.
+ If the previous item does not exist;
+ - current position becomes invalid (EOL)
+ - MYODBC_LIST_EOL is returned
+
+ If current position is EOL;
+ - same as MYODBCListLast
+
+ \param hList List handle.
- \return MYODBC_LIST_ITEM_HANDLE
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListNext
+ MYODBCListFirst
+ MYODBCListLast
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListPrev( MYODBC_LIST_HANDLE hList );
@@ -368,48 +556,100 @@
No attempt is made to free memory - not even if existing
data has been assigned to the item.
- \param hItem The item.
+ \param hList List handle.
+ \param pData Pointer to new item data.
- \return void
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
\sa MYODBCListGet
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListSet( MYODBC_LIST_HANDLE hList, MYODBC_LIST_ITEM_DATA_PTR pData );
-
/*!
\internal
- \brief Sets a call-back function to free a List Item when
- value is deleted from List.
+ \brief Sets a call-back function to free a item data when
+ item is deleted from list.
- By default List Items are NOT freed when it is deleted
- from List - it is expect that the caller will handle this
+ By default item data is NOT freed when it is deleted
+ from list - it is expected that the caller will handle this
as needed.
Calling this function to set a call-back function to free
- Items will cause Items to be passed to the call-back
- function when they are deleted from the List. Presumably;
- the call-back function will free memory used by the Item.
+ item data will cause data pointers to be passed to the call-back
+ function when they are deleted from the list (if they are not null).
+ Presumably; the call-back function will free the data.
\param hList An allocated/initialized List handle.
\param pFuncFree A pointer to a function where the function
accepts a pointer to an List Item.
- \return void
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+
+ \sa MYODBCListDelete
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListSetFreeFunc( MYODBC_LIST_HANDLE hList, void (*pfuncFree)(MYODBC_LIST_ITEM_DATA_PTR pData) );
/*!
\internal
- \brief Changes the position of the cursor relative to the beginning of
+ \brief Sets current position.
+
+ Changes the current position relative to the beginning of
the list.
+
+ This is the least efficient way to set the current position but is
+ the best way to set position when none of the other functions will
+ do (read; better than writing your own code to scan to position).
+
+ \param hList List handle.
+ \param nItem Position (0 based) to make current.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_INVALID_POS
+
+ \sa MYODBCListFirst
+ MYODBCListLast
+ MYODBCListNext
+ MYODBCListLast
+ MYODBCListSkip
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListSetPos( MYODBC_LIST_HANDLE hList, MYODBC_C_ULONGLONG nItem );
/*!
\internal
- \brief Changes the position of the cursor relative to the current
- position.
+ \brief Sets current position.
+
+ Changes the current position relative to where it is now. In other words
+ it moves the current position forward or backward the given number of
+ items. A negative number is used to move backwards a positive number is
+ used to move forward.
+
+ It is more efficient to use MYODBCListNext/MYODBCListPrev to move
+ the current position forward/backward by one item.
+
+ \return MYODBC_LIST_RETURN
+
+ \retval MYODBC_LIST_SUCCESS
+ \retval MYODBC_LIST_ARGUMENT
+ \retval MYODBC_LIST_EOL
+
+ \sa MYODBCListFirst
+ MYODBCListLast
+ MYODBCListNext
+ MYODBCListLast
+ MYODBCListGetError
*/
MYODBC_LIST_RETURN MYODBCListSkip( MYODBC_LIST_HANDLE hList, MYODBC_C_LONGLONG nItems );
--- 1.7/MYODBCRes/MYODBCResLib/MYODBCResInternal.h 2005-04-09 20:15:30 -07:00
+++ 1.8/MYODBCRes/MYODBCResLib/MYODBCResInternal.h 2005-04-12 07:50:54 -07:00
@@ -4,6 +4,7 @@
#include "../include/MYODBCRes.h"
/*!
+ \internal
\brief Used to hold resultset data generated by myodbc itself. For example;
when returning catalog data when no sys tables or view generates exact
resultset needed or from calling SQLGetTypeInfo.
@@ -22,28 +23,10 @@
and because mysql structs may change. Also; because we must use diff.
resulset formats anyway (MYSQL_RES and MYSQL_STMT for example).
- The myodbc array handling functions are used because we can use
- the index count under certian circumstances but most importantly
- because we can reduce code.
-
Finally; like any resultset, the IRD descriptors tell us how to
interpret this.
-*/
-typedef struct tagMYODBC_RES_INTERNAL
-{
- my_ulonglong nRow; /*!< current cursor position (0=before 1st record) */
- MYODBC_ARRAY_HANDLE hArrayRows; /*!< set is an array of tuples (rows) and a tuple is an array of strings */
-
-} MYODBC_RES_INTERNAL;
-
-
-/*!
- \internal
- \brief Internal result pointer.
-
- This is for convenience and code clarity.
*/
-typedef MYODBC_RES_INTERNAL *MYODBC_RES_INTERNAL_PTR;
+typedef MYODBC_LIST_HANDLE *MYODBC_RES_INTERNAL_PTR;
/*!
\brief General purpose result set.
@@ -54,10 +37,6 @@
- MYSQL_RES
- MYSQL_STMT
- MYODBC_RES_INTERNAL
-
- \note The members of this struct should not be accessed directly
- except by functions supporting this result API. Caller
- should work with the public API and MYODBC_RES_HANDLE.
*/
typedef struct tagMYODBC_RES
{
@@ -65,8 +44,6 @@
MYODBC_RES_METHOD_TYPE nMethod; /*!< tells us whats in u */
MYSQL * pMySQL; /*!< parent of MYSQL_RES or MYSQL_STMT */
MYODBC_RES_COLDEF_PTR pColDef; /*!< Reference to statements IRD */
- SQLROWCOUNT nRows; /*!< Number of rows. May not be complete*/
- SQLROWCOUNT nRow; /*!< Current row. nRow>nRows=EOF */
union
{
@@ -74,7 +51,7 @@
#ifdef V4_1
MYSQL_STMT * pMyStmt; /*!< nWherePrepared = SERVER */
#endif
- MYODBC_ARRAY_HANDLE hArrayRows; /*!< nWherePrepared = INTERNAL */
+ MYODBC_LIST_HANDLE hListRows; /*!< nWherePrepared = INTERNAL */
} u;
} MYODBC_RES;
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@m.gmane.org