mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Fix extra spaces in type definitions with parentheses
At the moment space is inserted between all tokens from which a type
consists. This adds extra spaces to types like VARCHAR(5) which become
"VARCHAR ( 5 )" which causes problems in some applications.
This patch modifies the way tokens are concatenated for a type. It makes
sure that the extra space isn't inserted before "(" and ")" and also
after "(".
This commit is contained in:
committed by
Martin Kleusberg
parent
c5e91976c8
commit
18bcbf138f
@@ -935,7 +935,28 @@ void CreateTableWalker::parsecolumn(Table* table, antlr::RefAST c)
|
||||
c = c->getNextSibling(); //type?
|
||||
if(c != antlr::nullAST && c->getType() == sqlite3TokenTypes::TYPE_NAME)
|
||||
{
|
||||
type = concatTextAST(c->getFirstChild(), true);
|
||||
antlr::RefAST t = c->getFirstChild();
|
||||
|
||||
if(t != antlr::nullAST)
|
||||
{
|
||||
type.clear();
|
||||
}
|
||||
|
||||
while(t != antlr::nullAST)
|
||||
{
|
||||
int thisType = t->getType();
|
||||
type.append(textAST(t));
|
||||
t = t->getNextSibling();
|
||||
if(t != antlr::nullAST)
|
||||
{
|
||||
int nextType = t->getType();
|
||||
if(nextType != sqlite3TokenTypes::LPAREN && nextType != sqlite3TokenTypes::RPAREN &&
|
||||
thisType != sqlite3TokenTypes::LPAREN)
|
||||
{
|
||||
type.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
c = c->getNextSibling();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user