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

Method match

src/jrd/Coercion.cpp:164–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164bool CoercionRule::match(const dsc* d) const
165{
166 // check for exact match (taking flags into an account)
167 if ((d->dsc_dtype == fromDsc.dsc_dtype) &&
168 ((d->dsc_length == fromDsc.dsc_length) || (!(fromMask & FLD_has_len))) &&
169 ((d->getCharSet() == fromDsc.getCharSet()) || (!(fromMask & FLD_has_chset))) &&
170 ((d->getSubType() == fromDsc.getSubType()) || (!(fromMask & FLD_has_sub))) &&
171 ((d->dsc_scale == fromDsc.dsc_scale) || (!(fromMask & FLD_has_scale))))
172 {
173 return true;
174 }
175
176 // check for inexact datatype match when FLD_has_prec is not set
177 if (!(fromMask & FLD_has_prec))
178 {
179 switch(fromDsc.dsc_dtype)
180 {
181 case dtype_dec64:
182 case dtype_dec128:
183 if (DTYPE_IS_DECFLOAT(d->dsc_dtype))
184 return true;
185 break;
186
187 case dtype_short:
188 case dtype_long:
189 case dtype_int64:
190 case dtype_int128:
191 if (d->isExact() && (fromMask & FLD_has_sub) && (d->dsc_sub_type == fromDsc.dsc_sub_type))
192 return true;
193 break;
194
195 case dtype_timestamp_tz:
196 case dtype_sql_time_tz:
197 if (d->isDateTimeTz())
198 return true;
199 break;
200 }
201 }
202
203 return false;
204}
205
206static const USHORT COMPATIBLE_TEXT = 1;
207static const USHORT COMPATIBLE_INT = 2;

Callers 1

_ParseContinueFunction · 0.45

Calls 5

DTYPE_IS_DECFLOATFunction · 0.85
isExactMethod · 0.80
isDateTimeTzMethod · 0.80
getCharSetMethod · 0.45
getSubTypeMethod · 0.45

Tested by

no test coverage detected