Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nycdotnet/TSqlFlex
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.9-alpha
Choose a base ref
...
head repository: nycdotnet/TSqlFlex
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 2,524 additions and 11,625 deletions.
  1. +7 −0 .gitignore
  2. +47 −0 ArchivedPatchNotes.md
  3. +30 −0 Chocolatey/TSQLFlex.nuspec
  4. +45 −0 Chocolatey/tools/chocolateyInstall.ps1
  5. +43 −0 Chocolatey/tools/chocolateyUninstall.ps1
  6. +49 −0 Code/TSqlFlex.Core.Tests/CSVRendererTests.cs
  7. +166 −0 Code/TSqlFlex.Core.Tests/CSharpRenderTests.cs
  8. +113 −18 Code/TSqlFlex.Core.Tests/DataScriptingTests.cs
  9. +25 −0 Code/TSqlFlex.Core.Tests/ExcelLauncherTests.cs
  10. +4 −6 Code/TSqlFlex.Core.Tests/FlexResultSetTests.cs
  11. +2 −2 Code/TSqlFlex.Core.Tests/InternationalTests.cs
  12. +1 −1 Code/TSqlFlex.Core.Tests/Properties/AssemblyInfo.cs
  13. +45 −0 Code/TSqlFlex.Core.Tests/QueryRunnerTests.cs
  14. +69 −0 Code/TSqlFlex.Core.Tests/RegistryTests.cs
  15. +173 −192 Code/TSqlFlex.Core.Tests/SchemaScriptingTests.cs
  16. +27 −7 Code/TSqlFlex.Core.Tests/TSqlFlex.Core.Tests.csproj
  17. +37 −0 Code/TSqlFlex.Core.Tests/TSqlRulesTests.cs
  18. +61 −0 Code/TSqlFlex.Core.Tests/XmlSpreadsheetRenderTests.cs
  19. +2 −1 Code/TSqlFlex.Core.Tests/packages.config
  20. +133 −0 Code/TSqlFlex.Core/CSVRenderer.cs
  21. +173 −0 Code/TSqlFlex.Core/CSharpRenderer.cs
  22. +56 −0 Code/TSqlFlex.Core/Config.cs
  23. +11 −73 Code/TSqlFlex.Core/ExcelLauncher.cs
  24. +90 −0 Code/TSqlFlex.Core/ExternalProgramLauncher.cs
  25. +116 −67 Code/TSqlFlex.Core/FieldScripting.cs
  26. +4 −20 Code/TSqlFlex.Core/FlexResult.cs
  27. +13 −12 Code/TSqlFlex.Core/FlexResultSet.cs
  28. +125 −0 Code/TSqlFlex.Core/Logging.cs
  29. +20 −15 Code/TSqlFlex.Core/Properties/AssemblyInfo.cs
  30. +31 −5 Code/TSqlFlex.Core/QueryWorker.cs
  31. +3 −0 Code/TSqlFlex.Core/Resources/XMLSpreadsheetTemplateHeader.txt
  32. +48 −0 Code/TSqlFlex.Core/SQLColumn.cs
  33. +46 −7 Code/TSqlFlex.Core/SqlRunParameters.cs
  34. +9 −0 Code/TSqlFlex.Core/TSqlFlex.Core.csproj
  35. +74 −46 Code/TSqlFlex.Core/TSqlRules.cs
  36. +50 −0 Code/TSqlFlex.Core/TxtLauncher.cs
  37. +51 −2 Code/TSqlFlex.Core/Utils.cs
  38. +28 −9 Code/TSqlFlex.Core/XmlSpreadsheetRenderer.cs
  39. +28 −2 Code/TSqlFlex.sln
  40. +8 −4 Code/TSqlFlex/AboutBox.Designer.cs
  41. +4 −1 Code/TSqlFlex/AboutBox.cs
  42. +18 −2 Code/TSqlFlex/Extension.cs
  43. +33 −29 Code/TSqlFlex/FlexMainWindow.Designer.cs
  44. +252 −68 Code/TSqlFlex/FlexMainWindow.cs
  45. +7 −15 Code/TSqlFlex/Properties/AssemblyInfo.cs
  46. +13 −4 Code/TSqlFlex/RunCommand.cs
  47. +4 −2 Code/TSqlFlex/TSqlFlex.csproj
  48. +1 −1 Code/TSqlFlex/packages.config
  49. BIN Code/packages/NUnit.2.6.3/NUnit.2.6.3.nupkg
  50. BIN Code/packages/NUnit.2.6.3/lib/nunit.framework.dll
  51. +0 −10,960 Code/packages/NUnit.2.6.3/lib/nunit.framework.xml
  52. +0 −15 Code/packages/NUnit.2.6.3/license.txt
  53. BIN Code/packages/RedGate.SIPFrameworkShared.1.0.1.243/RedGate.SIPFrameworkShared.1.0.1.243.nupkg
  54. BIN Code/packages/RedGate.SIPFrameworkShared.1.0.1.243/lib/RedGate.SIPFrameworkShared.dll
  55. +67 −0 Deploy/prepDeploy.ps1
  56. +23 −0 InstallationInstructions.md
  57. +39 −39 README.md
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Code/Packages/
Deploy/Binaries/

#################
## Eclipse
#################
@@ -41,6 +44,8 @@ local.properties
*.user
*.sln.docstates

.vs/

# Build results

[Dd]ebug/
@@ -213,3 +218,5 @@ pip-log.txt

#Mr Developer
.mr.developer.cfg

Chocolatey/*.nupkg
47 changes: 47 additions & 0 deletions ArchivedPatchNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

**Archived patch notes:**
* v0.0.11-alpha (2015-01-23):
* Updated to use .NET 4.5 - this version is now required to run T-SQL Flex.
* Improved scripter to continuously increment the "#Result" table number to prevent conflicts in a session.
* Fixed lockup of SSMS when switching between database servers. (#33)
* Fixed missing column header for anonymous columns in Excel export (#29)
* Added WEIGHT, TARGET, and NONE as T-SQL keywords.
* Implemented improved logging.
* v0.0.10-alpha (2014-09-11):
* Implemented drag and drop of database objects from object explorer.
* Fix for launching Excel exported files when there is a space in the profile path name.
* Fix for scripting a field name that includes spaces without bracketizing it.
* v0.0.9-alpha (2014-09-11):
* Fix for "Invalid class string" exception in SSMS 2008 or lower (via pull request from David Pond - many thanks!)
* Fix for "unable to determine identity of domain" isolated storage initialization bug in SSMS 2008 or lower.
* Fixes for CTRL+A and CTRL+C - "Select all" and "copy" keyboard shortcuts now work as expected with T-SQL Flex.
* Additional exception handling during data scripting - hopefully will allow more graceful recovery from out of memory exceptions, in particular.
* Some clarifications to the installation instructions including mentioning that the user must unblock the DLLs.
* Fixed the T-SQL Flex metadata so that the add-in info appears in the "SSMS Add-ins" dialog.
* v0.0.8-alpha (2014-09-06):
* Added about box with version info and links for feedback, issues, and updates.
* Added button to open the latest scripted XML spreadsheet in Excel.
* Fix for some rare cross-thread UI update issues.
* v0.0.7-alpha (2014-09-02):
* Significant bug fixes for internationalization issues surrounding time and number formatting including tests. Cultures where . is used as the time separator and , as a decimal point should work OK now for both Excel and SQL INSERT scripts. Special thanks to Gianluca Sartori (@SpaghettiDBA) for assistance with troubleshooting these issues.
* Bug fixes for incorrect columns and commas appearing in INSERT scripts due to hidden fields.
* Added more line-feeds to the scripted XML Spreadsheet 2003 output.
* Finished refactoring to "format" functions (this is an internal change only).
* v0.0.6-alpha (2014-08-30):
* Significant improvements to exception handling during all phases of querying and scripting
* Significant changes to disk-based buffering. Now uses .NET IsolatedStorage.
* Significant refactoring - moved query processing logic from UI to Core DLL.
* Fixed bug where synthetic columns (select 'a' as [z]) were incorrectly hidden.
* Fixed bug with scripting binary and other byte[] data fields to Excel.
* Updated SIP Framework to 1.0.1.243 (from July 2014).
* v0.0.5-alpha (2014-08-22):
* Export to "XML Spreadsheet 2003" functionality added - this is very early alpha for this feature.
* Started significant refactoring effort for data scripting in T-SQL field vs general presentation.
* Started work to use a file stream rather than a string builder for scripting the data. Currently only used with the Excel XML export.
* v0.0.4-alpha (2014-06-18):
* Converted to background worker. Added cancel button, timer, and progress bar.
* Additional scripted output "minification" improvements (dropping insignificant decimals for example).
* Other improvements to quality of scripted output such as bracketing of keywords.
* v0.0.3-alpha (2014-06-13): Fixed data script escaping bug for single quotes.
* v0.0.2-alpha (2014-06-11): Data scripting implemented. Improved window.
* v0.0.1-alpha (2014-06-01): Initial release. Schema scripting working.
30 changes: 30 additions & 0 deletions Chocolatey/TSQLFlex.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>tsqlflex</id>
<title>T-SQL Flex</title>
<version>0.2.1-beta</version>
<authors>Steve Ognibene</authors>
<owners>NYCdotNet</owners>
<summary>SSMS add-in for scripting and Excel export.</summary>
<description>SSMS add-in for scripting and Excel export.</description>
<projectUrl>https://github.com/nycdotnet/TSqlFlex</projectUrl>
<tags>T-SQL Flex SQL Server SSMS</tags>
<copyright>2017</copyright>
<licenseUrl>https://github.com/nycdotnet/TSqlFlex/blob/master/License.md</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<dependencies>
<dependency id="sipfw" version="1.0.3.4" />
</dependencies>
<releaseNotes>
* v0.2.1-beta (2016-07-13):
* Fixed scripting of TIME to XML Spreadsheet (no longer crashes)
* Improved scripting of TIME to SQL scripts - can include up to 7 digits of scale.
* Improved scripting of DATETIME2 to SQL scripts - now includes scale number if relevant.
</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
45 changes: 45 additions & 0 deletions Chocolatey/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$packageName = "T-SQL Flex";
$url = "https://github.com/nycdotnet/TSqlFlex/releases/download/0.2.1-beta/TSqlFlex-0.2.1-beta.zip";
$installLocation = "$env:ProgramData\T-SQL Flex";

Install-ChocolateyZipPackage "$packageName" "$url" "$installLocation"

function Create-RegistryKeyIfNotExists($parentKey, $testKey) {
if ((test-path "$parentKey\$testKey") -eq $false) {
New-Item -Path "$parentKey" -Name "$testKey" | Out-Null
}
if ((test-path "$parentKey\$testKey") -eq $true) {
return "$parentKey\$testKey";
}
throw "unable to create or confirm existence of '$parentKey\$testKey'";
}

# thanks: http://stackoverflow.com/questions/5648931/test-if-registry-value-exists
function Test-RegistryValue($regkey, $name) {
$exists = Get-ItemProperty -Path "$regkey" -Name "$name" -ErrorAction SilentlyContinue
If (($exists -ne $null) -and ($exists.Length -ne 0)) {
Return $true
}
Return $false
}

function Get-RegistrySoftwareRootKey() {
if (Get-ProcessorBits -eq 64) {
Write-Debug "64-bit processor detected.";
Return "HKLM:\Software\Wow6432Node";
}
Write-Debug "32-bit processor detected.";
Return "HKLM:\Software";
}


$root = Get-RegistrySoftwareRootKey;
$createdKey = $root;
$addKeys = "Red Gate\SIPFramework\Plugins";
$addKeys.Split("\") | % { $createdKey = Create-RegistryKeyIfNotExists $createdKey $_ }

if ((Test-RegistryValue $createdKey "TSQLFlex") -eq $false) {
New-ItemProperty -Name "TSQLFlex" -Path $createdKey -Value "$installLocation\TSqlFlex.dll" | Out-Null
} else {
Set-ItemProperty -Name "TSQLFlex" -Path $createdKey -Value "$installLocation\TSqlFlex.dll" | Out-Null
}
43 changes: 43 additions & 0 deletions Chocolatey/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
$packageName = "T-SQL Flex";
$installLocation = "$env:ProgramData\T-SQL Flex";

function Remove-ItemIfExists($itemName) {
if ((Test-Path $itemName) -eq $true) {
Remove-Item $itemName;
}
}

# thanks: http://stackoverflow.com/questions/5648931/test-if-registry-value-exists
function Test-RegistryValue($regkey, $name) {
$exists = Get-ItemProperty -Path "$regkey" -Name "$name" -ErrorAction SilentlyContinue
If (($exists -ne $null) -and ($exists.Length -ne 0)) {
Return $true
}
Return $false
}

function Get-RegistrySoftwareRootKey() {
if (Get-ProcessorBits -eq 64) {
Return "HKLM:\Software\Wow6432Node";
}
Return "HKLM:\Software";
}

Remove-ItemIfExists "$installLocation\RedGate.SIPFrameworkShared.dll";
Remove-ItemIfExists "$installLocation\TSqlFlex.Core.dll";
Remove-ItemIfExists "$installLocation\TSqlFlex.dll";
Remove-ItemIfExists "$installLocation\InstallationInstructions.txt";
Remove-ItemIfExists "$installLocation\License.txt";
Remove-ItemIfExists "$installLocation\README.txt";

$root = Get-RegistrySoftwareRootKey;
$pluginsPath = "$root\Red Gate\SIPFramework\Plugins";
if ((Test-RegistryValue $pluginsPath "TSQLFlex") -eq $true) {
Remove-ItemProperty -Name "TSQLFlex" -Path $pluginsPath | Out-Null
}

try {
Remove-ItemIfExists "$installLocation";
} catch {
# Don't sweat it.
}
49 changes: 49 additions & 0 deletions Code/TSqlFlex.Core.Tests/CSVRendererTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using NUnit.Framework;

namespace TSqlFlex.Core.Tests
{
[TestFixture()]
class CSVRendererTests
{
[Test()]
public void string_with_no_commas_is_not_enclosed()
{
string testit = "This is a test";
Assert.AreEqual(testit, TSqlFlex.Core.CSVRenderer.escapeForCSV(testit));
}

[Test()]
public void string_with_commas_is_enclosed()
{
string testit = "Developer, Jane Q.";
Assert.AreEqual("\"" + testit + "\"", TSqlFlex.Core.CSVRenderer.escapeForCSV(testit));
}

[Test()]
public void string_starting_with_zero_is_enclosed()
{
string testit = "00000000";
Assert.AreEqual("\"" + testit + "\"", TSqlFlex.Core.CSVRenderer.escapeForCSV(testit));
}

[Test()]
public void string_starting_with_numeric_nonzero_is_not_enclosed()
{
string testit = "10000000";
Assert.AreEqual(testit, TSqlFlex.Core.CSVRenderer.escapeForCSV(testit));
}

[Test()]
public void string_that_is_lone_zero_is_not_enclosed()
{
string testit = "0";
Assert.AreEqual(testit, TSqlFlex.Core.CSVRenderer.escapeForCSV(testit));
}
}
}
Loading