@@ -69,7 +69,7 @@ func TestParser(t *testing.T) {
6969 "unfinished WHERE statement" ,
7070 "SELECT col FROM table1 WHERE a ==" ,
7171 nil ,
72- fmt .Errorf ("expected identifier, integer, string, but got end: \" \" " ),
72+ fmt .Errorf ("expected identifier, integer, string, placeholder, but got end: \" \" " ),
7373 },
7474 {
7575 "unfinished WHERE statement" ,
@@ -173,6 +173,12 @@ func TestParser(t *testing.T) {
173173 & sql.Select {"table1" , []string {"col1" , "col2" }, & sql.Where {sql.ExprOperation {sql.ExprIdentifier {"col1" }, sql .OperatorEquals , sql.ExprIdentifier {"col2" }}}, "" },
174174 nil ,
175175 },
176+ {
177+ "SELECT FROM with simple WHERE with placeholder" ,
178+ "SELECT col1 FROM table1 WHERE col1 == {0}" ,
179+ & sql.Select {"table1" , []string {"col1" }, & sql.Where {sql.ExprOperation {sql.ExprIdentifier {"col1" }, sql .OperatorEquals , sql.ExprValuePlaceholder {"{0}" }}}, "" },
180+ nil ,
181+ },
176182 {
177183 "SELECT FROM with WHERE AND LIMIT" ,
178184 "SELECT col1, col2 FROM table1 WHERE col1 == col2 AND col3 == col4 LIMIT 10" ,
@@ -220,6 +226,7 @@ func TestParser(t *testing.T) {
220226 for _ , testCase := range testCases {
221227 t .Run (testCase .name , func (t * testing.T ) {
222228 statement , err := sql .Parse (testCase .input )
229+
223230 if testCase .err != nil {
224231 if err == nil {
225232 t .Errorf ("expected error \" %s\" , but got nil" , testCase .err )
0 commit comments