@@ -6,26 +6,14 @@ namespace SQLitePCL.pretty.Orm
66{
77 internal static class SQLBuilder
88 {
9- internal const string ReIndex = "REINDEX" ;
10-
11- internal static string AlterTableRename ( string table , string newName )
12- {
13- return string . Format ( "ALTER TABLE \" {0}\" RENAME TO \" {1}\" " , table , newName ) ;
14- }
15-
169 internal static string DeleteAll ( string tableName )
1710 {
1811 return string . Format ( "DELETE FROM \" {0}\" " , tableName ) ;
1912 }
2013
21- internal static string DropTable ( string tableName )
22- {
23- return string . Format ( "DROP TABLE \" {0}\" " , tableName ) ;
24- }
25-
2614 internal static string DropTableIfExists ( string tableName )
2715 {
28- return string . Format ( "DROP TABLE If EXISTS \" {0}\" " , tableName ) ;
16+ return string . Format ( "DROP TABLE IF EXISTS \" {0}\" " , tableName ) ;
2917 }
3018
3119 internal static string GetTableInfo ( string tableName )
@@ -53,17 +41,6 @@ internal static string DeleteUsingPrimaryKey(string tableName, string pkColumn)
5341 return string . Format ( "DELETE FROM \" {0}\" WHERE \" {1}\" = ?" , tableName , pkColumn ) ;
5442 }
5543
56- internal static string Insert ( string tableName , IEnumerable < string > columns )
57- {
58- return string . Format (
59- "INSERT INTO \" {0}\" ({1}) VALUES ({2})" ,
60- tableName ,
61- string . Join ( "," , columns . Select ( x => "\" " + x + "\" " ) ) ,
62-
63- // FIXME: Might need to quote this for some cases. Test!!!
64- string . Join ( "," , columns . Select ( x => ":" + x ) ) ) ;
65- }
66-
6744 internal static string InsertOrReplace ( string tableName , IEnumerable < string > columns )
6845 {
6946 return string . Format (
@@ -81,21 +58,6 @@ internal static string CreateIndex(string indexName, string tableName, IEnumerab
8158 return String . Format ( sqlFormat , tableName , string . Join ( "\" , \" " , columnNames ) , unique ? "UNIQUE" : "" , indexName ) ;
8259 }
8360
84- internal static string CreateIndex ( string indexName , string tableName , string columnName , bool unique )
85- {
86- return CreateIndex ( indexName , tableName , new string [ ] { columnName } , unique ) ;
87- }
88-
89- internal static string CreateIndex ( string tableName , string columnName , bool unique )
90- {
91- return CreateIndex ( NameIndex ( tableName , new String [ ] { columnName } ) , tableName , columnName , unique ) ;
92- }
93-
94- internal static string CreateIndex ( string tableName , IEnumerable < string > columnNames , bool unique )
95- {
96- return CreateIndex ( NameIndex ( tableName , columnNames ) , tableName , columnNames , unique ) ;
97- }
98-
9961 internal static string NameIndex ( string tableName , IEnumerable < string > columnNames )
10062 {
10163 return tableName + "_" + string . Join ( "_" , columnNames ) ;
@@ -116,11 +78,6 @@ internal static string IndexInfo(string indexName)
11678 return string . Format ( "PRAGMA INDEX_INFO (\" {0}\" )" , indexName ) ;
11779 }
11880
119- internal static string ReIndexWithName ( string name )
120- {
121- return "REINDEX " + name ;
122- }
123-
12481 internal static string CreateTableIfNotExists ( string tableName , CreateFlags createFlags , IReadOnlyDictionary < string , ColumnMapping > columns )
12582 {
12683 bool fts3 = ( createFlags & CreateFlags . FullTextSearch3 ) != 0 ;
0 commit comments