Giter Site home page Giter Site logo

cake.sqltools's People

Contributors

adaskothebeast avatar jericho avatar n41m0r avatar sharperad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cake.sqltools's Issues

ExecuteSqlFile causes issues with Mysql stored procedure files.

with mysql, a valid sql file may contain things that are not valid for a single query ( such as DELIMITER $$ )

To Recreate:

build.cake:

#addin "Cake.SqlTools"
#addin "nuget:?package=MySql.Data"
using MySql.Data.MySqlClient;
Task("Recreate1").Does(()=> {
	var settings = new SqlQuerySettings {
		Provider = "MySql",
		ConnectionString = __the_connectionstring
	};
	var k = ExecuteSqlFile("test.sql", settings);
}); //fails

Task("Recreate2").Does(() => {
	using(var connection = new MySqlConnection(__the_connectionstring))
	{
		connection.Open();
		var dat = System.IO.File.ReadAllText("test.sql");
		var script = new MySqlScript(connection,dat);
		script.ExecuteAsync().GetAwaiter().GetResult();
	}
}); //works

test.sql:

DELIMITER $$

DROP PROCEDURE IF EXISTS testproc $$
CREATE PROCEDURE testproc()
SQL SECURITY INVOKER
BEGIN
	SELECT 1;
END $$

DELIMITER ;

cake-contrib user on NuGet

First of all, I wanted to thank you for adding to the Cake community by adding this addin.

I was just wondering if you had seen this blog post:

http://cakebuild.net/blog/2016/08/cake-contribution-organization

We are currently going through a process of increasing the visibility of addins, and also trying to ensure their long term maintainability.

To that end, we are asking addin creators to add the cake-contrib user on NuGet as a co-owner (this can be done through the NuGet website by clicking on Manage Owners on the package page).

Would you be interested in doing this for Cake.SqlTools? If you have any questions about this, please let me know. There was some initial concern that the Cake Team were trying to "take over" packages, and that couldn't be further from the truth, and if you have this concern, or others, I would like to address them.

Thanks!

Add support for returning the results of a query

I'm looking at porting old, raw MySQL queries into a Cake build task, but I want to fail if the database I'm about to import already exists (unless the user passes an overwrite argument).

This is relatively trivial to implement if I can get the result of a query against the INFORMATION_SCHEMA.SCHEMATA table, but right now ExecuteSqlQuery always calls ExecuteNonQuery() as opposed to ExecuteReader().

It would be handy if there was an alternative alias (or an option I could pass in to the SqlQuerySettings) to allow me to get the results (or given the need to abstract away the database itself, even just return the number of rows in the result set).

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.26.0. Please upgrade to 0.28.0
  • The Cake.Core reference should be private. Specifically, your addin's .csproj should have a line similar to this: <PackageReference Include="Cake.Core" Version="0.28.0" PrivateAssets="All" />
  • Your addin should target netstandard2.0. Please note that there is no need to multi-target, netstandard2.0 is sufficient.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.org and in the project on github.

Would it be possible to use the Cake Contrib Icon for your NuGet Package?

Thanks again for creating this Cake Addin, we really appreciate the effort that you have put in to creating it.

We, the Cake Team, recently announced a new Cake Contrib Icon, details of which can be found here:

http://cakebuild.net/blog/2017/06/new-cake-contrib-icon

Would you consider changing the nuspec file for your NuGet Package to use this new Cake Contrib Icon? If so, the recommended URL to use is:

https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png

Details of the above URL can be found in the repository here:

https://github.com/cake-contrib/graphics

Please let me know if you have any questions.

Installing SqlTools fails

Since the 0.1.0 update, installation via the cake addin directive (#addin "Cake.SqlTools") fails:

build

It looks like it is caused by the MySql Connector, someone already opened a topic on their forum.

could not load file or assembly 'System.Data.SqlClient'

If i run the code (cake version 0.29):
cakeContext.ExecuteSqlQuery(sql.ToString(), new SqlQuerySettings{
Provider = "MsSql",
ConnectionString = connectionString
});

I get the following code:
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Data.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Resolving assembly System.Data.SqlClient, Version=4.2.0.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Exception while resolving assembly System.Data.SqlClient: Could not load file or assembly 'System.Data.SqlClient, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'System.Data.SqlClient, Version=4.2.0.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Turn off error logging (i.e. for probing)

I'm probing for a starting database engine with your wonderful Cake tool to wait until it is ready to go. For this, I simply query for @@version which works great ... with one exception:

  • With this approach, the log gets full of errors and it seems impossible to prevent Cake.SqlTools from logging them.
    image

I fully understand the current behavior and I don't want to say that this is wrong or anything. I have a bit of a special use case here and I wanted to ask if you think it would be a good idea to add the possibility to prevent logging at all. I think it would be quite convenient if you'd add a property LogErrors which defaults to true to the SqlQuerySettings.

Target netstandard2.0 to run with Cake.CoreCLR

It would be cool, if the Cake.CoreCLR compatibility could be added, as stated here:
https://cakebuild.net/blog/2018/02/cake-v0.26.0-released
Due to this only "netstandard2.0" needs to be targeted by the addin.

The misleading error, which appeared to me relating to this issue was: "Error: Failed to install addin 'Cake.SqlTools'."
This misleading message lead me to: cake-build/cake#2011 ... but that's another thing...

Thanks for your support and your great work!

Does not work with .net core on linux

This Addin does not work with .net core on linux as the dependencies like Mysql.Data only is packaged for net46.

This results in the following error:
Could not load file or assembly 'MySql.Data, Version=8.0.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. The system cannot find the file specified.

As we use Linux machines for our CI/CD process, support for .net core is very important to us. And we would like to use your addin for mysql queries in this process.

Thanks,
Andi

NuGet package 0.0.4 can not be installed in build file

Hi,

I can't install the newly published addin 0.0.4 in my build script. If I integrate it via:
#addin "Cake.SqlTools"
I get an error when running the script:

Installing addins...
Unable to resolve dependency 'Npgsql.dll'. Source(s) used: 'nuget.org', 'Microsoft Visual Studio Offline Packages'.
NuGet exited with 1
Could not find any assemblies compatible with .NETFramework,Version=v4.5.
Error: Failed to install addin 'Cake.SqlTools'.

If I specify the version 0.0.3 explicitly it works fine.
#addin "nuget:?package=Cake.SqlTools&version=0.0.3"

Best regards

NuGet package 0.2.0 can not be installed in build file

I get the following error when I integrate via #addin "Cake.SqlTools" in my build script.

2018-05-15T18:12:20.1894645Z ##[error]Unable to find a version of 'Npgsql' that is compatible with 'Cake.SqlTools 0.2.0 constraint: Npgsql (>= 4.0.0-preview2)'.
2018-05-15T18:12:20.2363462Z NuGet exited with 1
2018-05-15T18:12:20.2363934Z An error occured while installing package Cake.SqlTools.
2018-05-15T18:12:20.2396245Z ##[error]Error: Failed to install addin 'Cake.SqlTools'.
2018-05-15T18:12:20.2888150Z ##[error]System.Exception: Unexpected exit code 1 returned from tool Cake.exe

When I specify version 0.1.2, there is no error.

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.29.0. Please upgrade to 0.33.0
  • The Cake.Core reference should be private. Specifically, your addin's .csproj should have a line similar to this: <PackageReference Include="Cake.Core" Version="0.33.0" PrivateAssets="All" />
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

Unable to run with LocalDB

I'm using VSTS and the only database available is LocalDB, but SqlClientLibrary apparently can't work with LocalDB on attempt to open connection I get network error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

The instance is up and running - I'm using it from other applications.
Here is how build.cake looks like:

Task("Create-DB-And-Schema")
.Does(() => 
{
    ExecuteSqlQuery("create database [MyProject-Testing]", new SqlQuerySettings()
    {
        Provider = "MsSql",
        ConnectionString = "Server=(localdb)\v12.0;"
    });
})

Here is a repro:

class Program
{
    static void Main(string[] args)
    {
        System.Data.IDbConnection con = System.Data.SqlClient.SqlClientFactory.Instance.CreateConnection();

        con.ConnectionString = "Server=(localdb)\v12.0;";
        con.Open(); // throws here
    }
}

Add cake-addin tag to Cake.SqlTools NuGet package

The NuGet Gallery will soon include a "Cake" tab with instructions on how to use NuGet packages in Cake build scripts. I'd like to suggest that you include the tag cake-addin in the NuGet package of this addin, so that the NuGet Gallery can display the correct instructions to install this addin.

The UI will look similar to this:

image

Documentation on best practices on tags for Cake addins: https://cakebuild.net/docs/extending/addins/best-practices#tags

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.