Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing node-parse with sqlparse (python dependency). #67

Merged
merged 1 commit into from
Aug 30, 2014

Conversation

jamhall
Copy link
Contributor

@jamhall jamhall commented Aug 17, 2014

Options: sql_indent_size(default: 2), sql_identifiers(default: lower. Options: lower, upper, capitalize). sql_sqlformat_path (path to sqlformat command if not on path). This resolves #63

Also removed MessageView from beautify.coffee

…indent_size(default: 2), sql_identifiers(default: lower. Options: lower, upper, capitalize). sql_sqlformat_path (path to sqlformat command if not on path). This resolves Glavin001#63
@Glavin001 Glavin001 self-assigned this Aug 30, 2014
Glavin001 added a commit that referenced this pull request Aug 30, 2014
Fixes #63. Replacing node-parse with sqlparse (python dependency).
@Glavin001 Glavin001 merged commit e749e23 into Glavin001:master Aug 30, 2014
@Glavin001
Copy link
Owner

test.sql:

Before:

SELECT ca.proj_id AS proj_id, ca.ca_name AS proj_name, ca.ca_date_start AS proj_start, ca.ca_date_end AS proj_end,(SELECT COUNT(*) FROM rotations r WHERE r.proj_id = proj_id AND r.r_status = 'R' GROUP BY r.proj_id) r_count, (SELECT count(*) FROM rotations r WHERE r.proj_id = proj_id AND r.channel_id = 24 ) r_rtb_count FROM projs ca, clients c, proj_auth caa WHERE ca.client_id = 12345 AND ca.client_id = c.client_id AND ca_type = 'zzz' AND c.agency_id = 0 AND ca.client_id = NVL( caa.client_id, ca.client_id ) AND proj_id = NVL( caa.proj_id, proj_id ) AND caa.contact_id = 7890

After:

SELECT ca.proj_id AS proj_id, ca.ca_name AS proj_name, ca.ca_date_start AS proj_start, ca.ca_date_end AS proj_end,
  (SELECT count(*)
   FROM rotations r
   WHERE r.proj_id = proj_id
     AND r.r_status = 'R'
   GROUP BY r.proj_id) r_count,
  (SELECT count(*)
   FROM rotations r
   WHERE r.proj_id = proj_id
     AND r.channel_id = 24) r_rtb_count
FROM projs ca,
     clients c,
     proj_auth caa
WHERE ca.client_id = 12345
  AND ca.client_id = c.client_id
  AND ca_type = 'zzz'
  AND c.agency_id = 0
  AND ca.client_id = nvl(caa.client_id, ca.client_id)
  AND proj_id = nvl(caa.proj_id, proj_id)
  AND caa.contact_id = 7890

test2.sql:

Before:

INSERT INTO client (host, description, created_at) VALUES('hallpclnx', 'My linux machine', CURRENT_TIMESTAMP);
INSERT INTO thread (thread, description, created_at, client_id) VALUES(1, 'Living room camera', CURRENT_TIMESTAMP, 1);
INSERT INTO thread (thread, description, created_at, client_id) VALUES(2, 'Porch camera', CURRENT_TIMESTAMP, 1);
INSERT INTO thread (thread, description, created_at, client_id) VALUES(2, 'Garden camera', CURRENT_TIMESTAMP, 1);
INSERT INTO client (host, description, created_at) VALUES('shedpclnx', 'My shed linux machine', CURRENT_TIMESTAMP);

After:

INSERT INTO client (HOST, description, created_at)
VALUES('hallpclnx',
       'My linux machine',
       CURRENT_TIMESTAMP);


INSERT INTO thread (thread, description, created_at, client_id)
VALUES(1,
       'Living room camera',
       CURRENT_TIMESTAMP,
       1);


INSERT INTO thread (thread, description, created_at, client_id)
VALUES(2,
       'Porch camera',
       CURRENT_TIMESTAMP,
       1);


INSERT INTO thread (thread, description, created_at, client_id)
VALUES(2,
       'Garden camera',
       CURRENT_TIMESTAMP,
       1);


INSERT INTO client (HOST, description, created_at)
VALUES('shedpclnx',
       'My shed linux machine',
       CURRENT_TIMESTAMP);

@Glavin001
Copy link
Owner

Thanks @Flukey! Everything is looking great! Great work.

Glavin001 added a commit that referenced this pull request Aug 30, 2014
@Glavin001
Copy link
Owner

Published as v0.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL beautify - all lines are 'beautified' into one long line
2 participants