DBD-DtfSQLmac
view release on metacpan or search on metacpan
#---------------------------------------------------------------------------------------------------------
#
# API & MODULE CONSTANTS
#
#---------------------------------------------------------------------------------------------------------
#
# Various
#
sub DTF_FALSE() { 0 }
sub DTF_TRUE() { 1 }
# NULL or not
sub NULL() { 0 }
sub not_NULL() { 1 }
# NULL handle
sub DTFHANDLE_NULL() { 0 }
#---------------------------------------------------------------------------------------------------------
#
# Some Dimension Constants
#
# max length for column and table names (incl. \0)
sub DTF_MAX_NAME() { 25 }
# max length of user name or password (incl. \0)
sub DTF_MAX_USERPASS() { 17 }
# min and max database file size, in KBytes
sub DTF_MIN_MAXSIZE() { 0x00000800 } # ...KB == 2MB
sub DTF_MAX_MAXSIZE() { 0x001fe000 } # ...KB == 2GB
# max non-blob fieldlength
sub DTF_MAX_FIELDLENGTH() { 4096 }
#---------------------------------------------------------------------------------------------------------
#
# Result Type of curser
#
sub DTF_RT_SEQUENTIAL() { 0 }
sub DTF_RT_RANDOM() { 1 }
#---------------------------------------------------------------------------------------------------------
#
# Connection Flags
#
sub DTF_CF_FILENAME() { 0 } # if set, file name (string)
sub DTF_CF_NETWORK() { 1 } # if set, network connection (string)
sub DTF_CF_FSSPEC() { 2 } # if set, filename Mac OS FSSpec record in FSSpec fmt.
#---------------------------------------------------------------------------------------------------------
#
# Error/Result Codes
#
sub DTF_ERR_OK() { 0 }
sub DTF_ERR_BAD() { 1 }
sub DTF_ERR_FATAL() { 2 }
sub DTF_ERR_OTHER() { 3 }
sub DTF_ERR_BAD_ID() { 4 }
sub DTF_ERR_LOCK() { 5 }
sub DTF_ERR_NO_SEG() { 6 }
sub DTF_ERR_NO_PAGE() { 7 }
sub DTF_ERR_NO_BUFFER() { 8 }
sub DTF_ERR_IO() { 9 }
sub DTF_ERR_FULL() { 10 }
sub DTF_ERR_NO_FILE() { 11 }
sub DTF_ERR_RANGE() { 12 }
sub DTF_ERR_FILE() { 13 }
sub DTF_ERR_MEMORY() { 14 }
sub DTF_ERR_INTEGRITY() { 15 }
sub DTF_ERR_NO_SCAN() { 16 }
sub DTF_ERR_NO_MORE_RECORDS() { 17 }
sub DTF_ERR_BUFFER_FULL() { 18 }
sub DTF_ERR_EXISTS() { 19 }
sub DTF_ERR_DOES_NOT_EXIST() { 20 }
sub DTF_ERR_SERVER() { 21 }
sub DTF_ERR_CLIENT() { 22 }
sub DTF_ERR_SYNC() { 23 }
sub DTF_ERR_NET() { 24 }
sub DTF_ERR_STOPPED() { 25 }
sub DTF_ERR_PASSWORD() { 26 }
sub DTF_ERR_ACCESS() { 27 }
sub DTF_ERR_DIV_BY_ZERO() { 28 }
sub DTF_ERR_CONVERSION() { 29 }
sub DTF_ERR_RESOURCE() { 30 }
sub DTF_ERR_TM_FULL() { 31 }
sub DTF_ERR_VERSION() { 32 }
sub DTF_ERR_LOG_READY() { 33 }
sub DTF_ERR_SEQUENCE() { 34 }
# first user error
sub DTF_ERR_USER() { 64 }
# result class
sub DTF_RC_OTHER() { 0 }
sub DTF_RC_RESULT_AVAILABLE() { 1 }
sub DTF_RC_ROWS_AFFECTED() { 2 }
#---------------------------------------------------------------------------------------------------------
#
# ATTRIBUTES
#
#---------------------------------------------------------------------------------------------------------
# Attribute Types
sub DTF_ATY_LONG() { 0 }
sub DTF_ATY_STRING() { 1 }
sub DTF_ATY_ENUM() { 2 }
#---------------------------------------------------------------------------------------------------------
# Attribute ID convention:
#
# All attribute IDs consist of four bytes. The first byte defines the
# attributes scope (handle type) and data type, the other three are an
# abbreviation of the attribute's name.
#
# H .. attribute (scope all/undefined)
# E .. environment attribute
# C .. connection attribute
# T .. transaction attribute
# R .. result attribute
# L .. column attribute
#
#---------------------------------------------------------------------------------------------------------
# 'invalid' attribute
sub DTF_AT_NONE() { _define_Attribut(ord("\0"), ord("\0"), ord("\0"), ord("\0")) }
#---------------------------------------------------------------------------------------------------------
# global scope attributes
sub DTF_AT_CODEPAGE() { _define_Attribut(ord("H"), ord("C"), ord("P"), ord("g")) }
#---------------------------------------------------------------------------------------------------------
# environment scope attributes
sub DTF_EAT_MESSAGEFILE() { _define_Attribut(ord("E"), ord("M"), ord("s"), ord("F")) }
sub DTF_EAT_RESULTS() { _define_Attribut(ord("E"), ord("R"), ord("e"), ord("s")) }
sub DTF_EAT_RESULTPAGES() { _define_Attribut(ord("E"), ord("R"), ord("e"), ord("P")) }
sub DTF_EAT_LOGLEVEL() { _define_Attribut(ord("E"), ord("L"), ord("L"), ord("v")) }
sub DTF_EAT_LOGFILE() { _define_Attribut(ord("E"), ord("L"), ord("F"), ord("l")) }
sub DTF_EAT_XSFILES() { _define_Attribut(ord("E"), ord("X"), ord("F"), ord("s")) }
sub DTF_EAT_VMTYPE() { _define_Attribut(ord("E"), ord("V"), ord("T"), ord("y")) }
sub DTF_EAT_VMPATH() { _define_Attribut(ord("E"), ord("V"), ord("P"), ord("t")) }
sub DTF_EAT_VMSLOTS() { _define_Attribut(ord("E"), ord("V"), ord("S"), ord("l")) }
sub DTF_EAT_VMFILESLOTS() { _define_Attribut(ord("E"), ord("V"), ord("F"), ord("S")) }
sub DTF_EAT_VMFREEMEM() { _define_Attribut(ord("E"), ord("V"), ord("F"), ord("M")) }
#---------------------------------------------------------------------------------------------------------
# connection scope attributes
sub DTF_CAT_TIMEOUT() { _define_Attribut(ord("C"), ord("T"), ord("i"), ord("O")) }
sub DTF_CAT_RESETADAPTER() { _define_Attribut(ord("C"), ord("R"), ord("A"), ord("d")) }
sub DTF_CAT_REMOVENETNAME() { _define_Attribut(ord("C"), ord("R"), ord("N"), ord("N")) }
sub DTF_CAT_NETSYNCDELAY() { _define_Attribut(ord("C"), ord("N"), ord("S"), ord("D")) }
sub DTF_CAT_TRANSACTIONS() { _define_Attribut(ord("C"), ord("T"), ord("r"), ord("a")) }
sub DTF_CAT_CACHEBUFFERS() { _define_Attribut(ord("C"), ord("B"), ord("u"), ord("f")) }
sub DTF_CAT_PAGEALGO() { _define_Attribut(ord("C"), ord("P"), ord("A"), ord("l")) }
sub DTF_CAT_R4MODE() { _define_Attribut(ord("C"), ord("4"), ord("M"), ord("d")) }
sub DTF_CAT_R4STATE() { _define_Attribut(ord("C"), ord("4"), ord("S"), ord("t")) }
sub DTF_CAT_R4PATH() { _define_Attribut(ord("C"), ord("4"), ord("P"), ord("t")) }
sub DTF_CAT_R4BACKUPPATH() { _define_Attribut(ord("C"), ord("4"), ord("B"), ord("P")) }
sub DTF_CAT_R4LOGFILESIZE() { _define_Attribut(ord("C"), ord("4"), ord("L"), ord("S")) }
sub DTF_CAT_DBTYPE() { _define_Attribut(ord("C"), ord("D"), ord("b"), ord("T")) }
sub DTF_CAT_DBCREATOR() { _define_Attribut(ord("C"), ord("D"), ord("b"), ord("C")) }
sub DTF_CAT_SRVSETUP() { _define_Attribut(ord("C"), ord("S"), ord("s"), ord("t")) }
sub DTF_CAT_AUTORECOVER() { _define_Attribut(ord("C"), ord("A"), ord("R"), ord("c")) }
#---------------------------------------------------------------------------------------------------------
# transaction scope attributes
sub DTF_TAT_AUTOCOMMIT() { _define_Attribut(ord("T"), ord("A"), ord("C"), ord("m")) }
sub DTF_TAT_RESULTTYPE() { _define_Attribut(ord("T"), ord("R"), ord("T"), ord("y")) }
#---------------------------------------------------------------------------------------------------------
# result scope attributes
sub DTF_RAT_TYPE() { _define_Attribut(ord("R"), ord("T"), ord("y"), ord("p")) }
#---------------------------------------------------------------------------------------------------------
# column scope attributes
sub DTF_LAT_NAME() { _define_Attribut(ord("L"), ord("N"), ord("a"), ord("m")) }
sub DTF_LAT_TABLENAME() { _define_Attribut(ord("L"), ord("T"), ord("N"), ord("m")) }
sub DTF_LAT_CTYPE() { _define_Attribut(ord("L"), ord("C"), ord("T"), ord("y")) }
sub DTF_LAT_DEFINITION() { _define_Attribut(ord("L"), ord("D"), ord("e"), ord("f")) }
sub DTF_LAT_SIZE() { _define_Attribut(ord("L"), ord("S"), ord("i"), ord("z")) }
sub DTF_LAT_DISPLAYWIDTH() { _define_Attribut(ord("L"), ord("D"), ord("W"), ord("d")) }
sub DTF_LAT_PRECISION() { _define_Attribut(ord("L"), ord("P"), ord("r"), ord("c")) }
sub DTF_LAT_SCALE() { _define_Attribut(ord("L"), ord("S"), ord("c"), ord("l")) }
#---------------------------------------------------------------------------------------------------------
#
# C data type IDs
#
sub DTF_CT_DEFAULT() { 0 } # dtF/SQL datatype
sub DTF_CT_CHAR() { 1 } # char
sub DTF_CT_UCHAR() { 2 } # unsigned char
sub DTF_CT_SHORT() { 3 } # short
sub DTF_CT_USHORT() { 4 } # unsigned short
sub DTF_CT_LONG() { 5 } # long
sub DTF_CT_ULONG() { 6 } # unsigned long
sub DTF_CT_BOOL() { 7 } # DTFBOOL
sub DTF_CT_DOUBLE() { 8 } # double
sub DTF_CT_CSTRING() { 9 } # null-terminated character string
sub DTF_CT_SQLSTRING() { 10 } # like CSTRING but quoted if necessary
sub DTF_CT_BLOB() { 11 } # array of char
sub DTF_CT_DATE() { 13 } # DTFDATE yyyy-mm-dd\0
sub DTF_CT_TIME() { 14 } # DTFTIME hh:mm:ss\0
sub DTF_CT_TIMESTAMP() { 15 } # DTFTIMESTAMP yyyy-mm-dd hh:mm:ss\0
sub DTF_CT_DECIMAL() { 16 } # DTFDECIMAL
sub DTF_CT_COUNT() { 17 } # (number of DTFCTYPE enum values)
#---------------------------------------------------------------------------------------------------------
#
# dtF/SQL data type IDs
#
sub DTF_DT_NULL() { 0 }
sub DTF_DT_BYTE() { 1 }
sub DTF_DT_WORD() { 2 }
sub DTF_DT_LONGWORD() { 3 }
sub DTF_DT_CHAR() { 4 }
sub DTF_DT_SHORT() { 5 }
sub DTF_DT_LONG() { 6 }
sub DTF_DT_REAL() { 7 }
sub DTF_DT_DECIMAL() { 8 } # total max 16 digits [xxxx xxxx xxxx . xxxx = (16, 4) ]
# min 1 digit ahead of dec. point, 0 fraction digits allowd
sub DTF_DT_SHORTSTRING() { 9 }
sub DTF_DT_BIT() { 10 }
sub DTF_DT_DATE() { 11 } # yyyy-mm-dd
sub DTF_DT_TIME() { 12 } # hh:mm:ss
sub DTF_DT_TIMESTAMP() { 14 } # yyyy-mm-dd hh:mm:ss
sub DTF_DT_COUNT() { 15 }
#---------------------------------------------------------------------------------------------------------
#
# ???
#
sub DTF_INVALID_COUNT() { hex('0xffffffff') }
#---------------------------------------------------------------------------------------------------------
#
# AUTO COMMIT ON / OFF
#
# (example: DtfHdlSetAttribute ($htra, DTF_TAT_AUTOCOMMIT, AUTO_COMMIT_ON); )
sub AUTO_COMMIT_ON() { 'true' }
sub AUTO_COMMIT_OFF() { 'false' }
#---------------------------------------------------------------------------------------------------------
#
# MODULE FUNCTIONS
#
#---------------------------------------------------------------------------------------------------------
# this is the pure Perl version of the dtf_connect sub,
# which has been implemented in C for speed
blib/lib/Mac/DtfSQL.pm view on Meta::CPAN
#---------------------------------------------------------------------------------------------------------
#
# API & MODULE CONSTANTS
#
#---------------------------------------------------------------------------------------------------------
#
# Various
#
sub DTF_FALSE() { 0 }
sub DTF_TRUE() { 1 }
# NULL or not
sub NULL() { 0 }
sub not_NULL() { 1 }
# NULL handle
sub DTFHANDLE_NULL() { 0 }
#---------------------------------------------------------------------------------------------------------
#
# Some Dimension Constants
#
# max length for column and table names (incl. \0)
sub DTF_MAX_NAME() { 25 }
# max length of user name or password (incl. \0)
sub DTF_MAX_USERPASS() { 17 }
# min and max database file size, in KBytes
sub DTF_MIN_MAXSIZE() { 0x00000800 } # ...KB == 2MB
sub DTF_MAX_MAXSIZE() { 0x001fe000 } # ...KB == 2GB
# max non-blob fieldlength
sub DTF_MAX_FIELDLENGTH() { 4096 }
#---------------------------------------------------------------------------------------------------------
#
# Result Type of curser
#
sub DTF_RT_SEQUENTIAL() { 0 }
sub DTF_RT_RANDOM() { 1 }
#---------------------------------------------------------------------------------------------------------
#
# Connection Flags
#
sub DTF_CF_FILENAME() { 0 } # if set, file name (string)
sub DTF_CF_NETWORK() { 1 } # if set, network connection (string)
sub DTF_CF_FSSPEC() { 2 } # if set, filename Mac OS FSSpec record in FSSpec fmt.
#---------------------------------------------------------------------------------------------------------
#
# Error/Result Codes
#
sub DTF_ERR_OK() { 0 }
sub DTF_ERR_BAD() { 1 }
sub DTF_ERR_FATAL() { 2 }
sub DTF_ERR_OTHER() { 3 }
sub DTF_ERR_BAD_ID() { 4 }
sub DTF_ERR_LOCK() { 5 }
sub DTF_ERR_NO_SEG() { 6 }
sub DTF_ERR_NO_PAGE() { 7 }
sub DTF_ERR_NO_BUFFER() { 8 }
sub DTF_ERR_IO() { 9 }
sub DTF_ERR_FULL() { 10 }
sub DTF_ERR_NO_FILE() { 11 }
sub DTF_ERR_RANGE() { 12 }
sub DTF_ERR_FILE() { 13 }
sub DTF_ERR_MEMORY() { 14 }
sub DTF_ERR_INTEGRITY() { 15 }
sub DTF_ERR_NO_SCAN() { 16 }
sub DTF_ERR_NO_MORE_RECORDS() { 17 }
sub DTF_ERR_BUFFER_FULL() { 18 }
sub DTF_ERR_EXISTS() { 19 }
sub DTF_ERR_DOES_NOT_EXIST() { 20 }
sub DTF_ERR_SERVER() { 21 }
sub DTF_ERR_CLIENT() { 22 }
sub DTF_ERR_SYNC() { 23 }
sub DTF_ERR_NET() { 24 }
sub DTF_ERR_STOPPED() { 25 }
sub DTF_ERR_PASSWORD() { 26 }
sub DTF_ERR_ACCESS() { 27 }
sub DTF_ERR_DIV_BY_ZERO() { 28 }
sub DTF_ERR_CONVERSION() { 29 }
sub DTF_ERR_RESOURCE() { 30 }
sub DTF_ERR_TM_FULL() { 31 }
sub DTF_ERR_VERSION() { 32 }
sub DTF_ERR_LOG_READY() { 33 }
sub DTF_ERR_SEQUENCE() { 34 }
# first user error
sub DTF_ERR_USER() { 64 }
# result class
sub DTF_RC_OTHER() { 0 }
sub DTF_RC_RESULT_AVAILABLE() { 1 }
sub DTF_RC_ROWS_AFFECTED() { 2 }
#---------------------------------------------------------------------------------------------------------
#
# ATTRIBUTES
#
#---------------------------------------------------------------------------------------------------------
# Attribute Types
sub DTF_ATY_LONG() { 0 }
sub DTF_ATY_STRING() { 1 }
sub DTF_ATY_ENUM() { 2 }
#---------------------------------------------------------------------------------------------------------
# Attribute ID convention:
#
# All attribute IDs consist of four bytes. The first byte defines the
# attributes scope (handle type) and data type, the other three are an
# abbreviation of the attribute's name.
#
blib/lib/Mac/DtfSQL.pm view on Meta::CPAN
# H .. attribute (scope all/undefined)
# E .. environment attribute
# C .. connection attribute
# T .. transaction attribute
# R .. result attribute
# L .. column attribute
#
#---------------------------------------------------------------------------------------------------------
# 'invalid' attribute
sub DTF_AT_NONE() { _define_Attribut(ord("\0"), ord("\0"), ord("\0"), ord("\0")) }
#---------------------------------------------------------------------------------------------------------
# global scope attributes
sub DTF_AT_CODEPAGE() { _define_Attribut(ord("H"), ord("C"), ord("P"), ord("g")) }
#---------------------------------------------------------------------------------------------------------
# environment scope attributes
sub DTF_EAT_MESSAGEFILE() { _define_Attribut(ord("E"), ord("M"), ord("s"), ord("F")) }
sub DTF_EAT_RESULTS() { _define_Attribut(ord("E"), ord("R"), ord("e"), ord("s")) }
sub DTF_EAT_RESULTPAGES() { _define_Attribut(ord("E"), ord("R"), ord("e"), ord("P")) }
sub DTF_EAT_LOGLEVEL() { _define_Attribut(ord("E"), ord("L"), ord("L"), ord("v")) }
sub DTF_EAT_LOGFILE() { _define_Attribut(ord("E"), ord("L"), ord("F"), ord("l")) }
sub DTF_EAT_XSFILES() { _define_Attribut(ord("E"), ord("X"), ord("F"), ord("s")) }
sub DTF_EAT_VMTYPE() { _define_Attribut(ord("E"), ord("V"), ord("T"), ord("y")) }
sub DTF_EAT_VMPATH() { _define_Attribut(ord("E"), ord("V"), ord("P"), ord("t")) }
sub DTF_EAT_VMSLOTS() { _define_Attribut(ord("E"), ord("V"), ord("S"), ord("l")) }
sub DTF_EAT_VMFILESLOTS() { _define_Attribut(ord("E"), ord("V"), ord("F"), ord("S")) }
sub DTF_EAT_VMFREEMEM() { _define_Attribut(ord("E"), ord("V"), ord("F"), ord("M")) }
#---------------------------------------------------------------------------------------------------------
# connection scope attributes
sub DTF_CAT_TIMEOUT() { _define_Attribut(ord("C"), ord("T"), ord("i"), ord("O")) }
sub DTF_CAT_RESETADAPTER() { _define_Attribut(ord("C"), ord("R"), ord("A"), ord("d")) }
sub DTF_CAT_REMOVENETNAME() { _define_Attribut(ord("C"), ord("R"), ord("N"), ord("N")) }
sub DTF_CAT_NETSYNCDELAY() { _define_Attribut(ord("C"), ord("N"), ord("S"), ord("D")) }
sub DTF_CAT_TRANSACTIONS() { _define_Attribut(ord("C"), ord("T"), ord("r"), ord("a")) }
sub DTF_CAT_CACHEBUFFERS() { _define_Attribut(ord("C"), ord("B"), ord("u"), ord("f")) }
sub DTF_CAT_PAGEALGO() { _define_Attribut(ord("C"), ord("P"), ord("A"), ord("l")) }
sub DTF_CAT_R4MODE() { _define_Attribut(ord("C"), ord("4"), ord("M"), ord("d")) }
sub DTF_CAT_R4STATE() { _define_Attribut(ord("C"), ord("4"), ord("S"), ord("t")) }
sub DTF_CAT_R4PATH() { _define_Attribut(ord("C"), ord("4"), ord("P"), ord("t")) }
sub DTF_CAT_R4BACKUPPATH() { _define_Attribut(ord("C"), ord("4"), ord("B"), ord("P")) }
sub DTF_CAT_R4LOGFILESIZE() { _define_Attribut(ord("C"), ord("4"), ord("L"), ord("S")) }
sub DTF_CAT_DBTYPE() { _define_Attribut(ord("C"), ord("D"), ord("b"), ord("T")) }
sub DTF_CAT_DBCREATOR() { _define_Attribut(ord("C"), ord("D"), ord("b"), ord("C")) }
sub DTF_CAT_SRVSETUP() { _define_Attribut(ord("C"), ord("S"), ord("s"), ord("t")) }
sub DTF_CAT_AUTORECOVER() { _define_Attribut(ord("C"), ord("A"), ord("R"), ord("c")) }
#---------------------------------------------------------------------------------------------------------
# transaction scope attributes
sub DTF_TAT_AUTOCOMMIT() { _define_Attribut(ord("T"), ord("A"), ord("C"), ord("m")) }
sub DTF_TAT_RESULTTYPE() { _define_Attribut(ord("T"), ord("R"), ord("T"), ord("y")) }
#---------------------------------------------------------------------------------------------------------
# result scope attributes
sub DTF_RAT_TYPE() { _define_Attribut(ord("R"), ord("T"), ord("y"), ord("p")) }
#---------------------------------------------------------------------------------------------------------
# column scope attributes
sub DTF_LAT_NAME() { _define_Attribut(ord("L"), ord("N"), ord("a"), ord("m")) }
sub DTF_LAT_TABLENAME() { _define_Attribut(ord("L"), ord("T"), ord("N"), ord("m")) }
sub DTF_LAT_CTYPE() { _define_Attribut(ord("L"), ord("C"), ord("T"), ord("y")) }
sub DTF_LAT_DEFINITION() { _define_Attribut(ord("L"), ord("D"), ord("e"), ord("f")) }
sub DTF_LAT_SIZE() { _define_Attribut(ord("L"), ord("S"), ord("i"), ord("z")) }
sub DTF_LAT_DISPLAYWIDTH() { _define_Attribut(ord("L"), ord("D"), ord("W"), ord("d")) }
sub DTF_LAT_PRECISION() { _define_Attribut(ord("L"), ord("P"), ord("r"), ord("c")) }
sub DTF_LAT_SCALE() { _define_Attribut(ord("L"), ord("S"), ord("c"), ord("l")) }
#---------------------------------------------------------------------------------------------------------
#
# C data type IDs
#
sub DTF_CT_DEFAULT() { 0 } # dtF/SQL datatype
sub DTF_CT_CHAR() { 1 } # char
sub DTF_CT_UCHAR() { 2 } # unsigned char
sub DTF_CT_SHORT() { 3 } # short
sub DTF_CT_USHORT() { 4 } # unsigned short
sub DTF_CT_LONG() { 5 } # long
sub DTF_CT_ULONG() { 6 } # unsigned long
sub DTF_CT_BOOL() { 7 } # DTFBOOL
sub DTF_CT_DOUBLE() { 8 } # double
sub DTF_CT_CSTRING() { 9 } # null-terminated character string
sub DTF_CT_SQLSTRING() { 10 } # like CSTRING but quoted if necessary
sub DTF_CT_BLOB() { 11 } # array of char
sub DTF_CT_DATE() { 13 } # DTFDATE yyyy-mm-dd\0
sub DTF_CT_TIME() { 14 } # DTFTIME hh:mm:ss\0
sub DTF_CT_TIMESTAMP() { 15 } # DTFTIMESTAMP yyyy-mm-dd hh:mm:ss\0
sub DTF_CT_DECIMAL() { 16 } # DTFDECIMAL
sub DTF_CT_COUNT() { 17 } # (number of DTFCTYPE enum values)
#---------------------------------------------------------------------------------------------------------
#
# dtF/SQL data type IDs
#
sub DTF_DT_NULL() { 0 }
sub DTF_DT_BYTE() { 1 }
sub DTF_DT_WORD() { 2 }
sub DTF_DT_LONGWORD() { 3 }
sub DTF_DT_CHAR() { 4 }
sub DTF_DT_SHORT() { 5 }
sub DTF_DT_LONG() { 6 }
sub DTF_DT_REAL() { 7 }
sub DTF_DT_DECIMAL() { 8 } # total max 16 digits [xxxx xxxx xxxx . xxxx = (16, 4) ]
# min 1 digit ahead of dec. point, 0 fraction digits allowd
sub DTF_DT_SHORTSTRING() { 9 }
sub DTF_DT_BIT() { 10 }
sub DTF_DT_DATE() { 11 } # yyyy-mm-dd
sub DTF_DT_TIME() { 12 } # hh:mm:ss
sub DTF_DT_TIMESTAMP() { 14 } # yyyy-mm-dd hh:mm:ss
sub DTF_DT_COUNT() { 15 }
#---------------------------------------------------------------------------------------------------------
#
# ???
#
sub DTF_INVALID_COUNT() { hex('0xffffffff') }
#---------------------------------------------------------------------------------------------------------
#
# AUTO COMMIT ON / OFF
#
# (example: DtfHdlSetAttribute ($htra, DTF_TAT_AUTOCOMMIT, AUTO_COMMIT_ON); )
sub AUTO_COMMIT_ON() { 'true' }
sub AUTO_COMMIT_OFF() { 'false' }
#---------------------------------------------------------------------------------------------------------
#
# MODULE FUNCTIONS
#
#---------------------------------------------------------------------------------------------------------
# this is the pure Perl version of the dtf_connect sub,
# which has been implemented in C for speed
t/53numrows.t view on Meta::CPAN
# Include lib.pl
#
$file = "lib.pl";
do $file;
if ($@) {
print "Error while executing lib.pl: $@\n";
exit 10;
}
sub TrueRows($) {
my ($sth) = @_;
my $count = 0;
while ($sth->fetchrow_arrayref) {
++$count;
}
$count;
}
#
t/61commit.t view on Meta::CPAN
}
use vars qw($gotWarning);
sub CatchWarning ($) {
$gotWarning = 1;
}
sub NumRows($$$) {
my($dbh, $table, $num) = @_;
my($sth, $got);
if (!($sth = $dbh->prepare("SELECT * FROM $table"))) {
return "Failed to prepare: err " . $dbh->err . ", errstr "
. $dbh->errstr;
}
if (!$sth->execute) {
return "Failed to execute: err " . $dbh->err . ", errstr "
. $dbh->errstr;
$rc ||= 0;
$err ||= '';
print "Test $::numTests: DBI error $rc, $err\n";
}
#
# This function generates a list of tables associated to a
# given DSN. Highly DBMS specific, EDIT THIS!
#
sub ListTables(@) {
my($dbh) = shift;
my(@tables);
@tables = $dbh->tables;
if ($dbh->errstr) {
die "Cannot create table list: " . $dbh->errstr;
}
@tables;
}
( run in 0.871 second using v1.01-cache-2.11-cpan-65fba6d93b7 )