Git Product home page Git Product logo

mysql-not-so-simple's People

Contributors

arbus avatar chshersh avatar vrom911 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mysql-not-so-simple's Issues

Implement `queryNamed`

Subtask of #49

Add this function:

queryNamed :: ... => MySQLConn -> Query -> [NamedParam] -> m [row]

using extractNames from MySql.Named as a black box.

Bool instance

MySql doesn't have booleans. So Bool is Int64 0 or 1 ๐Ÿคทโ€โ™€๏ธ

Improve parsing error messages even more

Currently when we failed to parse row we specify the id of the column that was failed to parse. But we can go even further. We can use ColumnDef to tell even more about failing column. The datatype is quite useful:

We have list of all column definitions here:

https://github.com/Holmusk/mysql-not-so-simple/blob/28fcb4059bd91dade5587071dd137ddf032d77ac/src/MySql/Query.hs#L74

We can do this by adding [ColumnDef] field to the MatcherState and then use it later when we throw error.

Add support for named parameters

MySQL doesn't support named parameters on the protocol level. So the only possible way to implement named parameters in our library is the following:

  1. Introduce data type data NamedParam = NamedParam Text Param (where Text is the name of the parameter).
  2. Implement functions executeNamed and queryNamed with types:
queryNamed :: FromRow row => MySQLConn -> Query -> [NamedParam] -> IO [row]

These function will parse Query and replace all occurrences of :nameOfTheParameter with ? and rearrange arguments in [NamedParam] list according to their occurrence in the Query. And then these functions just delegate their arguments to query and execute functions.

Regarding parsing of Query: I propose that after : only alphanumeric characters and underscores are allowed. I hope that : is not used anywhere in MySQL...

Any thoughts on this?

Configure Circle CI for tests after some tests are implemented

Currently we don't have tests so testing on CI doesn't make much sense and won't be very useful because without tests we can't verify that tests are actually working on the CI. If we do this issue right now, we probably will need to do it again after we have MySQL tests.

Add function that reads multiple files (as it is one Query)

Apparently, mysql-haskell can't read two (and more) files in a row without throwing the exception two times before it works on the third run. So the dirty hack is to add the function which will take the list of files, read it and concatenate together as one big text and after run the MySQL.executeMany_ on that and hope that it won't fail.

Show full SQL query in errors

Sometimes you call functions with a lot of SQL queries but current error reporting only shows the error without the SQL query itself. Because of that it's not that easy to find which query is not working. It would be better to add Query as well to relevant error constructors.

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.