Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change DLL load, new CI for windows, fix Function comments #335

Merged
merged 11 commits into from
Oct 16, 2023
80 changes: 80 additions & 0 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build Flamerobin for Windows

env:
wx-tag-version: v3.2.2.1

on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]

jobs:
build:
runs-on: windows-latest
steps:

- uses: actions/checkout@v3

- name: wxWidget cache
id: cache-wxwidget
uses: actions/cache@v3
with:
path: |
wxWidgets
key: ${{ runner.os }}-wxwidgets-${{env.wx-tag-version}}
restore-keys: ${{ runner.os }}-wxwidgets-${{env.wx-tag-version}}

- if: ${{ steps.cache-wxwidget.outputs.cache-hit != 'true' }}
name: clone wxWidgets
run: git clone --recursive --branch ${{env.wx-tag-version}} --depth 1 https://github.com/wxWidgets/wxWidgets.git

- if: ${{ steps.cache-wxwidget.outputs.cache-hit != 'true' }}
name: replace /MD for /MT
run:
$xmls = (Get-ChildItem -Path "wxWidgets\build\msw" -Recurse -Filter *.vcxproj).FullName ;
foreach ($xml in $xmls) {
echo $xml;
(Get-Content $xml).replace("MultiThreadedDebugDLL", "MultiThreadedDebug") | Set-Content $xml ;
(Get-Content $xml).replace("MultiThreadedDLL", "MultiThreaded") | Set-Content $xml
}

- if: ${{ steps.cache-wxwidget.outputs.cache-hit != 'true' }}
name: Build wxWidgets x86
shell: cmd
run: |
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && msbuild.exe wxWidgets\build\msw\wx_vc17.sln /t:Build /p:Configuration=Release /p:Platform=Win32

- if: ${{ steps.cache-wxwidget.outputs.cache-hit != 'true' }}
name: Build wxWidgets x64
shell: cmd
run: |
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && msbuild.exe wxWidgets\build\msw\wx_vc17.sln /t:Build /p:Configuration=Release /p:Platform=x64

- name: Generate CMake x86 project
run: cmake -S .\ -B .\Build32 -A Win32 -DWXDIR=wxWidgets

- name: Generate CMake x64 project
run: cmake -S .\ -B .\Build64 -A x64 -DWXDIR=wxWidgets

- name: Build Flamerobin x86
run: >
cmake --build .\Build32 --config Release -j 8

- name: Build Flamerobin x64
run: >
cmake --build .\Build64 --config Release -j 8

- name: Innosetup
run: >
ISCC.exe install\win32\FlameRobinSetup.iss

- name: Innosetup64
run: >
ISCC.exe install\win32\FlameRobinSetup64.iss

- name: Upload installer
uses: actions/upload-artifact@main
with:
name: flamerobin-instaler
path: install/win32/output/flamerobin-*.exe
12 changes: 9 additions & 3 deletions conf-defs/fr_settings.confdef
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@
</setting>
</enables>
</setting>
<setting type="file">
<caption>Library file name:</caption>
<setting type="file" platform="win" arch="x86">
<caption>Library x86 file name:</caption>
<description>FbClient.dll or gds32.dll </description>
<key>x86LibraryFile</key>
</setting>
<setting type="file" platform="win" arch="x64">
<caption>Library x64 file name:</caption>
<description>FbClient.dll or gds32.dll </description>
<key>LibraryFile</key>
<key>x64LibraryFile</key>
</setting>


<!--
<setting type="checkbox">
Expand Down
19 changes: 19 additions & 0 deletions docs/fr_whatsnew.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@
http://www.flamerobin.org/bugs.php or https://github.com/mariuz/flamerobin/issues</font><br>
<br><br>
<!-- *********************** section starts here ************************ -->
<font size=+2>Changes in FlameRobin 0.9.9 and 0.9.10</font><br>
<br><br>
<font size=+1 color="#AA0000"><B>Enhancements and Bug fixes</B></font><br>
<br>
- New theme selector<br>
- New statistics detail per table<br>
- Changed priority of DLL loading<br>
- Separate per architeture the library selector configuration in View->Preferences. If you used this before you'll need to reconfigurate per arch version<br>
- New CI module, will generate automatically windows installers for x86 and x64<br>
- Many other small fixes, see commit history for more details :)<br>
<br>
For more info please read commit history log<br>
<br>
<br>
<br>
<br>
<br>
<!-- ***************************** section ends here ******************* -->
<!-- *********************** section starts here ************************ -->
<font size=+2>Changes in FlameRobin 0.9.4 ALPHA 10</font><br>
<br><br>
<font size=+1 color="#AA0000"><B>Enhancements and Bug fixes</B></font><br>
Expand Down
9 changes: 5 additions & 4 deletions install/win32/FlameRobinSetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription
[Files]
#ifdef DEBUG
#ifdef X64VERSION
Source: ..\..\vcud\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode
Source: ..\..\build64\Debug\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode
#else
Source: ..\..\vcud\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: ..\..\build32\Debug\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode
#endif
#else
#ifdef X64VERSION
Source: ..\..\vcu\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode
Source: ..\..\build64\Release\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: Is64BitInstallMode
#else
Source: ..\..\vcu\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: ..\..\build32\Release\flamerobin.exe; DestDir: {app}; Flags: ignoreversion; Check: not Is64BitInstallMode
#endif
#endif
Source: ..\..\docs\*.*; Excludes: flamerobin.1; DestDir: {app}\docs; Flags: ignoreversion
Expand All @@ -110,6 +110,7 @@ Source: ..\..\code-templates\*.*; DestDir: {app}\code-templates; Flags: ignoreve
Source: ..\..\html-templates\*.*; DestDir: {app}\html-templates; Flags: ignoreversion
Source: ..\..\sys-templates\*.*; DestDir: {app}\sys-templates; Flags: ignoreversion
Source: ..\..\xml-styles\*.*; DestDir: {app}\xml-styles; Flags: ignoreversion
;Source: ..\..\xml-styles\*.*; DestDir: {localappdata}\flamerobin\xml-styles; Flags: onlyifdoesntexist
#ifndef X64VERSION
;Source: ..\..\res\system32\msvcr71.dll; DestDir: {app}
;Source: ..\..\res\system32\msvcp71.dll; DestDir: {app}
Expand Down
14 changes: 13 additions & 1 deletion src/frutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "metadata/column.h"
#include "metadata/relation.h"
#include "metadata/server.h"
#include "config/Config.h"

void adjustControlsMinWidth(std::list<wxWindow*> controls)
{
Expand Down Expand Up @@ -199,7 +200,7 @@ bool getService(Server* s, IBPP::Service& svc, ProgressIndicator* p,
try
{
svc = IBPP::ServiceFactory(wx2std(s->getConnectionString()),
wx2std(username), wx2std(password), wx2std(""), wx2std(""));
wx2std(username), wx2std(password), wx2std(""), wx2std(""), wx2std(getClientLibrary()));
svc->Connect();
// exception might be thrown. If not, we store the credentials:
if (sysdba || username.Upper() == "SYSDBA")
Expand All @@ -216,3 +217,14 @@ bool getService(Server* s, IBPP::Service& svc, ProgressIndicator* p,
}
return true;
}

wxString getClientLibrary()
{
/*Todo: Implement FB library per conexion */
#if defined(_WIN64)
return config().get("x64LibraryFile", wxString(""));
#else
return config().get("x86LibraryFile", wxString(""));
#endif

}
2 changes: 2 additions & 0 deletions src/frutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ bool connectDatabase(Database *db, wxWindow* parent,
bool getService(Server* s, IBPP::Service& svc, ProgressIndicator* p,
bool sysdba);

wxString getClientLibrary();

#endif // FRUTILS_H
2 changes: 1 addition & 1 deletion src/gui/InsertParametersDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ void InsertParametersDialog::OnOkButtonClick(wxCommandEvent& WXUNUSED(event))
//preloadSpecialColumns();

swWaitForParameterInputTime.Pause();
int resumedRow = 0;
size_t resumedRow = 0;
parameterSaveList.clear();
parameterSaveListOptionNull.clear();
for (resumedRow = 0; resumedRow < statementM->ParametersByName().size(); ++resumedRow)
Expand Down
26 changes: 24 additions & 2 deletions src/gui/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,19 @@ wxString getPlatformName()
#endif
}

wxString getPlatformArchitecture()
{
#if defined(_WIN64)
return "x64";
#else
return "x86";
#endif
}

static void processPlatformAttribute(wxXmlNode *node)
{
wxString s;
bool isok;
bool isok, isokarch;

wxXmlNode *c = node->GetChildren();
while (c)
Expand All @@ -107,8 +116,21 @@ static void processPlatformAttribute(wxXmlNode *node)
isok = true;
}
}
isokarch = false;
if (!c->GetAttribute("arch", &s))
isokarch = true;
else
{
wxStringTokenizer tkn(s, " |");

while (!isokarch && tkn.HasMoreTokens())
{
if (tkn.GetNextToken().compare(getPlatformArchitecture()) == 0)
isokarch = true;
}
}

if (isok)
if (isok && isokarch)
{
processPlatformAttribute(c);
c = c->GetNext();
Expand Down
4 changes: 3 additions & 1 deletion src/gui/ServiceBaseFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "gui/StyleGuide.h"
#include "metadata/database.h"
#include "metadata/server.h"
#include <frutils.h>

ServiceBaseFrame::ServiceBaseFrame(wxWindow* parent,
DatabasePtr db)
Expand Down Expand Up @@ -304,7 +305,8 @@ void* ServiceThread::Entry()
msg.Printf(_("Connecting to server %s..."), serverM.c_str());
logImportant(msg);
IBPP::Service svc = IBPP::ServiceFactory(wx2std(serverM),
wx2std(usernameM), wx2std(passwordM), wx2std(rolenameM), wx2std(charsetM)
wx2std(usernameM), wx2std(passwordM), wx2std(rolenameM), wx2std(charsetM),
wx2std(getClientLibrary())
);
svc->Connect();

Expand Down
3 changes: 1 addition & 2 deletions src/gui/controls/DataGridRows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,9 @@ void Int128ColumnDef::setFromString(DataGridRowBuffer* buffer,
{
wxASSERT(buffer);
int128_t v128 = 0;
int i1, decimalSeparatorIdx, localSourceScale;
int decimalSeparatorIdx, localSourceScale;
wxString errMsg;
wxString localSource = source;
wxChar ch;
wxChar decimalSeparator;

if (scaleM > 0)
Expand Down
66 changes: 36 additions & 30 deletions src/ibpp/_ibpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ FBCLIENT* FBCLIENT::Call()
{
// Let's load the CLIENT library, if it is not already loaded.
// The load is guaranteed to be done only once per application.
// Loading order : specifically defined path > local directory fbembed > local directory fbclient > PATH and System directories > Look at Win registry for Fb setup folder > gds32.dll

if (! mReady)
{
Expand Down Expand Up @@ -191,6 +192,12 @@ FBCLIENT* FBCLIENT::Call()
}
}

if (mHandle == 0)
{
// Let's try from the PATH and System directories
mHandle = IBPP_LoadLibrary("fbclient.dll");
}

if (mHandle == 0)
{
// Try to locate FBCLIENT.DLL through the optional FB 1.5 registry
Expand All @@ -211,45 +218,44 @@ FBCLIENT* FBCLIENT::Call()
&buflen) == ERROR_SUCCESS
&& keytype == REG_SZ)
{
int len = lstrlen(fbdll);
// for Firebird 3+
lstrcat(fbdll, "fbclient.dll");
int len = lstrlen(fbdll);

#if !defined(_WIN64)
// try 32 bit client library of 64 bit server
lstrcpy(fbdll + len, "WOW64\\fbclient.dll");
mHandle = IBPP_LoadLibrary(fbdll);
// try 32 bit client library of 64 bit server too
if (mHandle == 0)
{
lstrcpy(fbdll + len, "bin\\WOW64\\fbclient.dll");
mHandle = IBPP_LoadLibrary(fbdll);
}
#endif
// for Firebird 3+
if (mHandle == 0) {
lstrcpy(fbdll + len, "WOW64\\fbclient.dll");
lstrcpy(fbdll + len, "fbclient.dll");
mHandle = IBPP_LoadLibrary(fbdll);
// for Firebird 2.5 -
if (mHandle == 0){
lstrcpy(fbdll + len, "bin\\fbclient.dll");
mHandle = IBPP_LoadLibrary(fbdll);
// try 32 bit client library of 64 bit server too
if (mHandle == 0)
{
lstrcpy(fbdll + len, "bin\\WOW64\\fbclient.dll");
mHandle = IBPP_LoadLibrary(fbdll);
}
}
}
}
// for Firebird 2.5 -
if (mHandle == 0) {
lstrcpy(fbdll + len, "bin\\fbclient.dll");
mHandle = IBPP_LoadLibrary(fbdll);
}
}
RegCloseKey(hkey_instances);
}
}

if (mHandle == 0)
{
// Not found. Last try : attemps loading gds32.dll from PATH and
// System directories
mHandle = IBPP_LoadLibrary("gds32.dll");
}

if (mHandle == 0)
{
// Let's try from the PATH and System directories
mHandle = IBPP_LoadLibrary("fbclient.dll");
if (mHandle == 0)
{
// Not found. Last try : attemps loading gds32.dll from PATH and
// System directories
mHandle = IBPP_LoadLibrary("gds32.dll");
if (mHandle == 0)
throw LogicExceptionImpl("GDS::Call()",
_("Can't find or load FBCLIENT.DLL or GDS32.DLL"));
}
}
throw LogicExceptionImpl("GDS::Call()",
_("Can't find or load FBEMBED.DLL FBCLIENT.DLL or GDS32.DLL"));

#endif

#ifdef IBPP_UNIX
Expand Down
4 changes: 4 additions & 0 deletions src/metadata/MetadataItemDescriptionVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ void SaveDescriptionVisitor::visitException(Exception& exception)

void SaveDescriptionVisitor::visitFunctionSQL(FunctionSQL& function)
{
if (function.getDatabase()->getInfo().getODSVersionIsHigherOrEqualTo(11, 1)) { //Its available since FB 2.0, ODS 11.0 but I like to use "new" resources for safety
saveDescription(&function, "comment on function %s is '%s'");
return;
}
saveDescription(&function,
"update RDB$FUNCTIONS set rdb$description = ? "
"where RDB$FUNCTION_NAME = ?");
Expand Down
7 changes: 5 additions & 2 deletions src/metadata/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,8 +1729,11 @@ wxString Database::getClientLibrary() const
{
/*Todo: Implement FB library per conexion */
//return clientLibraryM;
wxString LValue = "";
return config().get("LibraryFile", LValue);
#if defined(_WIN64)
return config().get("x64LibraryFile", wxString(""));
#else
return config().get("x86LibraryFile", wxString(""));
#endif
}

int Database::getSqlDialect() const
Expand Down
Loading
Loading