|
|
@@ -15,18 +15,18 @@
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
-
|
|
|
-from notebook.sql_utils import strip_trailing_semicolon
|
|
|
+from beeswax.design import hql_query
|
|
|
+from notebook.sql_utils import strip_trailing_semicolon, split_statements
|
|
|
|
|
|
from nose.tools import assert_equal
|
|
|
|
|
|
def test_split_statements():
|
|
|
- assert_equal([''], ";;;")
|
|
|
- assert_equal(["select * where id == '10'"], "select * where id == '10'")
|
|
|
- assert_equal(["select * where id == '10'"], "select * where id == '10';")
|
|
|
- assert_equal(['select', "select * where id == '10;' limit 100"], "select; select * where id == '10;' limit 100;")
|
|
|
- assert_equal(['select', "select * where id == \"10;\" limit 100"], "select; select * where id == \"10;\" limit 100;")
|
|
|
- assert_equal(['select', "select * where id == '\"10;\"\"\"' limit 100"], "select; select * where id == '\"10;\"\"\"' limit 100;")
|
|
|
+ assert_equal([''], hql_query(";;;").statements)
|
|
|
+ assert_equal(["select * where id == '10'"], hql_query("select * where id == '10'").statements)
|
|
|
+ assert_equal(["select * where id == '10'"], hql_query("select * where id == '10';").statements)
|
|
|
+ assert_equal(['select', "select * where id == '10;' limit 100"], hql_query("select; select * where id == '10;' limit 100;").statements)
|
|
|
+ assert_equal(['select', "select * where id == \"10;\" limit 100"], hql_query("select; select * where id == \"10;\" limit 100;").statements)
|
|
|
+ assert_equal(['select', "select * where id == '\"10;\"\"\"' limit 100"], hql_query("select; select * where id == '\"10;\"\"\"' limit 100;").statements)
|
|
|
|
|
|
def teststrip_trailing_semicolon():
|
|
|
# Note that there are two queries (both an execute and an explain) scattered
|