FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
dmPython/Error.c at main · DamengDB/dmPython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
DamengDB
/
dmPython
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
7
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
dmPython
/
Error.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
92 lines (83 loc) · 3.3 KB
Breadcrumbs
dmPython
/
Error.c
Copy path
File metadata and controls
92 lines (83 loc) · 3.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//-----------------------------------------------------------------------------
// Error.c
// Error handling.
//-----------------------------------------------------------------------------
#include
"Error.h"
//-----------------------------------------------------------------------------
// Error_Free()
// Deallocate the environment, disconnecting from the database if necessary.
//-----------------------------------------------------------------------------
static
void
Error_Free
(
dm_Error
*
self
// error object
)
{
if
(
self
->
context
!=
NULL
)
{
PyMem_Free
(
self
->
context
);
self
->
context
=
NULL
;
}
Py_CLEAR
(
self
->
message
);
PyObject_Del
(
self
);
}
//-----------------------------------------------------------------------------
// Error_Str()
// Return a string representation of the error variable.
//-----------------------------------------------------------------------------
static
PyObject
*
Error_Str
(
dm_Error
*
self
// variable to return the string for
)
{
if
(
self
->
message
) {
Py_INCREF
(
self
->
message
);
return
self
->
message
;
}
return
Py_BuildValue
(
"s"
,
""
);
}
//-----------------------------------------------------------------------------
// declaration of members
//-----------------------------------------------------------------------------
static
PyMemberDef
g_ErrorMembers
[]
=
{
{
"code"
,
T_INT
, offsetof(
dm_Error
,
code
),
READONLY
},
{
"offset"
,
T_INT
, offsetof(
dm_Error
,
offset
),
READONLY
},
{
"message"
,
T_OBJECT
, offsetof(
dm_Error
,
message
),
READONLY
},
{
"context"
,
T_STRING
, offsetof(
dm_Error
,
context
),
READONLY
},
{
NULL
}
};
//-----------------------------------------------------------------------------
// declaration of Python type
//-----------------------------------------------------------------------------
PyTypeObject
g_ErrorType
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"dmPython.DmError"
,
// tp_name
sizeof
(
dm_Error
),
// tp_basicsize
0
,
// tp_itemsize
(
destructor
)
Error_Free
,
// tp_dealloc
0
,
// tp_print
0
,
// tp_getattr
0
,
// tp_setattr
0
,
// tp_compare
0
,
// tp_repr
0
,
// tp_as_number
0
,
// tp_as_sequence
0
,
// tp_as_mapping
0
,
// tp_hash
0
,
// tp_call
(
reprfunc
)
Error_Str
,
// tp_str
0
,
// tp_getattro
0
,
// tp_setattro
0
,
// tp_as_buffer
Py_TPFLAGS_DEFAULT
,
// tp_flags
0
,
// tp_doc
0
,
// tp_traverse
0
,
// tp_clear
0
,
// tp_richcompare
0
,
// tp_weaklistoffset
0
,
// tp_iter
0
,
// tp_iternext
0
,
// tp_methods
g_ErrorMembers
,
// tp_members
0
// tp_getset
};
Back
|
FazBrowse Home
|
New Git URL