1596 |
# Now we can create an INSERT statement. |
# Now we can create an INSERT statement. |
1597 |
my $dbh = $self->{_dbh}; |
my $dbh = $self->{_dbh}; |
1598 |
my $fixedName = _FixName($fieldTitle); |
my $fixedName = _FixName($fieldTitle); |
1599 |
my $statement = "INSERT INTO $relation ($fixedName) VALUES(?, ?)"; |
my $statement = "INSERT INTO $relation (id, $fixedName) VALUES(?, ?)"; |
1600 |
# Execute the command. |
# Execute the command. |
1601 |
$dbh->SQL($statement, 0, $entityID, $value); |
$dbh->SQL($statement, 0, $entityID, $value); |
1602 |
} |
} |
2064 |
push @retVal, \@rowData; |
push @retVal, \@rowData; |
2065 |
$fetched++; |
$fetched++; |
2066 |
} |
} |
2067 |
|
Trace("$fetched rows returned in GetAll.") if T(SQL => 4); |
2068 |
# Return the resulting list. |
# Return the resulting list. |
2069 |
return @retVal; |
return @retVal; |
2070 |
} |
} |
2071 |
|
|
2072 |
|
=head3 Exists |
2073 |
|
|
2074 |
|
C<< my $found = $sprout->Exists($entityName, $entityID); >> |
2075 |
|
|
2076 |
|
Return TRUE if an entity exists, else FALSE. |
2077 |
|
|
2078 |
|
=over 4 |
2079 |
|
|
2080 |
|
=item entityName |
2081 |
|
|
2082 |
|
Name of the entity type (e.g. C<Feature>) relevant to the existence check. |
2083 |
|
|
2084 |
|
=item entityID |
2085 |
|
|
2086 |
|
ID of the entity instance whose existence is to be checked. |
2087 |
|
|
2088 |
|
=item RETURN |
2089 |
|
|
2090 |
|
Returns TRUE if the entity instance exists, else FALSE. |
2091 |
|
|
2092 |
|
=back |
2093 |
|
|
2094 |
|
=cut |
2095 |
|
#: Return Type $; |
2096 |
|
sub Exists { |
2097 |
|
# Get the parameters. |
2098 |
|
my ($self, $entityName, $entityID) = @_; |
2099 |
|
# Check for the entity instance. |
2100 |
|
Trace("Checking existence of $entityName with ID=$entityID.") if T(4); |
2101 |
|
my $testInstance = $self->GetEntity($entityName, $entityID); |
2102 |
|
# Return an existence indicator. |
2103 |
|
my $retVal = ($testInstance ? 1 : 0); |
2104 |
|
return $retVal; |
2105 |
|
} |
2106 |
|
|
2107 |
=head3 EstimateRowSize |
=head3 EstimateRowSize |
2108 |
|
|
2109 |
C<< my $rowSize = $erdb->EstimateRowSize($relName); >> |
C<< my $rowSize = $erdb->EstimateRowSize($relName); >> |