-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): stats are missing for update queries (#527)
- Loading branch information
Showing
5 changed files
with
60 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
305104 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
cat <<SQL | ${BENDSQL} | ||
CREATE TABLE t3 ( | ||
category_id INT NOT NULL, | ||
region_id INT NOT NULL, | ||
user_id BIGINT NOT NULL, | ||
product_id INT NOT NULL, | ||
transaction_date DATETIME NOT NULL, | ||
transaction_amount DECIMAL(10,2) NOT NULL, | ||
discount_amount DECIMAL(10,2) NOT NULL, | ||
is_returned BOOLEAN NOT NULL DEFAULT 0, | ||
inventory_count INT NOT NULL, | ||
last_updated TIMESTAMP NOT NULL | ||
); | ||
create table r like t3 engine = random; | ||
insert into t3 select * from r limit 305104; | ||
SQL | ||
|
||
|
||
a=`${BENDSQL} --stats --query=""" | ||
update t3 set user_id = user_id + 1 where inventory_count % 10 >= 0; | ||
""" 2>&1 | grep -oE '([0-9]+) rows written' | grep -oE '([0-9]+)'` | ||
|
||
|
||
b=`${BENDSQL} --stats --query=""" | ||
update t3 set user_id = user_id + 1 where inventory_count % 10 < 0; | ||
""" 2>&1 | grep -oE '([0-9]+) rows written' | grep -oE '([0-9]+)'` | ||
|
||
echo "$[a+b]" | ||
|
||
|
||
cat <<SQL | ${BENDSQL} | ||
DROP TABLE IF EXISTS t3; | ||
SQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters