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

Method getDescDialect1

src/dsql/ExprNodes.cpp:1352–1628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350}
1351
1352void ArithmeticNode::getDescDialect1(thread_db* /*tdbb*/, dsc* desc, dsc& desc1, dsc& desc2)
1353{
1354 USHORT dtype = 0;
1355
1356 switch (blrOp)
1357 {
1358 case blr_add:
1359 case blr_subtract:
1360 {
1361 /* 92/05/29 DAVES - don't understand why this is done for ONLY
1362 dtype_text (eg: not dtype_cstring or dtype_varying) Doesn't
1363 appear to hurt.
1364
1365 94/04/04 DAVES - NOW I understand it! QLI will pass floating
1366 point values to the engine as text. All other numeric constants
1367 it turns into either integers or longs (with scale). */
1368
1369 USHORT dtype1 = desc1.dsc_dtype;
1370 if (dtype1 == dtype_int64)
1371 dtype1 = dtype_double;
1372
1373 USHORT dtype2 = desc2.dsc_dtype;
1374 if (dtype2 == dtype_int64)
1375 dtype2 = dtype_double;
1376
1377 if (dtype1 == dtype_text || dtype2 == dtype_text)
1378 dtype = MAX(MAX(dtype1, dtype2), (UCHAR) DEFAULT_DOUBLE);
1379 else
1380 dtype = MAX(dtype1, dtype2);
1381
1382 switch (dtype)
1383 {
1384 case dtype_short:
1385 desc->dsc_dtype = dtype_long;
1386 desc->dsc_length = sizeof(SLONG);
1387 if (DTYPE_IS_TEXT(desc1.dsc_dtype) || DTYPE_IS_TEXT(desc2.dsc_dtype))
1388 desc->dsc_scale = 0;
1389 else
1390 desc->dsc_scale = MIN(desc1.dsc_scale, desc2.dsc_scale);
1391
1392 nodScale = desc->dsc_scale;
1393 setFixedSubType(desc, desc1, desc2);
1394 desc->dsc_flags = 0;
1395 return;
1396
1397 case dtype_ex_time_tz:
1398 case dtype_ex_timestamp_tz:
1399 fb_assert(false);
1400 ERRD_post(Arg::Gds(isc_expression_eval_err));
1401
1402 case dtype_sql_date:
1403 case dtype_sql_time:
1404 case dtype_sql_time_tz:
1405 if (DTYPE_IS_TEXT(desc1.dsc_dtype) || DTYPE_IS_TEXT(desc2.dsc_dtype))
1406 ERR_post(Arg::Gds(isc_expression_eval_err));
1407 // fall into
1408
1409 case dtype_timestamp:

Callers

nothing calls this directly

Calls 14

DTYPE_IS_TEXTFunction · 0.85
setFixedSubTypeFunction · 0.85
ERRD_postFunction · 0.85
GdsClass · 0.85
DTYPE_IS_DATEFunction · 0.85
couldBeDateFunction · 0.85
isDateAndTimeFunction · 0.85
setDecDescFunction · 0.85
NUMERIC_SCALEFunction · 0.85
DTYPE_IS_NUMERICFunction · 0.85
isTimeMethod · 0.80
isTimeStampMethod · 0.80

Tested by

no test coverage detected