Skip to content

Commit

Permalink
Merge pull request #367 from arvanus/master
Browse files Browse the repository at this point in the history
Bunch of small fixes
  • Loading branch information
arvanus authored Jan 30, 2024
2 parents 717537a + e7533b2 commit 88e7d86
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ The following people also made a significant non-coding contributions:
* Alex Stanciu
* Barbara Del Vecchio

Notice:
Now you can download latest Windows snapshot builds directly from the `Build Flamerobin for Windows` Action

License
---------------------------
FlameRobin code is licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion src/core/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ wxString wrapText(const wxString& text, size_t maxWidth, size_t indent)
if (lastSpace != text.end())
{
size_t width = line.Length();
if (width > maxWidth - indentStr.Length())
if ((width > maxWidth - indentStr.Length()) && (wrapState == none))
{
// remove the last word from this line
line.erase(lastSpace - lineStart, it + 1 - lineStart);
Expand Down
8 changes: 6 additions & 2 deletions src/gui/ExecuteSqlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2495,14 +2495,18 @@ bool ExecuteSqlFrame::execute(wxString sql, const wxString& terminator,
databaseM->getCharsetConverter()));
wxString aliasname(std2wxIdentifier(statementM->ColumnAlias(i),
databaseM->getCharsetConverter()));
log(wxString::Format(_("Field #%02d: %s.%s Alias:%s Type:%s"),
log(wxString::Format(_("Field #%02d: %s.%s Alias:%s Type:%s sqlype: %d subtype: %d len: %d scale: %d"),
i, tablename.c_str(), colname.c_str(), aliasname.c_str(),
IBPPtype2string(
databaseM,
statementM->ColumnType(i),
statementM->ColumnSubtype(i),
statementM->ColumnSize(i),
statementM->ColumnScale(i)).c_str()
statementM->ColumnScale(i)).c_str(),
statementM->ColumnSQLType(i),
statementM->ColumnSubtype(i),
statementM->ColumnSize(i),
statementM->ColumnScale(i)
), ttSql);
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/gui/InsertParametersDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ void InsertParametersDialog::OnOkButtonClick(wxCommandEvent& WXUNUSED(event))
row = (*it)-1;
IBPP::SDT parameterType = statementM->ParameterType(parameterslist.back()); //statementM->ParameterType(row + 1);
int subtype = statementM->ParameterSubtype(parameterslist.back());
int scale = statementM->ParameterScale(parameterslist.back());

if (sel == ioNull)
{
Expand Down Expand Up @@ -780,6 +781,14 @@ void InsertParametersDialog::OnOkButtonClick(wxCommandEvent& WXUNUSED(event))
statementM->Set(row + 1, (int)d1);
break;
case IBPP::SDT::sdLargeint:
if (scale != 0)
{
double d3;
if (!value.ToDouble(&d3))
throw FRError(_("Invalid float numeric value"));
statementM->Set(row + 1, (float)d3);
break;
}
wxLongLong_t d2;
if (!value.ToLongLong(&d2))
throw FRError(_("Invalid large integer value"));
Expand Down
2 changes: 2 additions & 0 deletions src/ibpp/_ibpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ class RowImpl : public IBPP::IRow
const char* ColumnAlias(int);
const char* ColumnTable(int);
IBPP::SDT ColumnType(int);
int ColumnSQLType(int);
int ColumnSubtype(int);
int ColumnSize(int);
int ColumnScale(int);
Expand Down Expand Up @@ -1241,6 +1242,7 @@ class StatementImpl : public IBPP::IStatement
const char* ColumnAlias(int);
const char* ColumnTable(int);
IBPP::SDT ColumnType(int);
int ColumnSQLType(int);
int ColumnSubtype(int);
int ColumnSize(int);
int ColumnScale(int);
Expand Down
1 change: 1 addition & 0 deletions src/ibpp/ibpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ namespace IBPP
virtual const char* ColumnAlias(int) = 0;
virtual const char* ColumnTable(int) = 0;
virtual SDT ColumnType(int) = 0;
virtual int ColumnSQLType(int) = 0;
virtual int ColumnSubtype(int) = 0;
virtual int ColumnSize(int) = 0;
virtual int ColumnScale(int) = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/ibpp/row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,18 @@ const char* RowImpl::ColumnTable(int varnum)
return var->relname;
}

int RowImpl::ColumnSQLType(int varnum)
{
if (mDescrArea == 0)
throw LogicExceptionImpl("Row::ColumnType", _("The row is not initialized."));
if (varnum < 1 || varnum > mDescrArea->sqld)
throw LogicExceptionImpl("Row::ColumnType", _("Variable index out of range."));

IBPP::SDT value;
XSQLVAR* var = &(mDescrArea->sqlvar[varnum - 1]);
return var->sqltype & ~1;
}

IBPP::SDT RowImpl::ColumnType(int varnum)
{
if (mDescrArea == 0)
Expand Down
10 changes: 10 additions & 0 deletions src/ibpp/statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,16 @@ const char* StatementImpl::ColumnTable(int varnum)
return mOutRow->ColumnTable(varnum);
}

int StatementImpl::ColumnSQLType(int varnum)
{
if (mHandle == 0)
throw LogicExceptionImpl("Statement::ColumnType", _("No statement has been prepared."));
if (mOutRow == 0)
throw LogicExceptionImpl("Statement::ColumnType", _("The statement does not return results."));

return mOutRow->ColumnSQLType(varnum);
}

IBPP::SDT StatementImpl::ColumnType(int varnum)
{
if (mHandle == 0)
Expand Down

0 comments on commit 88e7d86

Please sign in to comment.