MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / setupTimer

Method setupTimer

src/dsql/DsqlRequests.cpp:102–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102TimeoutTimer* DsqlRequest::setupTimer(thread_db* tdbb)
103{
104 auto request = getRequest();
105
106 if (request)
107 {
108 if (request->hasInternalStatement())
109 return req_timer;
110
111 request->req_timeout = this->req_timeout;
112
113 fb_assert(!request->req_caller);
114 if (request->req_caller)
115 {
116 if (req_timer)
117 req_timer->setup(0, 0);
118 return req_timer;
119 }
120 }
121
122 Database* dbb = tdbb->getDatabase();
123 Attachment* att = tdbb->getAttachment();
124
125 ISC_STATUS toutErr = isc_cfg_stmt_timeout;
126 unsigned int timeOut = dbb->dbb_config->getStatementTimeout() * 1000;
127
128 if (req_timeout)
129 {
130 if (!timeOut || req_timeout < timeOut)
131 {
132 timeOut = req_timeout;
133 toutErr = isc_req_stmt_timeout;
134 }
135 }
136 else
137 {
138 const unsigned int attTout = att->getStatementTimeout();
139
140 if (!timeOut || attTout && attTout < timeOut)
141 {
142 timeOut = attTout;
143 toutErr = isc_att_stmt_timeout;
144 }
145 }
146
147 if (!req_timer && timeOut)
148 {
149 req_timer = FB_NEW TimeoutTimer();
150 fb_assert(request);
151 request->req_timer = this->req_timer;
152 }
153
154 if (req_timer)
155 {
156 req_timer->setup(timeOut, toutErr);
157 req_timer->start();
158 }
159

Callers 1

executeMethod · 0.80

Calls 7

hasInternalStatementMethod · 0.80
getDatabaseMethod · 0.80
TimeoutTimerClass · 0.70
setupMethod · 0.45
getAttachmentMethod · 0.45
getStatementTimeoutMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected