CUBRID Engine  latest
xasl_unpack_info.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include "xasl_unpack_info.hpp"
20 
21 #include "memory_alloc.h"
22 #if defined (SERVER_MODE)
23 #include "thread_entry.hpp"
24 #endif
25 
26 #if !defined(SERVER_MODE)
28 #endif /* !SERVER_MODE */
29 
30 /*
31  * get_xasl_unpack_info_ptr () -
32  * return:
33  */
36 {
37 #if defined(SERVER_MODE)
38  return thread_p->xasl_unpack_info_ptr;
39 #else /* SERVER_MODE */
40  return xasl_Unpack_info;
41 #endif /* SERVER_MODE */
42 }
43 
44 /*
45  * set_xasl_unpack_info_ptr () -
46  * return:
47  * ptr(in) :
48  */
49 void
51 {
52 #if defined (SERVER_MODE)
53  thread_p->xasl_unpack_info_ptr = ptr;
54 #else
55  xasl_Unpack_info = ptr;
56 #endif
57 }
58 
59 /*
60  * free_xasl_unpack_info () -
61  * return:
62  * xasl_unpack_info(in): unpack info returned by stx_map_stream_to_xasl ()
63  *
64  * Note: free the memory used for unpacking the xasl tree.
65  */
66 void
68 {
70 #if defined (SERVER_MODE)
71  if (xasl_unpack_info)
72  {
73  (xasl_unpack_info)->thrd = NULL;
74  }
75 #endif /* SERVER_MODE */
77 }
78 
79 /*
80  * free_unpack_extra_buff () - free additional buffers allocated during
81  * XASL unpacking
82  * return : void
83  * xasl_unpack_info (in) : XASL unpack info
84  */
85 void
87 {
88  if (xasl_unpack_info)
89  {
90  UNPACK_EXTRA_BUF *add_buff = xasl_unpack_info->additional_buffers;
91  UNPACK_EXTRA_BUF *temp = NULL;
92  while (add_buff != NULL)
93  {
94  temp = add_buff->next;
95  db_private_free_and_init (thread_p, add_buff->buff);
96  db_private_free_and_init (thread_p, add_buff);
97  add_buff = temp;
98  }
99  }
100 }
UNPACK_EXTRA_BUF * additional_buffers
XASL_UNPACK_INFO * get_xasl_unpack_info_ptr(THREAD_ENTRY *thread_p)
void THREAD_ENTRY
void free_unpack_extra_buff(THREAD_ENTRY *thread_p, XASL_UNPACK_INFO *xasl_unpack_info)
#define REFPTR(T, name)
Definition: porting.h:1089
#define NULL
Definition: freelistheap.h:34
#define db_private_free_and_init(thrd, ptr)
Definition: memory_alloc.h:141
void free_xasl_unpack_info(THREAD_ENTRY *thread_p, REFPTR(XASL_UNPACK_INFO, xasl_unpack_info))
static XASL_UNPACK_INFO * xasl_Unpack_info
void set_xasl_unpack_info_ptr(THREAD_ENTRY *thread_p, XASL_UNPACK_INFO *ptr)
UNPACK_EXTRA_BUF * next