@@ -182,31 +182,6 @@ public void testGoogleStandardSQLRemoveCommentsGsql() {
182182 .isEqualTo ("SELECT * FROM FOO" );
183183 }
184184
185- @ Test
186- public void testPostgreSQLDialectRemoveCommentsGsql () {
187- assumeTrue (dialect == Dialect .POSTGRESQL );
188-
189- assertThat (parser .removeCommentsAndTrim ("/*GSQL*/" )).isEqualTo ("/*GSQL*/" );
190- assertThat (parser .removeCommentsAndTrim ("/*GSQL*/SELECT * FROM FOO" ))
191- .isEqualTo ("/*GSQL*/SELECT * FROM FOO" );
192- assertThat (
193- parser .removeCommentsAndTrim (
194- "/*GSQL*/-- This is a one line comment\n SELECT * FROM FOO" ))
195- .isEqualTo ("/*GSQL*/SELECT * FROM FOO" );
196- assertThat (
197- parser .removeCommentsAndTrim (
198- "/*GSQL*//* This is a simple multi line comment */\n SELECT * FROM FOO" ))
199- .isEqualTo ("/*GSQL*/SELECT * FROM FOO" );
200- assertThat (
201- parser .removeCommentsAndTrim (
202- "/*GSQL*//* This is a \n multi line comment */\n SELECT * FROM FOO" ))
203- .isEqualTo ("/*GSQL*/SELECT * FROM FOO" );
204- assertThat (
205- parser .removeCommentsAndTrim (
206- "/*GSQL*//* This\n is\n a\n multi\n line\n comment */\n SELECT * FROM FOO" ))
207- .isEqualTo ("/*GSQL*/SELECT * FROM FOO" );
208- }
209-
210185 @ Test
211186 public void testStatementWithCommentContainingSlash () {
212187 String sql =
@@ -1003,103 +978,6 @@ private <T extends ClientSideStatementImpl> void testParseStatementWithOneParame
1003978 assertParsing (withSuffix (")" , statement ), statementClass );
1004979 }
1005980
1006- @ Test
1007- public void testConvertPositionalParametersToNamedParametersWithGsqlException () {
1008- assertThat (
1009- parser .convertPositionalParametersToNamedParameters (
1010- '?' , "/*GSQL*/select * from foo where name=?" )
1011- .sqlWithNamedParameters )
1012- .isEqualTo ("/*GSQL*/select * from foo where name=@p1" );
1013- assertThat (
1014- parser .convertPositionalParametersToNamedParameters (
1015- '?' , "/*GSQL*/?'?test?\" ?test?\" ?'?" )
1016- .sqlWithNamedParameters )
1017- .isEqualTo ("/*GSQL*/@p1'?test?\" ?test?\" ?'@p2" );
1018- assertThat (
1019- parser .convertPositionalParametersToNamedParameters ('?' , "/*GSQL*/?'?it\\ '?s'?" )
1020- .sqlWithNamedParameters )
1021- .isEqualTo ("/*GSQL*/@p1'?it\\ '?s'@p2" );
1022- assertThat (
1023- parser .convertPositionalParametersToNamedParameters ('?' , "/*GSQL*/?'?it\\ \" ?s'?" )
1024- .sqlWithNamedParameters )
1025- .isEqualTo ("/*GSQL*/@p1'?it\\ \" ?s'@p2" );
1026- assertThat (
1027- parser .convertPositionalParametersToNamedParameters ('?' , "/*GSQL*/?\" ?it\\ \" ?s\" ?" )
1028- .sqlWithNamedParameters )
1029- .isEqualTo ("/*GSQL*/@p1\" ?it\\ \" ?s\" @p2" );
1030- assertThat (
1031- parser .convertPositionalParametersToNamedParameters ('?' , "/*GSQL*/?'''?it\\ '?s'''?" )
1032- .sqlWithNamedParameters )
1033- .isEqualTo ("/*GSQL*/@p1'''?it\\ '?s'''@p2" );
1034- assertThat (
1035- parser .convertPositionalParametersToNamedParameters (
1036- '?' , "/*GSQL*/?\" \" \" ?it\\ \" ?s\" \" \" ?" )
1037- .sqlWithNamedParameters )
1038- .isEqualTo ("/*GSQL*/@p1\" \" \" ?it\\ \" ?s\" \" \" @p2" );
1039-
1040- assertThat (
1041- parser .convertPositionalParametersToNamedParameters (
1042- '?' ,
1043- "/*GSQL*/select 1, ?, 'test?test', \" test?test\" , foo.* from `foo` where col1=? and col2='test' and col3=? and col4='?' and col5=\" ?\" and col6='?''?''?'" )
1044- .sqlWithNamedParameters ,
1045- is (
1046- equalTo (
1047- "/*GSQL*/select 1, @p1, 'test?test', \" test?test\" , foo.* from `foo` where col1=@p2 and col2='test' and col3=@p3 and col4='?' and col5=\" ?\" and col6='?''?''?'" )));
1048-
1049- assertThat (
1050- parser .convertPositionalParametersToNamedParameters (
1051- '?' ,
1052- "/*GSQL*/select * "
1053- + "from foo "
1054- + "where name=? "
1055- + "and col2 like ? "
1056- + "and col3 > ?" )
1057- .sqlWithNamedParameters ,
1058- is (
1059- equalTo (
1060- "/*GSQL*/select * "
1061- + "from foo "
1062- + "where name=@p1 "
1063- + "and col2 like @p2 "
1064- + "and col3 > @p3" )));
1065- assertThat (
1066- parser .convertPositionalParametersToNamedParameters (
1067- '?' , "/*GSQL*/select * " + "from foo " + "where id between ? and ?" )
1068- .sqlWithNamedParameters ,
1069- is (equalTo ("/*GSQL*/select * " + "from foo " + "where id between @p1 and @p2" )));
1070- assertThat (
1071- parser .convertPositionalParametersToNamedParameters (
1072- '?' , "/*GSQL*/select * " + "from foo " + "limit ? offset ?" )
1073- .sqlWithNamedParameters ,
1074- is (equalTo ("/*GSQL*/select * " + "from foo " + "limit @p1 offset @p2" )));
1075- assertThat (
1076- parser .convertPositionalParametersToNamedParameters (
1077- '?' ,
1078- "/*GSQL*/select * "
1079- + "from foo "
1080- + "where col1=? "
1081- + "and col2 like ? "
1082- + "and col3 > ? "
1083- + "and col4 < ? "
1084- + "and col5 != ? "
1085- + "and col6 not in (?, ?, ?) "
1086- + "and col7 in (?, ?, ?) "
1087- + "and col8 between ? and ?" )
1088- .sqlWithNamedParameters ,
1089- is (
1090- equalTo (
1091- "/*GSQL*/select * "
1092- + "from foo "
1093- + "where col1=@p1 "
1094- + "and col2 like @p2 "
1095- + "and col3 > @p3 "
1096- + "and col4 < @p4 "
1097- + "and col5 != @p5 "
1098- + "and col6 not in (@p6, @p7, @p8) "
1099- + "and col7 in (@p9, @p10, @p11) "
1100- + "and col8 between @p12 and @p13" )));
1101- }
1102-
1103981 @ Test
1104982 public void testGoogleStandardSQLDialectConvertPositionalParametersToNamedParameters () {
1105983 assumeTrue (dialect == Dialect .GOOGLE_STANDARD_SQL );
0 commit comments