And have troubles with escaping quotes, with newlines, and with syntax
highlighting. That's really bad advice. :)
If there are a few large queries, they should be in their own files with ".sql"
extension. Quite a few programs are able to recognize them as is and do
something useful.
If there are a lot of small queries, you can use YAML and format them like this:
---
# vim: syntax=sql
all-products: |
select * from products
all-users: |
select * from users
where something > anything
order by whatever
...
07.03.2014, 16:32, "Paul Vencill" <[email protected]>:
> Bob, what might be easier / more useful to you would be to actually make all
> your SQL into key-value pairs and then make your query file a .json file. Eg
>
> {
> "allProducts" : "select * from products"
> }
>
> This way, any of your modules that need the queries can just require the json
> file, and have an object whose property values correspond to the SQL strings,
> eg
>
> var queries = require('./queries.json');
>
> db.query(queries.allProducts, callback);
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.