sub new { my ($parent, $type, $args) = @_; my ($self) = {}; bless ($self); foreach my $table ($parent->{dbh}->tables()) { if ($table eq $type); $self->{type} = $type; last; }; }; return undef unless (defined($self->{type})); print STDOUT "new - Creating new object of type '", $self->{type}, "'\n" if ($parent->{debug}); my ($sth) = $parent->{dbh}->prepare("select * from ".$self->{type}); $sth->execute; for (my $index = 0; $index < $sth->{NUM_OF_FIELDS}; $index++) { $self->{data}->{$sth->{NAME_lc}->[$index]} = (defined($$args{$sth->{NAME_lc}->[$index]})) ? $$args{$sth->{NAME_lc}->[$index]} : undef; }; return ($self); }; #### SQL_CHAR 1 SQL_NUMERIC 2 SQL_DECIMAL 3 SQL_INTEGER 4 SQL_SMALLINT 5 SQL_FLOAT 6 SQL_REAL 7 SQL_DOUBLE 8 SQL_DATE 9 SQL_TIME 10 SQL_TIMESTAMP 11 SQL_VARCHAR 12 SQL_LONGVARCHAR -1 SQL_BINARY -2 SQL_VARBINARY -3 SQL_LONGVARBINARY -4 SQL_BIGINT -5 SQL_TINYINT -6 SQL_BIT -7 SQL_WCHAR -8 SQL_WVARCHAR -9 SQL_WLONGVARCHAR -10