GitXplorerGitXplorer
F

Bee

public
1 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
2bae17d3f99aff212d2c18c3a80604160014cec4

解决处理select中有sum, +-*/产生的问题

FFanduzi committed 7 years ago
Unverified
433f7fd3c3c2cd107c9b1b613f4ee886bc17359a

代码错误

FFanduzi committed 7 years ago
Unverified
099159271f2f2b4c68f8364112b44f8e56e4b65a

修复query-print处理标量子查询报错的问题

FFanduzi committed 7 years ago
Verified
8711e7ad495d850dbc3de293b8e3f1de0a8437d4

Update README.md

FFanduzi committed 7 years ago
Unverified
86176ff2f723540b14a76d3930373cf4a632fd7f

...

FFanduzi committed 7 years ago
Unverified
13fb1261f81d3d873a5848812c75c299411d8b4d

增加显示rollback_statement

FFanduzi committed 7 years ago

README

The README file for this repository.

Bee

Usage:
        Bee.py PUT_INCEPTION_ARS_HERE (--sql=<sql> | --file=<sqlfile>) [--log-file=<log>]
        Bee.py --help
        Bee.py --version
Options:
        --help                                 查看帮助信息.
        --version                              查看版本信息.
        --verbose                              输出更多信息
        --sql=<sql>                            传递给Inception的SQL语句.
        --file=<sqlfile>                       传递给Inception的包含SQL语句的文件.
        --log-file=<log>                       log file [default: ./Bee.log]

Example

[root@datanode-2 17:37:41 ~/fanboshi/Hornet]
#python Bee.py --user=innet --password=fanboshi --host=192.168.2.54 --port=3308 --enable-check --sql="update fandb.fan set uname = 6 where id>19;select * from fandb.fan;"
select tablename from 192_168_2_54_3308_fandb.`$_$Inception_backup_information$_$` where opid_time='0_0_0'

+----+---------+----------+-----------------+-----------------------------------------------+--------------------------------------------+---------------+----------+-------------------------+--------------+---------+--------------------+
| id |  stage  | errlevel |   stafestatus   |                  errormessage                 |                    sql                     | affected_rows | sequence |      backup_dbname      | execute_time | SQLSHA1 | rollback_statement |
+----+---------+----------+-----------------+-----------------------------------------------+--------------------------------------------+---------------+----------+-------------------------+--------------+---------+--------------------+
| 1  | CHECKED |    0     | Audit completed |                      None                     | update fandb.fan set uname = 6 where id>19 |       2       | '0_0_0'  | 192_168_2_54_3308_fandb |      0       |         |                    |
| 2  | CHECKED |    1     | Audit completed | set the where condition for select statement. |          select * from fandb.fan           |       0       | '0_0_1'  |           None          |      0       |         |                    |
|    |         |          |                 |        Select only star is not allowed.       |                                            |               |          |                         |              |         |                    |
+----+---------+----------+-----------------+-----------------------------------------------+--------------------------------------------+---------------+----------+-------------------------+--------------+---------+--------------------+

[root@datanode-2 17:39:44 ~/fanboshi/Hornet]
#python Bee.py --user=innet --password=fanboshi --host=192.168.2.54 --port=3308 --enable-execute --sql="update fandb.fan set uname=666 where id=19"
select tablename from 192_168_2_54_3308_fandb.`$_$Inception_backup_information$_$` where opid_time='1529401204_1324_0'

+----+----------+----------+----------------------+--------------+--------------------------------------------+---------------+---------------------+-------------------------+--------------+---------+-------------------------------------------------------+
| id |  stage   | errlevel |     stafestatus      | errormessage |                    sql                     | affected_rows |       sequence      |      backup_dbname      | execute_time | SQLSHA1 |                   rollback_statement                  |
+----+----------+----------+----------------------+--------------+--------------------------------------------+---------------+---------------------+-------------------------+--------------+---------+-------------------------------------------------------+
| 1  | EXECUTED |    0     | Execute Successfully |     None     | update fandb.fan set uname=666 where id=19 |       1       | '1529401204_1324_0' | 192_168_2_54_3308_fandb |    0.000     |         | UPDATE `fandb`.`fan` SET id=19,uname='6' WHERE id=19; |
|    |          |          | Backup successfully  |              |                                            |               |                     |                         |              |         |                                                       |
+----+----------+----------+----------------------+--------------+--------------------------------------------+---------------+---------------------+-------------------------+--------------+---------+-------------------------------------------------------+

[root@datanode-2 17:40:04 ~/fanboshi/Hornet]
#python Bee.py --user=innet --password=fanboshi --host=192.168.2.54 --port=3308 --enable-query-print --sql="select uname from fandb.fan where id=19"
{
    "command": "select",
    "select_list": [
        {
            "type": "FIELD_ITEM",
            "db": "fandb",
            "table": "fan",
            "field": "uname"
        }
    ],
    "table_ref": [
        {
            "db": "fandb",
            "table": "fan"
        }
    ],
    "where": [
        {
            "type": "FUNC_ITEM",
            "func": "=",
            "args": [
                {
                    "type": "FIELD_ITEM",
                    "db": "fandb",
                    "table": "fan",
                    "field": "id"
                },
                {
                    "type": "INT_ITEM",
                    "value": "19"
                }
            ]
        }
    ]
}
Selected columns:
                        fandb.fan.uname

[root@datanode-2 17:40:17 ~/fanboshi/Hornet]
#cat sqlfile.sql | python Bee.py --user=innet --password=fanboshi --host=192.168.2.54 --port=3308 --enable-check
select tablename from 192_168_2_54_3308_fandb.`$_$Inception_backup_information$_$` where opid_time='0_0_1'

+----+---------+----------+-----------------+-----------------------------------------------+--------------------------------------------+---------------+----------+-------------------------+--------------+---------+--------------------+
| id |  stage  | errlevel |   stafestatus   |                  errormessage                 |                    sql                     | affected_rows | sequence |      backup_dbname      | execute_time | SQLSHA1 | rollback_statement |
+----+---------+----------+-----------------+-----------------------------------------------+--------------------------------------------+---------------+----------+-------------------------+--------------+---------+--------------------+
| 1  | CHECKED |    1     | Audit completed | set the where condition for select statement. |          select * from fandb.fan           |       0       | '0_0_0'  |           None          |      0       |         |                    |
|    |         |          |                 |        Select only star is not allowed.       |                                            |               |          |                         |              |         |                    |
| 2  | CHECKED |    0     | Audit completed |                      None                     | update fandb.fan set uname = 6 where id>19 |       2       | '0_0_1'  | 192_168_2_54_3308_fandb |      0       |         |                    |
+----+---------+----------+-----------------+-----------------------------------------------+--------------------------------------------+---------------+----------+-------------------------+--------------+---------+--------------------+