midenok / stuff-dbms Goto Github PK
View Code? Open in Web Editor NEWDBMS-related stuff and tips
DBMS-related stuff and tips
Doesn't work with declared vars:
drop function if exists inline_var_test;
delimiter ;;
create function inline_var_test()
returns int unsigned
deterministic
modifies sql data
begin
declare var int unsigned;
update table set col1 = (var := col2), col2 = 0 where id = 1;
return var;
end;;
delimiter ;
Though it works with session vars:
drop function if exists inline_var_test;
delimiter ;;
create function inline_var_test()
returns int unsigned
deterministic
modifies sql data
begin
update table set col1 = (@var := col2), col2 = 0 where id = 1;
return @var;
end;;
delimiter ;
Types are NOT wrapped, like in C:
drop function if exists type_test;
delimiter ;;
create function type_test(n int unsigned)
returns int unsigned
deterministic
modifies sql data
begin
if n = -1 then
return 1;
end if;
return n;
end;;
delimiter ;
mysql> select type_test(-1);
+---------------+
| type_test(-1) |
+---------------+
| 0 |
+---------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1264 | Out of range value for column 'n' at row 1 |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
mysql> select type_test(4294967295);
+-----------------------+
| type_test(4294967295) |
+-----------------------+
| 4294967295 |
+-----------------------+
1 row in set (0.00 sec)
mysql> select type_test(42949672950);
+------------------------+
| type_test(42949672950) |
+------------------------+
| 4294967295 |
+------------------------+
1 row in set, 1 warning (0.00 sec)
Links:
http://www.xaprb.com/blog/2006/12/15/advanced-mysql-user-variable-techniques/
Source: MDEV-6268
Init spider table:
mysql < src/storage/spider/scripts/install_spider.sql
Can't reproduce for both 127.0.0.1
and localhost
. Suspicion is on loop inside spider_get_share()
:
for (
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, -1, share->link_count,
SPIDER_LINK_STATUS_RECOVERY);
roop_count < (int) share->link_count;
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.