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

Enable setting blank password #21

Merged
merged 1 commit into from
Dec 11, 2015
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/API/Generator/ISqlCeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface ISqlCeHelper
void CompactDatabase(string connectionString);
void CreateDatabase(string connectionString);
void VerifyDatabase(string connectionString);
void ChangeDatabasePassword(string connectionString, string password);
string ChangeDatabasePassword(string connectionString, string password);
void RepairDatabaseRecoverAllPossibleRows(string connectionString);
void RepairDatabaseRecoverAllOrFail(string connectionString);
void RepairDatabaseDeleteCorruptedRows(string connectionString);
Expand Down
21 changes: 16 additions & 5 deletions src/API/Generator/SqlCeHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;

using System;
using System.Data.SqlServerCe;
using System.Data.SqlClient;

Expand Down Expand Up @@ -88,14 +89,23 @@ public void VerifyDatabase(string connectionString)
}
}

public void ChangeDatabasePassword(string connectionString, string password)
public string ChangeDatabasePassword(string connectionString, string password)
{
if (string.IsNullOrEmpty(password))
throw new NullReferenceException("Password missing");
if (password == null)
{
password = string.Empty;
}
using (SqlCeEngine engine = new SqlCeEngine(connectionString))
{
engine.Compact(string.Format("Data Source=;Password={0}", password));
}
}
#if V40
var builder = new SqlCeConnectionStringBuilder(connectionString);
builder.Password = password;
return builder.ConnectionString;
#else
return string.Empty;
#endif
}

public void SaveDataConnection(string repositoryConnectionString, string connectionString, string filePath, int dbType)
Expand Down Expand Up @@ -305,3 +315,4 @@ public bool IsV35DbProviderInstalled()

}
}

4 changes: 2 additions & 2 deletions src/API/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

[assembly:ComVisible(false)]
[assembly: AssemblyVersion("3.5.2.15")]
[assembly: AssemblyFileVersion("3.5.2.56")]
[assembly: AssemblyInformationalVersion("3.5.2.56")]
[assembly: AssemblyFileVersion("3.5.2.57")]
[assembly: AssemblyInformationalVersion("3.5.2.57")]
2 changes: 0 additions & 2 deletions src/API/RebuildAllExceptSetup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ devenv ExportSQLCE40.sln /rebuild "Release"

devenv SqlCeScripting40.sln /rebuild "Release"

rem devenv SqlCeScripter.sln /rebuild "Release"

pause

2 changes: 1 addition & 1 deletion src/API/SQLiteScripting/Repositories/SQLiteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void VerifyDatabase(string connectionString)
throw new NotImplementedException();
}

public void ChangeDatabasePassword(string connectionString, string password)
public string ChangeDatabasePassword(string connectionString, string password)
{
throw new NotImplementedException();
}
Expand Down
21 changes: 13 additions & 8 deletions src/API/build.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
call rebuildallexceptsetup.cmd
cd lib
call ilmexpsqlce.cmd
del C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exp*.zip
del C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\sqlce*.zip
"c:\program files\7-zip\7z" a C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exportsqlce.zip C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exportsqlce.exe
"c:\program files\7-zip\7z" a C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exportsqlce40.zip C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exportsqlce40.exe
"c:\program files\7-zip\7z" a C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exportsqlce31.zip C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exportsqlce31.exe
"c:\program files\7-zip\7z" a C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\export2sqlce.zip C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\export2sqlce.exe
"c:\program files\7-zip\7z" a C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\SqlCeScripting.zip C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\*.dll
cd ..
cd ..
echo Copying new Scripting API files...
copy bin\Release\*.dll ..\..\..\

del ..\..\..\*.pdb
del ..\..\..\exp*.zip
del ..\..\..\sqlce*.zip
pause
"c:\program files\7-zip\7z" a ..\..\..\exportsqlce.zip ..\..\..\exportsqlce.exe
"c:\program files\7-zip\7z" a ..\..\..\exportsqlce40.zip ..\..\..\exportsqlce40.exe
"c:\program files\7-zip\7z" a ..\..\..\exportsqlce31.zip ..\..\..\exportsqlce31.exe
"c:\program files\7-zip\7z" a ..\..\..\export2sqlce.zip ..\..\..\export2sqlce.exe
"c:\program files\7-zip\7z" a ..\..\..\SqlCeScripting.zip ..\..\..\*.dll
cd ..\..\..\
dir *.zip
pause
17 changes: 4 additions & 13 deletions src/API/lib/ILMExpSqlCE.cmd
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@

echo Running ilmerge...
.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\ExportSqlCe.exe ..\bin\release\exportsqlce.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\ExportSqlCe40.exe ..\bin\release\exportsqlce40.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\ExportSqlCe31.exe ..\bin\release\exportsqlce31.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\Export2SqlCe.exe ..\bin\release\export2sqlce.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

del C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\exp*.pdb
.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:..\..\..\..\ExportSqlCe.exe ..\bin\release\exportsqlce.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

echo Copying new Scripting API files...
.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:..\..\..\..\ExportSqlCe40.exe ..\bin\release\exportsqlce40.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

copy C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE\CodePlexTFS\TFS02\exportsqlce\bin\Release\*.dll C:\Users\Erik\SkyDrive\Dokumenter\Code\SQLCE
.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:..\..\..\..\ExportSqlCe31.exe ..\bin\release\exportsqlce31.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll

pause
.\ilmerge /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:..\..\..\..\Export2SqlCe.exe ..\bin\release\export2sqlce.exe QuickGraph.dll QuickGraph.Data.dll QuickGraph.GraphViz.dll
25 changes: 12 additions & 13 deletions src/GUI/SqlCe35Toolbox/Commands/DatabaseMenuCommandsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,43 +114,42 @@ public void SetPassword(object sender, ExecutedRoutedEventArgs e)
try
{
var dbInfo = databaseInfo.DatabaseInfo;
PasswordDialog pwd = new PasswordDialog();
var pwd = new PasswordDialog();
pwd.ShowModal();
if (pwd.DialogResult.HasValue && pwd.DialogResult.Value == true && !string.IsNullOrWhiteSpace(pwd.Password))
if (pwd.DialogResult.HasValue && pwd.DialogResult.Value)
{
ISqlCeHelper helper = Helpers.DataConnectionHelper.CreateEngineHelper(databaseInfo.DatabaseInfo.DatabaseType);
helper.ChangeDatabasePassword(databaseInfo.DatabaseInfo.ConnectionString, pwd.Password);
var helper = DataConnectionHelper.CreateEngineHelper(databaseInfo.DatabaseInfo.DatabaseType);
var newConnectionString = helper.ChangeDatabasePassword(databaseInfo.DatabaseInfo.ConnectionString, pwd.Password);
if (dbInfo.FromServerExplorer)
{
var providerId = Resources.SqlCompact35Provider;
if (dbInfo.DatabaseType == DatabaseType.SQLCE40)
providerId = Resources.SqlCompact40Provider;
Helpers.DataConnectionHelper.RemoveDataConnection(package, dbInfo.ConnectionString, new Guid(providerId));
DataConnectionHelper.RemoveDataConnection(package, dbInfo.ConnectionString, new Guid(providerId));
}
else
{
Helpers.DataConnectionHelper.RemoveDataConnection(databaseInfo.DatabaseInfo.ConnectionString);
DataConnectionHelper.RemoveDataConnection(databaseInfo.DatabaseInfo.ConnectionString);
}

if (!dbInfo.ConnectionString.ToLowerInvariant().Contains("password"))
if (!string.IsNullOrEmpty(newConnectionString))
{
dbInfo.ConnectionString = dbInfo.ConnectionString + ";Password=" + pwd.Password;
Helpers.DataConnectionHelper.SaveDataConnection(dbInfo.ConnectionString, dbInfo.DatabaseType, package);
DataConnectionHelper.SaveDataConnection(newConnectionString, dbInfo.DatabaseType, package);
EnvDTEHelper.ShowMessage("Password was set, and connection updated");
}
else
{
EnvDTEHelper.ShowMessage("Password was set, but could not update connection, please reconnect the database");
}

ExplorerControl control = _parentWindow.Content as ExplorerControl;
control.BuildDatabaseTree();
Helpers.DataConnectionHelper.LogUsage("DatabaseMaintainSetPassword");
var control = _parentWindow.Content as ExplorerControl;
if (control != null) control.BuildDatabaseTree();
DataConnectionHelper.LogUsage("DatabaseMaintainSetPassword");
}
}
catch (Exception ex)
{
Helpers.DataConnectionHelper.SendError(ex, databaseInfo.DatabaseInfo.DatabaseType, false);
DataConnectionHelper.SendError(ex, databaseInfo.DatabaseInfo.DatabaseType, false);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/GUI/SqlCe35Toolbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
// app, or any theme specific resource dictionaries)
)]

[assembly: AssemblyVersion("4.4.0.9")]
[assembly: AssemblyFileVersion("4.4.0.9")]
[assembly: AssemblyVersion("4.4.0.10")]
[assembly: AssemblyFileVersion("4.4.0.10")]

2 changes: 1 addition & 1 deletion src/GUI/SqlCe35Toolbox/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Identifier Id="41521019-e4c7-480c-8ea8-fc4a2c6f50aa">
<Name>SQL Server Compact/SQLite Toolbox</Name>
<Author>ErikEJ</Author>
<Version>4.4.0.9</Version>
<Version>4.4.0.10</Version>
<Description xml:space="preserve">SQL Server Compact/SQLite Toolbox add-in for Visual Studio. This add-in adds several features to help your embedded database development efforts: Scripting of tables and data, import from SQL Server and CSV files and much, much more.</Description>
<Locale>1033</Locale>
<MoreInfoUrl>http://sqlcetoolbox.codeplex.com/</MoreInfoUrl>
Expand Down
Binary file modified src/GUI/lib/ISqlCeScripting.dll
Binary file not shown.
Binary file modified src/GUI/lib/SQLiteScripting.dll
Binary file not shown.
Binary file modified src/GUI/lib/SqlCeScripting.dll
Binary file not shown.
Binary file modified src/GUI/lib/SqlCeScripting40.dll
Binary file not shown.