Giter Club home page Giter Club logo

stuff-dbms's People

Contributors

midenok avatar

Watchers

 avatar  avatar

stuff-dbms's Issues

MySQL 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/

MDEV-6268: SPIDER table with no COMMENT clause causes queries to wait forever

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)
      ) {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.