Repository navigation
Expand file tree
/
Copy pathOurAccessor.h
More file actions
68 lines (56 loc) · 1.77 KB
/
Copy pathOurAccessor.h
File metadata and controls
68 lines (56 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright © 2023 CCP ehf.
/*
*************************************************************************
OurAccessor.h
Project: EVE Server Database Access
Description:
A subclass from CDynamicAccessor that provides methods to access the structure
linearly, not through the ordinalID, which costs mucho runtime. Code copied from atldbcli.h
Dependencies:
Python
*************************************************************************
*/
#pragma once
#ifndef _OURACCESSOR_H_
#define _OURACCESSOR_H_
class OurAccessor : public CDynamicParameterAccessor
{
public:
DBORDINAL GetOrdinal_ByIndex( int index )
{
const int nColumn = index;
CCP_ASSERT( nColumn < (int)GetColumnCount() );
return m_pColumnInfo[nColumn].iOrdinal;
}
LPOLESTR GetColumnName_ByIndex( int index )
{
const int nColumn = index;
return m_pColumnInfo[nColumn].pwszName;
}
DBTYPE GetColumnType_ByIndex( int index )
{
const int nColumn = index;
return m_pColumnInfo[nColumn].wType;
}
DBSTATUS GetStatus_ByIndex( int index )
{
const int nColumn = index;
DBBYTEOFFSET nOffset = (DBBYTEOFFSET)(ULONG_PTR)m_pColumnInfo[nColumn].pTypeInfo;
IncrementAndAlignOffset( nOffset, m_pColumnInfo[nColumn].ulColumnSize, __alignof( DBLENGTH ) );
IncrementAndAlignOffset( nOffset, sizeof( DBLENGTH ), __alignof( DBSTATUS ) );
return *(DBSTATUS*)( m_pBuffer + nOffset );
}
DBLENGTH GetLength_ByIndex( int index )
{
const int nColumn = index;
DBBYTEOFFSET nOffset = (DBBYTEOFFSET)(ULONG_PTR)m_pColumnInfo[nColumn].pTypeInfo;
IncrementAndAlignOffset( nOffset, m_pColumnInfo[nColumn].ulColumnSize, __alignof( DBLENGTH ) );
return *(DBLENGTH*)( m_pBuffer + nOffset );
}
template <class ctype>
void GetValue_ByIndex( int index, ctype* pData )
{
_GetValue( index, pData );
}
};
#endif