From: Cyrill Schumacher Date: Sun, 15 Feb 2015 21:43:42 +0000 (+1100) Subject: Moved futured getSQL topic to another branch X-Git-Tag: v0.13~13 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=41c0e82f95706eea320d75e759256627702237e6;p=brevno-suite%2Fhugo Moved futured getSQL topic to another branch --- diff --git a/docs/content/extras/dynamiccontent.md b/docs/content/extras/dynamiccontent.md index 337e55d4..4155f04e 100644 --- a/docs/content/extras/dynamiccontent.md +++ b/docs/content/extras/dynamiccontent.md @@ -140,55 +140,3 @@ your markdown files until the content has been downloaded. - Photo gallery JSON powered: [https://github.com/pcdummy/hugo-lightslider-example](https://github.com/pcdummy/hugo-lightslider-example) - Github Starred Repositories [in a posts](https://github.com/SchumacherFM/blog-cs/blob/master/content%2Fposts%2Fgithub-starred.md) with the related [short code](https://github.com/SchumacherFM/blog-cs/blob/master/layouts%2Fshortcodes%2FghStarred.html). - more? - -## The Future - -### YAML and TOML - -If the community demands the implementation of *getYaml* -[YAML](http://yaml.org/) or *getToml* [TOML](https://github.com/toml-lang/toml) -these functions will certainly follow. - -### getSql - -The outlook to support more sources is of course implementing SQL support. The following description is an initial idea and may change. - -Maybe adding a new CLI option: - - --sqlSource=path/to/filename.ext - -#### `--sqlSource` - -The file must start with `[mysql|postres|mssql|...]_[\w]+.ext` - -The part before the first underscore specifies the driver to use, which can -be one from [https://github.com/golang/go/wiki/SQLDrivers](https://github.com/golang/go/wiki/SQLDrivers). - -The file itself contains only the connection string and no other comments -or characters. - -How the connection string looks like depends heavily on the used driver. -For MySQL: - - hugo --sqlSource=path/to/mysql_credentials.txt - -The file `mysql_credentials.txt` contains the connection string: -`username:password@protocol(address)/dbname?param=value` and nothing more! - -In your template you can process `getSql` the same way as with -the `getJson` function: - - {{ $rows := getSql "SELECT id,artist,genre,title FROM musicTable" }} - - -Queries with `SELECT * FROM table` are of course also possible but -should not be used. -Returned **values** will be converted to **strings**. - -Abusing `getSql` with [DML](http://en.wikipedia.org/wiki/Data_manipulation_language) -or [DDL](http://en.wikipedia.org/wiki/Data_definition_language) statements -causes Hugo to hang up.