Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fqlite/export/SQLiteDatabaseCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void createDatabaseAndSchema(List<TableDescriptor> tables, TableDescripto

// iterate over all Descriptor objects, extract the original SQL command and execute it
for(TableDescriptor desc : tables) {
if (desc.sql.isEmpty() || desc.tblname.startsWith("sqlite_"))
if (desc.sql.isEmpty() || desc.tblname.startsWith("sqlite_") || desc.isVirtual())
continue;

String stm = createTableSql(desc.tblname,desc.columnnames,desc.sqltypes, isWAL);
Expand Down
18 changes: 13 additions & 5 deletions src/fqlite/parser/SimpleSQLiteParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ private TableDescriptor parseCreateTable(String stmt)

@Override public void enterColumn_name(SQLiteParser.Column_nameContext ctx)
{
sqltypes_defined = false;

if(inForeignTable)
{
inForeignTable = false;
Expand All @@ -383,10 +381,19 @@ private TableDescriptor parseCreateTable(String stmt)
{
return;
}
cons="";

String colname = ctx.getText();

// Sanity check for duplicate column name
// TODO: This happens unfortunately in yet unhandled construct "CHECK(...)"
if(colnames.contains(colname))
{
return;
}

sqltypes_defined = false;

cons="";

//System.out.println("enterColumn_name()::colname =" + colname);

if (!colname.equals("CONSTRAINT"))
Expand Down Expand Up @@ -423,7 +430,8 @@ private TableDescriptor parseCreateTable(String stmt)
value = value.trim();

// case: there is actually no type info given, but a NOT NULL constraint
if(value.equals("NOT"))
// or DEFAULT XXX
if(value.equals("NOT") || value.equals("DEFAULT"))
value = "BLOB";
if(value.isEmpty())
value = "BLOB";
Expand Down