Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions fbcopy/fbcopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ void FBCopy::copyGeneratorValues(const std::string& gfrom, const std::string& gt
st2->Prepare("SET GENERATOR "+gto+" TO "+std::string(tbuf1));
st2->Execute();
tr1->Commit();
tr2->Commit();
}

void FBCopy::compareGeneratorValues(const std::string& gfrom, const std::string& gto)
Expand Down Expand Up @@ -958,10 +959,19 @@ std::string FBCopy::getDatatype(IBPP::Statement& st1, std::string table, std::st
if (!st1->IsNull(6) && not_nulls)
null_flag = " NOT NULL";

std::string default_source;
if (!st1->IsNull(7) && not_nulls) {
st1->Get(7, default_source);
}
else
default_source = "";

std::ostringstream retval; // this will be returned
if (datatype == 27 && scale < 0)
{
retval << "Numeric(15," << -scale << ")" << null_flag;
retval << "Numeric(15," << -scale << ")";
retval << " " << default_source << " ";
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential issue: default_source may be empty, resulting in extra spaces in the output (e.g., 'Numeric(15,2) NOT NULL'). Consider conditionally appending default_source only when it's non-empty, or handle the spacing logic more carefully to avoid double spaces.

Copilot uses AI. Check for mistakes.
retval << null_flag;
Comment on lines +973 to +974
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses tabs instead of spaces. The codebase consistently uses spaces for indentation (4 spaces per level). Replace the leading tab with 8 spaces to match surrounding code.

Suggested change
retval << " " << default_source << " ";
retval << null_flag;
retval << " " << default_source << " ";
retval << null_flag;

Copilot uses AI. Check for mistakes.
Comment on lines +973 to +974
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses tabs instead of spaces. The codebase consistently uses spaces for indentation (4 spaces per level). Replace the leading tab with 8 spaces to match surrounding code.

Suggested change
retval << " " << default_source << " ";
retval << null_flag;
retval << " " << default_source << " ";
retval << null_flag;

Copilot uses AI. Check for mistakes.
return retval.str();
}

Expand All @@ -976,6 +986,8 @@ std::string FBCopy::getDatatype(IBPP::Statement& st1, std::string table, std::st
retval << "Integer";
else
retval << "Numeric(18,0)";

retval << " " << default_source << " ";
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses tabs instead of spaces. The codebase consistently uses spaces for indentation (4 spaces per level). Replace the leading tabs with 12 spaces to match the expected indentation level.

Suggested change
retval << " " << default_source << " ";
retval << " " << default_source << " ";

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential issue: default_source may be empty, resulting in extra spaces in the output (e.g., 'Integer NOT NULL'). Consider conditionally appending default_source only when it's non-empty, or handle the spacing logic more carefully to avoid double spaces.

Copilot uses AI. Check for mistakes.
retval << null_flag;
return retval.str();
}
Expand All @@ -986,7 +998,10 @@ std::string FBCopy::getDatatype(IBPP::Statement& st1, std::string table, std::st
retval << 18;
else
retval << precision;
retval << "," << -scale << ")" << null_flag;
retval << "," << -scale << ")";

retval << " " << default_source << " ";
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential issue: default_source may be empty, resulting in extra spaces in the output (e.g., 'Decimal(18,2) NOT NULL'). Consider conditionally appending default_source only when it's non-empty, or handle the spacing logic more carefully to avoid double spaces.

Copilot uses AI. Check for mistakes.
retval << null_flag;
Comment on lines +1003 to +1004
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses tabs instead of spaces. The codebase consistently uses spaces for indentation (4 spaces per level). Replace the leading tabs with 12 spaces to match the expected indentation level.

Suggested change
retval << " " << default_source << " ";
retval << null_flag;
retval << " " << default_source << " ";
retval << null_flag;

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses tabs instead of spaces. The codebase consistently uses spaces for indentation (4 spaces per level). Replace the leading tabs with 16 spaces to match the expected indentation level.

Suggested change
retval << null_flag;
retval << null_flag;

Copilot uses AI. Check for mistakes.
return retval.str();
}
}
Expand Down Expand Up @@ -1014,6 +1029,8 @@ std::string FBCopy::getDatatype(IBPP::Statement& st1, std::string table, std::st
retval << "(" << length << ")";
if (datatype == 261) // blob
retval << " sub_type " << subtype;

retval << " " << default_source << " ";
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential issue: default_source may be empty, resulting in extra spaces in the output (e.g., 'Varchar(50) NOT NULL'). Consider conditionally appending default_source only when it's non-empty, or handle the spacing logic more carefully to avoid double spaces. A better approach would be: if (!default_source.empty()) retval << ' ' << default_source;

Copilot uses AI. Check for mistakes.
retval << null_flag;
return retval.str();
}
Expand Down Expand Up @@ -1562,7 +1579,7 @@ void FBCopy::compareTable(std::string table, IBPP::Statement& st1, IBPP::Stateme
IBPP::Statement st3 = IBPP::StatementFactory(src, tr1);
st3->Prepare(
"select t.rdb$type, f.rdb$field_sub_type, f.rdb$field_length,"
"f.rdb$field_precision, f.rdb$field_scale, r.rdb$null_flag "
"f.rdb$field_precision, f.rdb$field_scale, r.rdb$null_flag, r.RDB$DEFAULT_SOURCE "
"from rdb$fields f "
"join rdb$relation_fields r on f.rdb$field_name=r.rdb$field_source "
"join rdb$types t on f.rdb$field_type=t.rdb$type "
Expand Down