Skip to content

Commit

Permalink
Version 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edwig committed Jan 22, 2023
1 parent 5072d63 commit f3a2a75
Show file tree
Hide file tree
Showing 36 changed files with 749 additions and 150 deletions.
1 change: 1 addition & 0 deletions Data/settings.dat
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ FileWhatToFind=
FileFileTypes=*.sql
FileStartDirectory=C:\\
SQLPrefetchLines=200
SQLLengthOption=3
SQLQueryTerminator=/
SQLQueryFont=Verdana;10
PreferODBCMetaSQL=0
Expand Down
2 changes: 1 addition & 1 deletion Installer/Installer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>Setup_OpenODBCQuerytool_3.1.0_64-Bits.exe</TargetName>
<TargetName>Setup_OpenODBCQuerytool_3.2.0_64-Bits.exe</TargetName>
<OutDir>$(SolutionDir)bin_$(Configuration)$(Platform)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand Down
10 changes: 6 additions & 4 deletions Installer/Installer_Algemeen.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
; Copyright (c) 2017 ir. W.E. Huisman
; All rights reserved
;
; Last change: 01-01-2023
; Versionnumber: 3.1.0
; Last change: 22-01-2023
; Versionnumber: 3.2.0
;-------------------------------------------------------
!define PRODUCT_NAME "OpenODBCQuerytool"
!define PRODUCT_VERSION "3.1.0"
!define PRODUCT_BUILDNUMBER "365"
!define PRODUCT_VERSION "3.2.0"
!define PRODUCT_BUILDNUMBER "380"
!define PRODUCT_PUBLISHER "EDO"
!define PRODUCT_WEB_SITE "https://sourceforge.net/projects/odbcquerytool"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}"
Expand Down Expand Up @@ -144,6 +144,7 @@ Section "The Program" prog_always
File "${InputDir}ODBCQueryTool.chm"
File "${InputDir}ODBCQueryTool.exe"
File "${InputDir}SQLMigrate.exe"
File "${InputDir}QueryReWriter.exe"
File "${RootDir}plan.txt"
File "${RootDIr}QUERY.ICO"
File "${RootDir}readme.txt"
Expand Down Expand Up @@ -274,6 +275,7 @@ Section Uninstall
Delete /REBOOTOK "$INSTDIR\ODBCQueryTool.chm"
Delete /REBOOTOK "$INSTDIR\ODBCQueryTool.exe"
Delete /REBOOTOK "$INSTDIR\SQLMigrate.exe"
Delete /REBOOTOK "$INSTDIR\QueryReWriter.exe"
Delete /REBOOTOK "$INSTDIR\plan.txt"
Delete /REBOOTOK "$INSTDIR\QUERY.ico"
Delete /REBOOTOK "$INSTDIR\readme.txt"
Expand Down
1 change: 1 addition & 0 deletions ODBCQueryTool.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Installer", "Installer\Installer.vcxproj", "{3F84E4DF-B785-4179-855B-8733225EFE3D}"
ProjectSection(ProjectDependencies) = postProject
{5F16ED87-9E0C-4980-80D0-79D39A94D8C3} = {5F16ED87-9E0C-4980-80D0-79D39A94D8C3}
{735F04DA-B210-40A0-BA5A-E58D8896E181} = {735F04DA-B210-40A0-BA5A-E58D8896E181}
{79A5F0D1-81B9-4762-B32D-9EF7EE305DEE} = {79A5F0D1-81B9-4762-B32D-9EF7EE305DEE}
{F7E4D3BD-6248-493C-9DFB-94C33B0BD1E2} = {F7E4D3BD-6248-493C-9DFB-94C33B0BD1E2}
EndProjectSection
Expand Down
34 changes: 7 additions & 27 deletions QueryReWriter/QueryReWriterDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,31 +146,7 @@ QueryReWriterDlg::OnInitDialog()
SetWindowText("Query ReWriter");
ShowMinMaxButton();
SetSysMenu(IDR_MENU);

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != nullptr)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon,FALSE); // Set small icon
SetAboutBoxAndIcon(IDM_ABOUTBOX,IDS_ABOUTBOX);

// Add extra initialization here
InitTabs();
Expand Down Expand Up @@ -211,11 +187,15 @@ void
QueryReWriterDlg::InitConfig()
{
RegistryManager manager;
CString file = manager.GetRegistryString("HKCU\\Software\\EDO\\QueryRewriter","configfile","");
CString config("HKCU\\Software\\EDO\\QueryRewriter");
CString file = manager.GetRegistryString(config,"configfile","");
if(!file.IsEmpty())
{
m_page2->SetConfigFile(file);
m_page2->ReadConfig();
if(!m_page2->ReadConfig())
{
manager.DeleteRegistryValue(config,"configfile");
}
}
}

Expand Down
1 change: 0 additions & 1 deletion QueryReWriter/QueryReWriterDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class QueryReWriterDlg : public StyleDialog

// Implementation
protected:
HICON m_hIcon;
CString m_config;
StyleEdit m_editConfig;
StyleTabCtrl m_tabs;
Expand Down
3 changes: 3 additions & 0 deletions QueryTool/OpenEditor/Include/OESQLSettingsPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ class COESQLSettingsPage : public StyleDialog
int m_prefetch;
CString m_terminator;
CString m_font;
int m_lenOption;
bool m_odbcMetaSQL;

StyleEdit m_editPrefetch;
StyleEdit m_editTerminator;
StyleEdit m_editFont;
StyleButton m_buttonFont;
StyleComboBox m_comboSqlLen;
StyleCheckbox m_buttonODBC;

afx_msg void OnUpdateData();
Expand All @@ -58,4 +60,5 @@ class COESQLSettingsPage : public StyleDialog
afx_msg void OnEnChangeFont();
afx_msg void OnBnClickedButFont();
afx_msg void OnBnClickedPreferODBC();
afx_msg void OnCbnSelchangeSqlLen();
};
4 changes: 4 additions & 0 deletions QueryTool/OpenEditor/Include/OESettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ namespace OpenEditor
OES_DECLARE_PROPERTY(string, FileStartDirectory);

OES_DECLARE_PROPERTY(int, SQLPrefetchLines);
OES_DECLARE_PROPERTY(int, SQLLengthOption);
OES_DECLARE_PROPERTY(string, SQLQueryTerminator);
OES_DECLARE_PROPERTY(string, SQLQueryFont);

Expand Down Expand Up @@ -283,6 +284,7 @@ namespace OpenEditor
OES_DECLARE_ABSTR_PROPERTY(string, FileStartDirectory);

OES_DECLARE_ABSTR_PROPERTY(int, SQLPrefetchLines);
OES_DECLARE_ABSTR_PROPERTY(int, SQLLengthOption);
OES_DECLARE_ABSTR_PROPERTY(string, SQLQueryTerminator);
OES_DECLARE_ABSTR_PROPERTY(string, SQLQueryFont);

Expand Down Expand Up @@ -380,6 +382,7 @@ namespace OpenEditor
OES_DECLARE_GLOBAL_PROPERTY(string, FileStartDirectory);

OES_DECLARE_GLOBAL_PROPERTY(int, SQLPrefetchLines);
OES_DECLARE_GLOBAL_PROPERTY(int, SQLLengthOption);
OES_DECLARE_GLOBAL_PROPERTY(string, SQLQueryTerminator);
OES_DECLARE_GLOBAL_PROPERTY(string, SQLQueryFont);

Expand Down Expand Up @@ -499,6 +502,7 @@ namespace OpenEditor
OES_AGGREGATE_PROPERTY(string, FileStartDirectory);

OES_AGGREGATE_PROPERTY(int, SQLPrefetchLines);
OES_AGGREGATE_PROPERTY(int, SQLLengthOption);
OES_AGGREGATE_PROPERTY(string, SQLQueryTerminator);
OES_AGGREGATE_PROPERTY(string, SQLQueryFont);

Expand Down
21 changes: 21 additions & 0 deletions QueryTool/OpenEditor/OESQLSettingsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ COESQLSettingsPage::COESQLSettingsPage(SettingsManager& manager,CWnd* p_parent)
m_terminator = settings.GetSQLQueryTerminator().c_str();
m_font = settings.GetSQLQueryFont().c_str();
m_odbcMetaSQL = settings.GetPreferODBCMetaSQL();
m_lenOption = settings.GetSQLLengthOption();
}

COESQLSettingsPage::~COESQLSettingsPage()
Expand All @@ -48,6 +49,7 @@ COESQLSettingsPage::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX,IDC_FONT, m_editFont, m_font);
DDX_Control(pDX,IDC_BUT_FONT, m_buttonFont);
DDX_Control(pDX,IDC_META, m_buttonODBC);
DDX_CBIndex(pDX,IDC_SQL_LEN, m_comboSqlLen, m_lenOption);
}

BEGIN_MESSAGE_MAP(COESQLSettingsPage,StyleDialog)
Expand All @@ -56,13 +58,25 @@ BEGIN_MESSAGE_MAP(COESQLSettingsPage,StyleDialog)
ON_EN_CHANGE(IDC_FONT, &COESQLSettingsPage::OnEnChangeFont)
ON_BN_CLICKED(IDC_BUT_FONT, &COESQLSettingsPage::OnBnClickedButFont)
ON_BN_CLICKED(IDC_META, &COESQLSettingsPage::OnBnClickedPreferODBC)
ON_CBN_SELCHANGE(IDC_SQL_LEN, &COESQLSettingsPage::OnCbnSelchangeSqlLen)
END_MESSAGE_MAP()

BOOL
COESQLSettingsPage::OnInitDialog()
{
StyleDialog::OnInitDialog();

m_comboSqlLen.AddString("Statement NTS (Null Terminated String");
m_comboSqlLen.AddString("Statement exact string length");
m_comboSqlLen.AddString("Statement string-length + 1 for NTS (Default)");

if(m_lenOption < 1 || m_lenOption > 3)
{
m_lenOption = 3;
}

m_comboSqlLen.SetCurSel(m_lenOption - 1);

m_buttonODBC.SetCheck(m_odbcMetaSQL);
return TRUE;
}
Expand All @@ -82,6 +96,7 @@ BOOL COESQLSettingsPage::OnApply()
settings.SetSQLQueryTerminator(term);
settings.SetSQLQueryFont(font);
settings.SetPreferODBCMetaSQL(m_odbcMetaSQL);
settings.SetSQLLengthOption(m_lenOption + 1);
}
_OE_DEFAULT_HANDLER_;

Expand Down Expand Up @@ -197,6 +212,12 @@ COESQLSettingsPage::OnBnClickedButFont()
}
}

void
COESQLSettingsPage::OnCbnSelchangeSqlLen()
{
UpdateData();
}

void
COESQLSettingsPage::OnBnClickedPreferODBC()
{
Expand Down
2 changes: 2 additions & 0 deletions QueryTool/OpenEditor/OESettingsStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void SettingsManagerWriter::operator << (const SettingsManager& mgr)
OESMS_WRITE_MEMBER(settings, FileStartDirectory);

OESMS_WRITE_MEMBER(settings, SQLPrefetchLines);
OESMS_WRITE_MEMBER(settings, SQLLengthOption);
OESMS_WRITE_MEMBER(settings, SQLQueryTerminator);
OESMS_WRITE_MEMBER(settings, SQLQueryFont);

Expand Down Expand Up @@ -172,6 +173,7 @@ void SettingsManagerReader::operator >> (SettingsManager& mgr)
OESMS_READ_MEMBER(settings, FileStartDirectory);

OESMS_READ_MEMBER(settings, SQLPrefetchLines);
OESMS_READ_MEMBER(settings, SQLLengthOption);
OESMS_READ_MEMBER(settings, SQLQueryTerminator);
OESMS_READ_MEMBER(settings, SQLQueryFont);

Expand Down
2 changes: 2 additions & 0 deletions QueryTool/OpenEditor/OEView_7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ COEditorView::ExecuteQuery(int p_line
int panelWindow = p_batch ? QPW_OUTPUT_VIEW : QPW_QUERY_VIEW;
UINT defFormat = DT_LEFT|DT_VCENTER|DT_WORDBREAK|DT_END_ELLIPSIS|DT_NOPREFIX|DT_EXPANDTABS;
int prefetchLines = GetDocument()->GetSettings().GetSQLPrefetchLines();
int lengthOption = GetDocument()->GetSettings().GetSQLLengthOption();
VarMap& variables = theApp.GetVariables();
int numVariables = (int)variables.size();
int longestColumn = 0;
Expand All @@ -691,6 +692,7 @@ COEditorView::ExecuteQuery(int p_line

// Init the SQLQuery object
m_query.Init(&database);
m_query.SetLengthOption((LOption) lengthOption);

if(!database.IsOpen())
{
Expand Down
Binary file modified QueryTool/QueryTool.rc
Binary file not shown.
12 changes: 6 additions & 6 deletions QueryTool/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
#pragma once

// General text version
#define ODBCQUERYTOOL_VERSION "3.1.0"
#define ODBCQUERYTOOL_BUILD "365"
#define ODBCQUERYTOOL_VERSION "3.2.0"
#define ODBCQUERYTOOL_BUILD "380"
#define ODBCQUERYTOOL_COPYRIGHT "Copyright (c) Edwig Huisman 2004-2023"

// For the resource files
#define QT_RES_VERSION 3
#define QT_RES_MAJOR 1
#define QT_RES_MAJOR 2
#define QT_RES_MINOR 0
#define QT_RES_BUILD 365
#define QT_RES_FILE "3,1,0,365"
#define QT_RES_BUILD 380
#define QT_RES_FILE "3,2,0,380"

// For the registry and the theme framework
#define PRODUCT_REGISTRY "EDO\\ODBCQueryTool"
#define PROGRAM_NAME "ODBCQueryTool"
#define PROFILE_VERSION "3.1"
#define PROFILE_VERSION "3.2"
5 changes: 3 additions & 2 deletions QueryTool/framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include "targetver.h"
#include "..\framework.h"

#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#include <afxcmn.h> // MFC support for Windows Common Controls
#include <afxcontrolbars.h> // MFC support for ribbons and control bars
Expand Down
1 change: 1 addition & 0 deletions QueryTool/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
#define IDC_DATATYPE 224
#define IDR_MENU1 224
#define IDR_OE_TABLES_POPUP 224
#define IDC_SQL_LEN 224
#define IDC_TYPE2 225
#define IDC_SIZE2 226
#define IDC_EXEC2 227
Expand Down
25 changes: 21 additions & 4 deletions SQLComponents/SQLQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ SQLQuery::Init(SQLDatabase* p_database)
m_speedThreshold = QUERY_TOO_LONG;
m_connection = NULL;
m_concurrency = SQL_CONCUR_READ_ONLY;
m_lengthOption = LOption::LO_LEN_ZERO;
}

void
Expand Down Expand Up @@ -646,8 +647,16 @@ SQLQuery::DoSQLStatement(const XString& p_statement)
// by a missing NULL-Terminator. By changing the length of the statement
// _including_ the terminating NUL, it won't crash at all
// NOTE: This also means we cannot use the SQL_NTS terminator
SQLINTEGER lengthStatement = statement.GetLength() + 1;

SQLINTEGER lengthStatement(SQL_NTS);
switch(m_lengthOption)
{
case LOption::LO_NTS: lengthStatement = SQL_NTS;
break;
case LOption::LO_LENGTH: lengthStatement = statement.GetLength();
break;
case LOption::LO_LEN_ZERO:lengthStatement = statement.GetLength() + 1;
break;
}
// GO DO IT RIGHT AWAY
m_retCode = SqlExecDirect(m_hstmt,(SQLCHAR*)statement.GetString(),lengthStatement);

Expand Down Expand Up @@ -861,8 +870,16 @@ SQLQuery::DoSQLPrepare(const XString& p_statement)
// in the processing of the query-strings which crashes it in CharNexW
// by a missing NUL-Terminator. By changing the length of the statement
// _including_ the terminating NUL, it won't crash at all
SQLINTEGER lengthStatement = statement.GetLength() + 1;

SQLINTEGER lengthStatement(SQL_NTS);
switch(m_lengthOption)
{
case LOption::LO_NTS: lengthStatement = SQL_NTS;
break;
case LOption::LO_LENGTH: lengthStatement = statement.GetLength();
break;
case LOption::LO_LEN_ZERO:lengthStatement = statement.GetLength() + 1;
break;
}
// GO DO THE PREPARE
m_retCode = SqlPrepare(m_hstmt,(SQLCHAR*)(LPCSTR)statement,lengthStatement);
if(SQL_SUCCEEDED(m_retCode))
Expand Down
Loading

0 comments on commit f3a2a75

Please sign in to comment.