Exemple #1
0
function formatSqlSetNumericValue($columnName, $stringValue, $addComa)
{
    $formattedValue = $columnName;
    $formattedValue .= "=";
    $formattedValue .= formatSqlNumericValue($stringValue, $addComa);
    return $formattedValue;
}
function generateHarvestListByHuntDetailsId($huntDetailsId)
{
    $sql = "SELECT *";
    $sql .= " FROM hunt_count_ver";
    $sql .= " WHERE hunt_details_id=";
    $sql .= formatSqlNumericValue($huntDetailsId, false);
    return $sql;
}
function generateHuntCountReportInsertSql($huntReportId, $huntCount)
{
    $sql = "INSERT ";
    $sql .= "INTO hunt_count_report ";
    $sql .= "(hunt_id, species_id, species_count, created) ";
    $sql .= "VALUES (";
    $sql .= formatSqlNumericValue($huntReportId, true);
    $sql .= formatSqlStringValue($huntCount->getSpeciesId(), true);
    $sql .= formatSqlNumericValue($huntCount->getCount(), true);
    $sql .= formatSqlDateValue($huntCount->getCreated(), false);
    $sql .= ")";
    return $sql;
}
function generateHuntDetailsByIdSql($huntDetailsId)
{
    $sql = "SELECT * ";
    $sql .= "FROM hunt_details_ver ";
    $sql .= "WHERE id = ";
    $sql .= formatSqlNumericValue($huntDetailsId, false);
    return $sql;
}
function generateHuntIdSql($hunt)
{
    $sql = "SELECT id ";
    $sql .= "FROM hunt_ver ";
    $sql .= "WHERE hunter_id = ";
    $sql .= formatSqlNumericValue($hunt->getHunterId(), false);
    $sql .= " AND created = ";
    $sql .= formatSqlDateValue($hunt->getCreated(), false);
    return $sql;
}
function generateHuntReportIdSql($huntReport)
{
    $sql = "SELECT id ";
    $sql .= "FROM hunt_report ";
    $sql .= " WHERE status = ";
    $sql .= formatSqlStringValue($huntReport->getStatus(), false);
    $sql .= " AND hunter_id = ";
    $sql .= formatSqlNumericValue($huntReport->getHunterId(), false);
    $sql .= " AND hunter_count = ";
    $sql .= formatSqlNumericValue($huntReport->getHunterCount(), false);
    $sql .= " AND hunt_date = ";
    $sql .= formatSqlDateValue($huntReport->getHuntDate(), false);
    $sql .= " AND hunt_hours = ";
    $sql .= formatSqlNumericValue($huntReport->getHuntHours(), false);
    $sql .= " AND car_count = ";
    $sql .= formatSqlNumericValue($huntReport->getCarCount(), false);
    $sql .= " AND blind_id = ";
    $sql .= formatSqlNumericValue($huntReport->getBlindId(), false);
    $sql .= " AND area_id = ";
    $sql .= formatSqlNumericValue($huntReport->getAreaId(), false);
    $sql .= " AND is_multi_blind = ";
    $sql .= formatSqlBooleanValue($huntReport->isMultiBlind(), false);
    $sql .= " AND is_jump_shoot = ";
    $sql .= formatSqlBooleanValue($huntReport->isJumpShoot(), false);
    $sql .= " AND is_bag_checked = ";
    $sql .= formatSqlBooleanValue($huntReport->isBagChecked(), false);
    $sql .= " AND created = ";
    $sql .= formatSqlDateValue($huntReport->getCreated(), false);
    return $sql;
}
function generateBCSpeciesInsertSql($oneSpecies, $birdGroupId, $speciesSeq)
{
    $insertSql = "";
    $insertSql .= "INSERT INTO bc_species (bird_group_id, bc_species_id, bc_harvest_count, bc_species_seq, bc_created, bc_modified) VALUES(";
    $insertSql .= formatSqlNumericValue($birdGroupId, true);
    $insertSql .= formatSqlStringValue($oneSpecies->getSpeciesId(), true);
    $insertSql .= formatSqlStringValue($oneSpecies->getHarvestCount(), true);
    $insertSql .= formatSqlNumericValue($speciesSeq, true);
    $insertSql .= formatSqlStringValue(getNow(), true);
    $insertSql .= formatSqlStringValue(getNow(), false);
    $insertSql .= ")";
    return $insertSql;
}