-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColumnDescriptor.cpp
More file actions
57 lines (54 loc) · 992 Bytes
/
ColumnDescriptor.cpp
File metadata and controls
57 lines (54 loc) · 992 Bytes
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
// Copyright © 2023 CCP ehf.
#include "ColumnDescriptor.h"
#include "utils.h"
#include <atlstr.h>
DelayedException* ColumnDescriptor::TypeTranslate( DBTYPE& type, int& size )
{
type &= 0xff;
DBTYPE stype = type;
switch( stype )
{
case DBTYPE_BOOL:
size = 0;
break;
case DBTYPE_I1:
case DBTYPE_UI1:
size = 1;
break;
case DBTYPE_I2:
case DBTYPE_UI2:
size = 2;
break;
case DBTYPE_I4:
case DBTYPE_UI4:
case DBTYPE_R4:
size = 3;
break;
case DBTYPE_I8:
case DBTYPE_UI8:
case DBTYPE_R8:
case DBTYPE_CY:
case DBTYPE_FILETIME:
size = 4;
break;
case DBTYPE_DBTIMESTAMP:
case DBTYPE_DBDATE:
case DBTYPE_DBTIME2:
type = DBTYPE_FILETIME; //will be converted when read
size = 4;
break;
case DBTYPE_BSTR:
type = DBTYPE_WSTR; //they are the same.
case DBTYPE_STR:
case DBTYPE_WSTR:
case DBTYPE_BYTES:
size = 5;
break; //signals a pointer.
default: {
CString msg;
msg.Format( "Unexpected type %d", type );
PYDBERROR( msg );
}
}
return 0;
}