The hssqlppp package

[Tags: bsd3, library]

Sql parser, pretty printer and type checker, targets PostgreSQL SQL and PL/pgSQL.

See the project page https://launchpad.net/hssqlppp for more information and documentation links, there are also links to some example usage files there.

Quick module guide:

Ast - ast types;

Parser - converting strings to asts;

PrettyPrinter - converting asts to strings containing valid SQL;

TypeChecker - type checking and annotating asts and working with annotated trees;

SqlTypes - the data types which represent SQL types, the data type for type errors, and some support functions;

Annotation - the annotation data types and utilities;

Catalog - read a catalog from a database to type check against, or to generate catalog information.

Also comes with command line access to some functions via a exe called HsSqlSystem, run this file with no arguments to get some help.


[Skip to ReadMe]

Properties

Versions0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.4.2
Change logNone available
Dependenciesbase (==4.*), cmdargs, containers, directory, filepath, haskell-src-exts, haskell98, HDBC, HDBC-postgresql, HUnit, mtl, parsec (>=3), Pipe, pretty, pretty-show, process, regex-posix, syb, template-haskell, test-framework, test-framework-hunit, uniplate [details]
LicenseBSD3
CopyrightCopyright 2010 Jake Wheat
AuthorJake Wheat
Maintainerjakewheatmail@gmail.com
Stabilitypre-alpha
CategoryDatabase
Home pagehttps://launchpad.net/hssqlppp
Bug trackermailto:jakewheatmail@gmail.com
ExecutablesHsSqlSystem
UploadedWed Jan 27 00:42:20 UTC 2010 by JakeWheat
DistributionsNixOS:0.4.2
Downloads2316 total (110 in last 30 days)
Votes
0 []
StatusDocs not available [build log]
All reported builds failed as of 2015-06-01 [all 2 reports]

Modules

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for hssqlppp-0.2.0

Summary: A parser, pretty printer, and type checker for PostgreSQL SQL
and PL/pgSQL. BSD licensed.

The current aims of the project is to provide a parser and type
checker for a substantial portion of PostgreSQL SQL and PL/pgSQL, and
then hopefully to build on this to make tools and libraries to help
developing PL/pgSQL code, possibly: macros/ code generation/ custom
syntax, type safe access from Haskell, Lint-like checking,
documentation generation.

Status: it successfully parses and accurately pretty prints the three
moderate sized SQL files from another project of mine, but there are
lots of missing bits. Coverage of SQL is sort of reasonable - it's
possible that your SQL files will parse OK, but it's also possible
that they won't parse at all. Please report any SQL which doesn't
parse.

It also has the beginnings of a type checker, which currently can type
check a fair bit of the three files mentioned above. You can run the
type checker on your SQL in various ways from the command line. Please
report any SQL which doesn't type check correctly. Coming soon: a
command to produce a report on how well this code can parse and type
check your SQL.

It comes with a small test suite.

To install, use
cabal update
then
cabal install hssqlppp

It's currently developed on GHC 6.12, but is tested on 6.10 before
each release so should work there too.

There isn't much in the way of documentation at the moment. See the
haddock docs locally or on hackage (link below), which also contain
links to a few example files. The source has a fair bit of comments,
which are currently OK in some places and poor in others.

The main dependencies of this project are: Parsec 3, HDBC,
HDBC-postgresql, and UUAGC is needed only for development). You need
PostgreSQL installed.

================================================================================

Homepage

There isn't really a homepage or website yet, but you can view the
Launchpad page where the code is hosted, and the HackageDB page.

Launchpad:
http://launchpad.net/hssqlppp/

HackageDB page:
http://hackage.haskell.org/package/hssqlppp
You can also browse the limited Haddock documentation online here.

You can get the latest development code from Launchpad using Bazaar:
bzr branch lp:~jakewheat/hssqlppp/trunk

================================================================================

Contact

Let me know if you're using/ interesting in using the library, if you
have any problems or suggestions, etc.. All contributions, comments
and criticism welcome:

jakewheatmail@gmail.com

You can also report problems on the bug tracker on Launchpad.

================================================================================

Example files:

(remove the prefix
http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/
to get the local relative path)

The test files for parsing and for type checking contain examples of
what parses/ typechecks and what the asts and annotations look like:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Tests/ParserTests.lhs
http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Tests/TypeCheckTests.lhs

The HsSqlSystem command source - HsSqlSystem.lhs.

AST transform code to extend plpgsql without any custom syntax, for
another project, early days:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Extensions/ChaosExtensions.lhs

Some type safe database access rough example code, all just half
finished demo ideas at the moment:

Simple idea to work as a preprocess to parse a haskell file and
convert some declarations into calls to a wrapper around HDBC, with
the correct type signatures, with the return type as a list of haskell
tuples:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Dbms/WrapperGen.lhs

Similar to previous idea, but using template haskell to do the
substitution at compile time, not as a preprocessor:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Dbms/DBAccess2.lhs

example usage:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/testfiles/DBAccess2Test.lhs

Use template haskell again, but type the return values as lists of
hlists instead of tuples, so that field names in haskell code are also
checked at compile time:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/Database/HsSqlPpp/Dbms/DBAccess3.lhs

example usage:

http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/testfiles/DBAccess3Test.lhs