DBD-DtfSQLmac
view release on metacpan or search on metacpan
// second fractions 'hh:mm:ss.fff'
- DTF_CT_TIMESTAMP # 15 // timestamp type (like string), format: YYYY-MM-DD hh:mm:ss[.fff]
- DTF_CT_DECIMAL # 16 // decimal type
In Perl, these data types -- except the decimal type -- are all scalar types. But internally, Perl
distinguishes between integer (IV), double (NV) and string (PV) scalar types. Thus, there is indeed a
difference in retrieving data with the retrieval type set to DTF_CT_CSTRING or set to DTF_CT_DEFAULT.
However, for calculations with retrieved data, it makes no great difference (except for the decimal type) if
you retrieve a field value as string or as stored in the database with attention to its actual datatype: The
scalars will contain either numbers or strings. In general, conversion from one form to another is transparent,
i.e. happens automatically in Perl. This should be suitable even for the decimal datatype when retrieved as
string, because it is converted to a scalar holding a floating point number in arithmetical operations (although
the accuracy may suffer).
Note (4): If you retrieve data of type decimal, you will get back a *decimal object* in $fieldVal-- see
the section DECIMAL NUMBERS below. This decimal object will be automatically created for you,
i.e. there is no need to create a decimal object in before and pass it to the function. Hint:
When you retrieve data in a loop, use the ref() function
if ref($fieldVal) { ... } else { ... }
blib/lib/DBD/DtfSQLmac.pm view on Meta::CPAN
are not supported at all. (Note that SQL_BIGINT was formerly mapped to SQL_INTEGER, but beginning with version
0.3201 of this module this mapping is no longer provided, since DBI 1.21 omitted SQL_BIGINT.) Likewise, B<any
other> DBI SQL type constant found in more recent versions of the DBI module are not supported at all. You
will get an error message if you specify one of these constants.
B<Please note:> With the DtfSQLmac driver, we always retrieve field values as string. This is done even for field values that have
a decimal (fixed point number) data type, although the underlying Mac::DtfSQL module allows the retrieval as decimal
object for these fields (see the Mac::DtfSQL module documentation for details). Thus, all data you may retrieve from
the database is a scalar in Perl. These scalars will contain either numbers or strings. In general, conversion from
one form to another is transparent, i.e. happens automatically in Perl. Generally, if a string represents a decimal,
it is converted to a scalar holding a floating point number in arithmetical operations. Due to this conversion the
accuracy may suffer. However, in order to avoid this, you are able to create a decimal object, assign it a value
from a string that represents a decimal, perform arithmetical operations with it and then store it back to the
database (see the C<dbi_6_update-decimal.pl> sample script).
See also the section on Placeholders and Bind Values in the DBI documentation for more information.
=item B<bind_param_inout>
Not supported.
blib/lib/Mac/DtfSQL.pm view on Meta::CPAN
// second fractions 'hh:mm:ss.fff'
- DTF_CT_TIMESTAMP # 15 // timestamp type (like string), format: YYYY-MM-DD hh:mm:ss[.fff]
- DTF_CT_DECIMAL # 16 // decimal type
In Perl, these data types -- except the decimal type -- are all scalar types. But internally, Perl
distinguishes between integer (IV), double (NV) and string (PV) scalar types. Thus, there is indeed a
difference in retrieving data with the retrieval type set to DTF_CT_CSTRING or set to DTF_CT_DEFAULT.
However, for calculations with retrieved data, it makes no great difference (except for the decimal type) if
you retrieve a field value as string or as stored in the database with attention to its actual datatype: The
scalars will contain either numbers or strings. In general, conversion from one form to another is transparent,
i.e. happens automatically in Perl. This should be suitable even for the decimal datatype when retrieved as
string, because it is converted to a scalar holding a floating point number in arithmetical operations (although
the accuracy may suffer).
Note (4): If you retrieve data of type decimal, you will get back a *decimal object* in $fieldVal-- see
the section DECIMAL NUMBERS below. This decimal object will be automatically created for you,
i.e. there is no need to create a decimal object in before and pass it to the function. Hint:
When you retrieve data in a loop, use the ref() function
if ref($fieldVal) { ... } else { ... }
lib/DBD/DtfSQLmac.pm view on Meta::CPAN
are not supported at all. (Note that SQL_BIGINT was formerly mapped to SQL_INTEGER, but beginning with version
0.3201 of this module this mapping is no longer provided, since DBI 1.21 omitted SQL_BIGINT.) Likewise, B<any
other> DBI SQL type constant found in more recent versions of the DBI module are not supported at all. You
will get an error message if you specify one of these constants.
B<Please note:> With the DtfSQLmac driver, we always retrieve field values as string. This is done even for field values that have
a decimal (fixed point number) data type, although the underlying Mac::DtfSQL module allows the retrieval as decimal
object for these fields (see the Mac::DtfSQL module documentation for details). Thus, all data you may retrieve from
the database is a scalar in Perl. These scalars will contain either numbers or strings. In general, conversion from
one form to another is transparent, i.e. happens automatically in Perl. Generally, if a string represents a decimal,
it is converted to a scalar holding a floating point number in arithmetical operations. Due to this conversion the
accuracy may suffer. However, in order to avoid this, you are able to create a decimal object, assign it a value
from a string that represents a decimal, perform arithmetical operations with it and then store it back to the
database (see the C<dbi_6_update-decimal.pl> sample script).
See also the section on Placeholders and Bind Values in the DBI documentation for more information.
=item B<bind_param_inout>
Not supported.
( run in 0.364 second using v1.01-cache-2.11-cpan-0a6323c29d9 )