Subject: | Improperly formats data type declarations and functions |
Data type declarations get reformatted on multiple lines. And I would
expect the primary key declaration to be on the same line.
Input:
create table department (
dept_id smallint unsigned not null auto_increment,
name varchar(20) not null,
constraint pk_department primary key (dept_id)
)
Output:
create table department (
dept_id smallint unsigned not null auto_increment,
name varchar (
20
)
not null,
constraint pk_department primary key (
dept_id
)
)
Expected:
create table department (
dept_id smallint unsigned not null auto_increment,
name varchar(20) not null,
constraint pk_department primary key (dept_id)
)
Or a common function 'count' gets formatted very oddly.
Input:
select count(*) from department
Output:
select
count (
*
)
from
department
Expected:
select
count(*)
from
department
Looking at making a patch I think the best way to do it would be to
special case the parans that add new lines after a certain set of SQL
keywords. I think SELECT IN FROM but I'm not sure how to catch the
CREATE case. It might require a state flag (_in_create) or something
similar.
What do you think?
I can put together another patch with this update and test cases if
you'd like.