@@ -54,7 +54,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
54
54
DBConnection . execute ( conn , cached , params , options )
55
55
end
56
56
57
- @ impl true
58
57
def execute (
59
58
conn ,
60
59
% Exqlite.Query { statement: statement , ref: nil } ,
@@ -64,7 +63,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
64
63
execute ( conn , statement , params , options )
65
64
end
66
65
67
- @ impl true
68
66
def execute ( conn , sql , params , options ) when is_binary ( sql ) or is_list ( sql ) do
69
67
query = Exqlite.Query . build ( name: "" , statement: IO . iodata_to_binary ( sql ) )
70
68
@@ -75,7 +73,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
75
73
end
76
74
end
77
75
78
- @ impl true
79
76
def execute ( conn , query , params , options ) do
80
77
case DBConnection . execute ( conn , query , params , options ) do
81
78
{ :ok , _ } = ok -> ok
@@ -163,7 +160,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
163
160
raise ArgumentError , "locks are not supported by SQLite3"
164
161
end
165
162
166
- @ impl true
167
163
def all ( query , as_prefix \\ [ ] ) do
168
164
sources = create_names ( query , as_prefix )
169
165
@@ -233,7 +229,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
233
229
raise ArgumentError , "JOINS are not supported on DELETE statements by SQLite"
234
230
end
235
231
236
- @ impl true
237
232
def delete_all ( query ) do
238
233
sources = create_names ( query , [ ] )
239
234
cte = cte ( query , sources )
@@ -261,7 +256,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
261
256
]
262
257
end
263
258
264
- @ impl true
265
259
def insert ( prefix , table , header , rows , on_conflict , returning , _placeholders ) do
266
260
fields = quote_names ( header )
267
261
@@ -371,6 +365,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do
371
365
##
372
366
373
367
@ impl true
368
+ def execute_ddl ( { _command , % Table { options: options } , _ } ) when is_list ( options ) do
369
+ raise ArgumentError , "SQLite3 adapter does not support keyword lists in :options"
370
+ end
371
+
374
372
def execute_ddl ( { :create , % Table { } = table , columns } ) do
375
373
{ table , composite_pk_def } = composite_pk_definition ( table , columns )
376
374
composite_fk_defs = composite_fk_definitions ( table , columns )
@@ -390,7 +388,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
390
388
]
391
389
end
392
390
393
- @ impl true
394
391
def execute_ddl ( { :create_if_not_exists , % Table { } = table , columns } ) do
395
392
{ table , composite_pk_def } = composite_pk_definition ( table , columns )
396
393
composite_fk_defs = composite_fk_definitions ( table , columns )
@@ -410,7 +407,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
410
407
]
411
408
end
412
409
413
- @ impl true
414
410
def execute_ddl ( { :drop , % Table { } = table } ) do
415
411
[
416
412
[
@@ -420,12 +416,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do
420
416
]
421
417
end
422
418
423
- @ impl true
424
419
def execute_ddl ( { :drop , % Table { } = table , _mode } ) do
425
420
execute_ddl ( { :drop , table } )
426
421
end
427
422
428
- @ impl true
429
423
def execute_ddl ( { :drop_if_exists , % Table { } = table } ) do
430
424
[
431
425
[
@@ -435,12 +429,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do
435
429
]
436
430
end
437
431
438
- @ impl true
439
432
def execute_ddl ( { :drop_if_exists , % Table { } = table , _mode } ) do
440
433
execute_ddl ( { :drop_if_exists , table } )
441
434
end
442
435
443
- @ impl true
444
436
def execute_ddl ( { :alter , % Table { } = table , changes } ) do
445
437
Enum . map ( changes , fn change ->
446
438
[
@@ -599,16 +591,14 @@ defmodule Ecto.Adapters.SQLite3.Connection do
599
591
quote_name ( index . name ) ,
600
592
" ON " ,
601
593
quote_table ( index . prefix , index . table ) ,
602
- ?\s ,
603
- ?( ,
594
+ " (" ,
604
595
fields ,
605
596
?) ,
606
597
if_do ( index . where , [ " WHERE " , to_string ( index . where ) ] )
607
598
]
608
599
]
609
600
end
610
601
611
- @ impl true
612
602
def execute_ddl ( { :create_if_not_exists , % Index { } = index } ) do
613
603
fields = intersperse_map ( index . columns , ", " , & index_expr / 1 )
614
604
@@ -621,21 +611,18 @@ defmodule Ecto.Adapters.SQLite3.Connection do
621
611
quote_name ( index . name ) ,
622
612
" ON " ,
623
613
quote_table ( index . prefix , index . table ) ,
624
- ?\s ,
625
- ?( ,
614
+ " (" ,
626
615
fields ,
627
616
?) ,
628
617
if_do ( index . where , [ " WHERE " , to_string ( index . where ) ] )
629
618
]
630
619
]
631
620
end
632
621
633
- @ impl true
634
622
def execute_ddl ( { :create , % Constraint { } } ) do
635
623
raise ArgumentError , "SQLite3 does not support ALTER TABLE ADD CONSTRAINT."
636
624
end
637
625
638
- @ impl true
639
626
def execute_ddl ( { :drop , % Index { } = index } ) do
640
627
[
641
628
[
@@ -645,12 +632,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do
645
632
]
646
633
end
647
634
648
- @ impl true
649
635
def execute_ddl ( { :drop , % Index { } = index , _mode } ) do
650
636
execute_ddl ( { :drop , index } )
651
637
end
652
638
653
- @ impl true
654
639
def execute_ddl ( { :drop_if_exists , % Index { } = index } ) do
655
640
[
656
641
[
@@ -660,22 +645,18 @@ defmodule Ecto.Adapters.SQLite3.Connection do
660
645
]
661
646
end
662
647
663
- @ impl true
664
648
def execute_ddl ( { :drop_if_exists , % Index { } = index , _mode } ) do
665
649
execute_ddl ( { :drop_if_exists , index } )
666
650
end
667
651
668
- @ impl true
669
652
def execute_ddl ( { :drop , % Constraint { } , _mode } ) do
670
653
raise ArgumentError , "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."
671
654
end
672
655
673
- @ impl true
674
656
def execute_ddl ( { :drop_if_exists , % Constraint { } , _mode } ) do
675
657
raise ArgumentError , "SQLite3 does not support ALTER TABLE DROP CONSTRAINT."
676
658
end
677
659
678
- @ impl true
679
660
def execute_ddl ( { :rename , % Table { } = current_table , % Table { } = new_table } ) do
680
661
[
681
662
[
@@ -687,7 +668,6 @@ defmodule Ecto.Adapters.SQLite3.Connection do
687
668
]
688
669
end
689
670
690
- @ impl true
691
671
def execute_ddl ( { :rename , % Table { } = table , current_column , new_column } ) do
692
672
[
693
673
[
@@ -701,10 +681,8 @@ defmodule Ecto.Adapters.SQLite3.Connection do
701
681
]
702
682
end
703
683
704
- @ impl true
705
684
def execute_ddl ( string ) when is_binary ( string ) , do: [ string ]
706
685
707
- @ impl true
708
686
def execute_ddl ( keyword ) when is_list ( keyword ) do
709
687
raise ArgumentError , "SQLite3 adapter does not support keyword lists in execute"
710
688
end
@@ -1842,7 +1820,10 @@ defmodule Ecto.Adapters.SQLite3.Connection do
1842
1820
def quote_table ( table ) , do: quote_entity ( table )
1843
1821
1844
1822
defp quote_table ( nil , name ) , do: quote_entity ( name )
1845
- defp quote_table ( prefix , name ) , do: [ quote_entity ( prefix ) , ?. , quote_entity ( name ) ]
1823
+
1824
+ defp quote_table ( _prefix , _name ) do
1825
+ raise ArgumentError , "SQLite3 does not support table prefixes"
1826
+ end
1846
1827
1847
1828
defp quote_entity ( val ) when is_atom ( val ) do
1848
1829
quote_entity ( Atom . to_string ( val ) )
0 commit comments