on dev help sign in
a little more correct
commit56365bd9c56ae91eed08007cbce1e2ed3c461def authorEitan Chatav <eitan.chatav@gmail.com> dateMon 14 Aug 2017, 17:00 (9 years ago) parent5b78685
3 files changed+13−13
squeal-postgresql/exe/Example.hs+1−1 squeal-postgresql/src/Squeal/PostgreSQL/Statement.hs+8−8 squeal-postgresql/test/Squeal/PostgreSQL/StatementSpec.hs+4−4
squeal-postgresql/exe/Example.hs+1−1
@@ -62,7 +62,7 @@ main = do
6262 ( Values
6363 (param (Proxy @1) `As` #col1 :* param (Proxy @2) `As` #col2 :* Nil)
6464 [param (Proxy @3) `As` #col1 :* param (Proxy @4) `As` #col2 :* Nil]
65− ) Conflict ReturningNil
65+ ) Conflict (Returning Nil)
6666 liftBase $ Char8.putStrLn "manipulating"
6767 _ <- pqExecParams manipulation (1::Int32,2::Int32,3::Int32,4::Int32)
6868 liftBase $ Char8.putStrLn "querying"
squeal-postgresql/src/Squeal/PostgreSQL/Statement.hs+8−8
@@ -900,9 +900,9 @@ SELECT statements
900900
901901select
902902 :: SListI columns
903− => NP (Aliased (Expression params tables grouping)) columns
903+ => NP (Aliased (Expression params tables grouping)) (column ': columns)
904904 -> TableExpression params schema tables grouping
905− -> Query schema params columns
905+ -> Query schema params (column ': columns)
906906select list tabs = UnsafeQuery $
907907 "SELECT"
908908 <+> renderCommaSeparated (renderAliased renderExpression) list
@@ -936,9 +936,9 @@ CREATE statements
936936createTable
937937 :: (KnownSymbol table, SListI columns)
938938 => Alias table
939− -> NP (Aliased TypeExpression) columns
940− -> [TableConstraint schema columns]
941− -> Definition schema (Create table columns schema)
939+ -> NP (Aliased TypeExpression) (column ': columns)
940+ -> [TableConstraint schema (column ': columns)]
941+ -> Definition schema (Create table (column ': columns) schema)
942942createTable table columns constraints = UnsafeDefinition $
943943 "CREATE TABLE" <+> renderAlias table
944944 <+> parenthesized
@@ -1167,10 +1167,10 @@ data ReturningClause
11671167 (columns :: [(Symbol,ColumnType)])
11681168 (results :: [(Symbol,ColumnType)])
11691169 where
1170− ReturningNil :: ReturningClause params columns '[]
11711170 ReturningStar :: ReturningClause params columns columns
11721171 Returning
1173− :: NP (Aliased (Expression params '[table ::: columns] 'Ungrouped)) results
1172+ :: NP (Aliased (Expression params '[table ::: columns] 'Ungrouped))
1173+ results
11741174 -> ReturningClause params columns results
11751175
11761176renderReturningClause
@@ -1178,8 +1178,8 @@ renderReturningClause
11781178 => ReturningClause params columns results
11791179 -> ByteString
11801180renderReturningClause = \case
1181− ReturningNil -> ";"
11821181 ReturningStar -> " RETURNING *;"
1182+ Returning Nil -> ";"
11831183 Returning results -> " RETURNING"
11841184 <+> renderCommaSeparated (renderAliased renderExpression) results <> ";"
11851185
squeal-postgresql/test/Squeal/PostgreSQL/StatementSpec.hs+4−4
@@ -102,7 +102,7 @@ spec = do
102102 statement :: Manipulation Tables '[] '[]
103103 statement =
104104 insertInto #table1 (Values (2 `As` #col1 :* 4 `As` #col2 :* Nil) [])
105− Conflict ReturningNil
105+ Conflict (Returning Nil)
106106 statement `manipulationRenders`
107107 "INSERT INTO table1 (col1, col2) VALUES (2, 4);"
108108 it "correctly renders returning INSERTs" $ do
@@ -120,7 +120,7 @@ spec = do
120120 statement :: Manipulation Tables '[] '[]
121121 statement =
122122 update #table1 (Set 2 `As` #col1 :* Same `As` #col2 :* Nil)
123− (#col1 /=* #col2) ReturningNil
123+ (#col1 /=* #col2) (Returning Nil)
124124 statement `manipulationRenders`
125125 "UPDATE table1 SET col1 = 2\
126126 \ WHERE (col1 <> col2);"
@@ -142,7 +142,7 @@ spec = do
142142 insertInto #table1 (Values (2 `As` #col1 :* 4 `As` #col2 :* Nil) [])
143143 (OnConflictDoUpdate
144144 (Set 2 `As` #col1 :* Same `As` #col2 :* Nil) (#col1 /=* #col2))
145− ReturningNil
145+ (Returning Nil)
146146 statement `manipulationRenders`
147147 "INSERT INTO table1 (col1, col2) VALUES (2, 4)\
148148 \ ON CONFLICT DO UPDATE\
@@ -173,7 +173,7 @@ spec = do
173173 statement :: Manipulation StudentsTable '[] '[]
174174 statement = insertInto #students
175175 (Values ("Robert'); DROP TABLE students;" `As` #name :* Nil) [])
176− Conflict ReturningNil
176+ Conflict (Returning Nil)
177177 statement `manipulationRenders`
178178 "INSERT INTO students (name) VALUES (E'Robert''); DROP TABLE students;');"
179179 describe "JOINs" $ do