This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

61
sql/SQLDSN.HPP Normal file
View File

@@ -0,0 +1,61 @@
#ifndef _SQL_DATASOURCE_HPP_
#define _SQL_DATASOURCE_HPP_
#ifndef _SQL_DATAITEM_HPP_
#include <sql/dataitem.hpp>
#endif
class DataSource
{
public:
enum Fetch{First=SQL_FETCH_FIRST,Next=SQL_FETCH_NEXT};
DataSource(HandleEnvironment &handleEnvironment);
virtual ~DataSource();
WORD sourceFirst(DataItem &someDataItem);
WORD sourceNext(DataItem &someDataItem);
private:
WORD sourceName(DataItem &someDataItem,Fetch sourceFetch);
HandleEnvironment &mhEnvironment;
};
inline
DataSource::DataSource(HandleEnvironment &handleEnvironment)
: mhEnvironment(handleEnvironment)
{
}
inline
DataSource::~DataSource()
{
}
inline
WORD DataSource::sourceFirst(DataItem &someDataItem)
{
return sourceName(someDataItem,First);
}
inline
WORD DataSource::sourceNext(DataItem &someDataItem)
{
return sourceName(someDataItem,Next);
}
inline
WORD DataSource::sourceName(DataItem &someDataItem,Fetch sourceFetch)
{
RETCODE sqlReturn;
UCHAR sourceName[SQL_MAX_DSN_LENGTH+1];
UCHAR sourceDescription[1024];
SWORD cbNameLength(sizeof(sourceName));
SWORD cbDescriptionLength(sizeof(sourceDescription));
SWORD outNameLength;
SWORD outDescriptionLength;
sqlReturn=::SQLDataSources(mhEnvironment,sourceFetch,sourceName,cbNameLength,&outNameLength,sourceDescription,cbDescriptionLength,&outDescriptionLength);
if(sqlReturn!=SQL_SUCCESS&&sqlReturn!=SQL_SUCCESS_WITH_INFO)return TRUE;
someDataItem.sourceName((char*)sourceName);
someDataItem.sourceDescription((char*)sourceDescription);
return FALSE;
}
#endif