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

Function CVT_move_common

src/common/cvt.cpp:1638–2195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1636
1637
1638void CVT_move_common(const dsc* from, dsc* to, DecimalStatus decSt, Callbacks* cb)
1639{
1640/**************************************
1641 *
1642 * C V T _ m o v e _ c o m m o n
1643 *
1644 **************************************
1645 *
1646 * Functional description
1647 * Move (and possible convert) something to something else.
1648 *
1649 **************************************/
1650 ULONG length = from->dsc_length;
1651 UCHAR* p = to->dsc_address;
1652 const UCHAR* q = from->dsc_address;
1653
1654 // If the datatypes and lengths are identical, just move the
1655 // stuff byte by byte. Although this may seem slower than
1656 // optimal, it would cost more to find the fast move than the
1657 // fast move would gain.
1658
1659 if (DSC_EQUIV(from, to, false))
1660 {
1661 if (length) {
1662 memcpy(p, q, length);
1663 }
1664 return;
1665 }
1666
1667 // Special optimization case: RDB$DB_KEY is binary compatible with CHAR(8) OCTETS
1668
1669 if ((from->dsc_dtype == dtype_text &&
1670 to->dsc_dtype == dtype_dbkey &&
1671 from->dsc_ttype() == ttype_binary &&
1672 from->dsc_length == to->dsc_length) ||
1673 (to->dsc_dtype == dtype_text &&
1674 from->dsc_dtype == dtype_dbkey &&
1675 to->dsc_ttype() == ttype_binary &&
1676 from->dsc_length == to->dsc_length))
1677 {
1678 memcpy(p, q, length);
1679 return;
1680 }
1681
1682 // Do data type by data type conversions. Not all are supported,
1683 // and some will drop out for additional handling.
1684
1685 dsc d;
1686 switch (to->dsc_dtype)
1687 {
1688 case dtype_timestamp:
1689 switch (from->dsc_dtype)
1690 {
1691 case dtype_varying:
1692 case dtype_cstring:
1693 case dtype_text:
1694 {
1695 ISC_TIMESTAMP_TZ date;

Callers 9

CVT_moveFunction · 0.85
putFieldMethod · 0.85
float_to_textFunction · 0.85
decimal_float_to_textFunction · 0.85
int128_to_textFunction · 0.85
integer_to_textFunction · 0.85
datetime_to_textFunction · 0.85
CVT_moveFunction · 0.85

Calls 15

DSC_EQUIVFunction · 0.85
CVT_string_to_datetimeFunction · 0.85
CVT_conversion_errorFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
TEXT_LENFunction · 0.85
ULONGEnum · 0.85
integer_to_textFunction · 0.85
int128_to_textFunction · 0.85
float_to_textFunction · 0.85
decimal_float_to_textFunction · 0.85

Tested by

no test coverage detected