select_query_with_cipher.xml 4.1 KB
Newer Older
L
Liang Zhang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ 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.
  -->

<rewrite-assertions yaml-rule="yaml/encrypt-rewrite-rule-query-with-cipher.yaml">
    <!-- FIXME SQL92 -->
    <rewrite-assertion id="encrypt_only_with_parameters" db-type="MySQL">
        <input sql="SELECT * FROM t_cipher WHERE encrypt_1 = ? or encrypt_2 = ?" parameters="1, 2" />
        <output sql="SELECT * FROM t_cipher WHERE cipher_1 = ? or cipher_2 = ?" parameters="encrypt_1, encrypt_2" />
    </rewrite-assertion>
    
    <!-- FIXME SQL92 -->
    <rewrite-assertion id="encrypt_only_with_literals" db-type="MySQL">
        <input sql="SELECT * FROM t_cipher WHERE encrypt_1 = 1 or encrypt_2 = 2" />
        <output sql="SELECT * FROM t_cipher WHERE cipher_1 = 'encrypt_1' or cipher_2 = 'encrypt_2'" />
    </rewrite-assertion>

    <!-- FIXME SQL92 -->
    <rewrite-assertion id="query_encrypt_with_parameters" db-type="MySQL">
        <input sql="SELECT encrypt_1, encrypt_2 FROM t_cipher_assisted_query WHERE encrypt_1 = ? or encrypt_2 = ?" parameters="1, 2" />
        <output sql="SELECT cipher_1, cipher_2 FROM t_cipher_assisted_query WHERE assisted_query_1 = ? or assisted_query_2 = ?" parameters="assisted_query_1, assisted_query_2" />
    </rewrite-assertion>

    <!-- FIXME SQL92 -->
    <rewrite-assertion id="query_encrypt_with_literals" db-type="MySQL">
        <input sql="SELECT encrypt_1, encrypt_2 FROM t_cipher_assisted_query WHERE encrypt_1 = 1 or encrypt_2 = 2" />
        <output sql="SELECT cipher_1, cipher_2 FROM t_cipher_assisted_query WHERE assisted_query_1 = 'assisted_query_1' or assisted_query_2 = 'assisted_query_2'" />
    </rewrite-assertion>
    
    <!-- FIXME SQL92 -->
    <rewrite-assertion id="plain_encrypt_with_parameters" db-type="MySQL">
        <input sql="SELECT encrypt_1, encrypt_2 FROM t_cipher_plain WHERE encrypt_1 = ? or encrypt_2 = ?" parameters="1, 2" />
        <output sql="SELECT cipher_1, cipher_2 FROM t_cipher_plain WHERE cipher_1 = ? or cipher_2 = ?" parameters="encrypt_1, encrypt_2" />
    </rewrite-assertion>
    
    <!-- FIXME SQL92 -->
    <rewrite-assertion id="plain_encrypt_with_literals" db-type="MySQL">
        <input sql="SELECT encrypt_1, encrypt_2 FROM t_cipher_plain WHERE encrypt_1 = 1 or encrypt_2 = 2" />
        <output sql="SELECT cipher_1, cipher_2 FROM t_cipher_plain WHERE cipher_1 = 'encrypt_1' or cipher_2 = 'encrypt_2'" />
    </rewrite-assertion>
    
    <!-- FIXME SQL92 -->
    <rewrite-assertion id="plain_encrypt_with_parameters" db-type="MySQL">
        <input sql="SELECT encrypt_1 as alias FROM t_cipher_assisted_query_plain WHERE encrypt_1 in (?, ?) and encrypt_2 in (?, ?)" parameters="1, 2, 3, 4" />
        <output sql="SELECT cipher_1 as alias FROM t_cipher_assisted_query_plain WHERE assisted_query_1 IN (?, ?) and assisted_query_2 IN (?, ?)" parameters="assisted_query_1, assisted_query_2, assisted_query_3, assisted_query_4" />
    </rewrite-assertion>
    
    <!-- FIXME SQL92 -->
    <rewrite-assertion id="plain_encrypt_with_literals" db-type="MySQL">
        <input sql="SELECT encrypt_1 as alias FROM t_cipher_assisted_query_plain WHERE encrypt_1 in (1, 2) and encrypt_2 in (3, 4)" />
        <output sql="SELECT cipher_1 as alias FROM t_cipher_assisted_query_plain WHERE assisted_query_1 IN ('assisted_query_1', 'assisted_query_2') and assisted_query_2 IN ('assisted_query_3', 'assisted_query_4')" />
    </rewrite-assertion>
</rewrite-assertions>