73357335 return new Dictionary<string, string>
73367336 {
73377337 { string.Empty, "string" }, // default
7338- { "blob", "byte[]" },
7339- { "real", "double" },
7340- { "integer", "int" },
7341- { "text", "string" }
7338+ { "bigint", "long" },
7339+ { "blob", "byte[]" },
7340+ { "boolean", "bool" },
7341+ { "character", "string" },
7342+ { "clob", "string" },
7343+ { "date", "DateTime" },
7344+ { "datetime", "DateTime" },
7345+ { "decimal", "double" },
7346+ { "double", "double" },
7347+ { "double precision", "double" },
7348+ { "float", "double" },
7349+ { "int", "long" },
7350+ { "int2", "long" },
7351+ { "int8", "long" },
7352+ { "integer", "long" },
7353+ { "mediumint", "long" },
7354+ { "native character", "string" },
7355+ { "nchar", "string" },
7356+ { "numeric", "decimal" },
7357+ { "nvarchar", "string" },
7358+ { "real", "double" },
7359+ { "smallint", "int" },
7360+ { "text", "string" },
7361+ { "unsigned big int", "long" },
7362+ { "varchar", "string" },
7363+ { "varying character", "string" }
73427364 };
73437365 }
73447366
@@ -14712,16 +14734,16 @@ ORDER BY SchemaName, TableName, TriggerName;";
1471214734 {
1471314735 return @"
1471414736SELECT 'main' AS SchemaName,
14715- tbl_name AS TableName,
14737+ TableName,
1471614738 TableType,
1471714739 0 AS TableTemporalType,
14718- cid AS Ordinal,
14740+ Ordinal,
1471914741 ColumnName,
1472014742 IsNullable,
1472114743 REPLACE(type, '(' || length || ')', '') AS TypeName,
14722- CASE WHEN INSTR(type, ',') > 0 THEN 0 ELSE length END AS [MaxLength],
14744+ length AS [MaxLength],
1472314745 Precision,
14724- dflt_value AS [Default],
14746+ [Default],
1472514747 0 AS DateTimePrecision,
1472614748 Scale,
1472714749 pk AS IsIdentity,
@@ -14732,22 +14754,22 @@ SELECT 'main' AS SchemaName,
1473214754 pk AS PrimaryKey,
1473314755 pk AS PrimaryKeyOrdinal,
1473414756 0 AS IsForeignKey
14735- FROM (SELECT m.tbl_name,
14736- CASE WHEN m.type = 'table' THEN 'BASE TABLE' ELSE 'VIEW' END AS TableType,
14737- c.cid,
14738- c.name AS ColumnName,
14739- LOWER(c.type) AS type,
14740- 1 - c.""notnull"" AS IsNullable,
14741- c.dflt_value,
14742- c. pk,
14743- SUBSTR(c.type, INSTR(c.type, '(') + 1, INSTR(c.type, ')') - INSTR(c.type, '(') - 1) AS length,
14744- CAST(SUBSTR(c.type, INSTR(c.type, '(') + 1, INSTR(c.type, ',') - INSTR(c.type, '(') - 1) AS INTEGER) AS Precision,
14745- CAST(SUBSTR(c.type, INSTR(c.type, ',') + 1, INSTR(c.type, ')') - INSTR(c.type, ',') - 1) AS INTEGER) AS Scale
14746- FROM sqlite_master m
14747- JOIN PRAGMA_TABLE_INFO(m.name) c
14748- WHERE m.type IN ('table', 'view')
14749- AND m.name NOT LIKE 'sqlite_%')
14750- ORDER BY tbl_name, cid ;";
14757+ FROM (SELECT m.tbl_name AS TableName ,
14758+ CASE WHEN m.type = 'table' THEN 'BASE TABLE' ELSE 'VIEW' END AS TableType,
14759+ c.cid AS Ordinal ,
14760+ c.name AS ColumnName,
14761+ IIF(INSTR(c.type, '(') > 0, SUBSTR(LOWER(c.type), 0, INSTR(c.type, '(')), LOWER(c.type)) as type,
14762+ 1 - c.""notnull"" AS IsNullable,
14763+ c.dflt_value AS [Default] ,
14764+ c.pk AS pk,
14765+ CAST( SUBSTR(c.type, INSTR(c.type, '(') + 1, INSTR(c.type, ')') - INSTR(c.type, '(') - 1) AS INTEGER ) AS length,
14766+ CAST(SUBSTR(c.type, INSTR(c.type, '(') + 1, INSTR(c.type, ',') - INSTR(c.type, '(') - 1) AS INTEGER) AS Precision,
14767+ CAST(SUBSTR(c.type, INSTR(c.type, ',') + 1, INSTR(c.type, ')') - INSTR(c.type, ',') - 1) AS INTEGER) AS Scale
14768+ FROM sqlite_master m
14769+ JOIN PRAGMA_TABLE_INFO(m.name) c
14770+ WHERE m.type IN ('table', 'view')
14771+ AND m.name NOT LIKE 'sqlite_%')
14772+ ORDER BY TableName, Ordinal ;";
1475114773 }
1475214774
1475314775 protected override string ForeignKeySQL()
@@ -14784,12 +14806,12 @@ ORDER BY m.name;";
1478414806 {
1478514807 return @"
1478614808WITH split(TableName, IndexName, KeyOrdinal, ColumnName, csv) AS (
14787- SELECT TableName,
14809+ SELECT TableName,
1478814810 IndexName,
1478914811 KeyOrdinal,
1479014812 '',
1479114813 column_name || ','
14792- FROM (SELECT TableName,
14814+ FROM (SELECT TableName,
1479314815 IndexName,
1479414816 0 AS KeyOrdinal,
1479514817 SUBSTR(sql, INSTR(sql, '(') + 1, INSTR(sql, ')') - INSTR(sql, '(') - 1) AS column_name
@@ -14799,26 +14821,27 @@ WITH split(TableName, IndexName, KeyOrdinal, ColumnName, csv) AS (
1479914821 FROM sqlite_master
1480014822 WHERE type = 'index'
1480114823 AND name NOT LIKE 'sqlite_%'))
14802- UNION ALL
14803- SELECT TableName,
14824+ UNION ALL
14825+ SELECT TableName,
1480414826 IndexName,
1480514827 KeyOrdinal + 1,
1480614828 SUBSTR(csv, 0, INSTR(csv, ',')),
1480714829 SUBSTR(csv, INSTR(csv, ',') + 1)
14808- FROM split
14809- WHERE csv != '')
14830+ FROM split
14831+ WHERE csv != '')
1481014832SELECT 'main' AS TableSchema,
1481114833 s.TableName,
1481214834 s.IndexName,
1481314835 s.KeyOrdinal,
14814- TRIM(s.ColumnName),
14815- 0 AS IsUnique,
14816- 0 AS IsPrimaryKey,
14817- 0 AS IsUniqueConstraint,
14836+ TRIM(s.ColumnName) as ColumnName,
1481814837 (SELECT MAX(KeyOrdinal)
1481914838 FROM split x
1482014839 WHERE x.TableName = s.TableName
14821- AND x.IndexName = s.IndexName) AS ColumnCount
14840+ AND x.IndexName = s.IndexName) AS ColumnCount,
14841+ 0 AS IsUnique,
14842+ 0 AS IsPrimaryKey,
14843+ 0 AS IsUniqueConstraint,
14844+ 0 as IsClustered
1482214845FROM split s
1482314846WHERE ColumnName != ''";
1482414847 }
@@ -14851,9 +14874,9 @@ WHERE ColumnName != ''";
1485114874 protected override string TriggerSQL()
1485214875 {
1485314876 return @"
14854- SELECT 'main' AS TableSchema , tbl_name as TableName, name as TriggerName
14877+ SELECT 'main' AS SchemaName , tbl_name AS TableName, name AS TriggerName
1485514878FROM sqlite_master
14856- WHERE type = 'trigger'; ";
14879+ WHERE type = 'trigger'";
1485714880 }
1485814881
1485914882 protected override string[] MemoryOptimisedSQL()
0 commit comments