开发者

Get current session /process id from inside a mysql query

开发者 https://www.devze.com 2022-12-27 04:29 出处:网络
I\'m trying to create a table for pseudo array variable. That looks like CREATETABLE IF NOT EXISTS `MyArray`.`ArrayTable` (

I'm trying to create a table for pseudo array variable. That looks like

CREATE  TABLE IF NOT EXISTS `MyArray`.`ArrayTable` (
  `ID` INT UNSIGNED NOT NULL COMMENT 'Hash value of SessionID + ArrayName' ,
  `SessionID` INT UNSIGNED NOT NULL ,
  `ArrayName` CHAR(26) NOT NULL 
          COMMENT '32 digit char - 6 digit longest process id (assumtion)' ,
  `Index` INT UNSIGNED NOT NULL ,
  `Value` TEXT NOT NULL ,
  PRIMARY KEY (`ID`, `SessionID`) )
ENGINE = MyISAM;

The table is not normalized yet, 'hope this will make it a little simpler to understand :)

To avoid collission between client, there should be a differentiator between client session. For that reason i think need to know current session/开发者_高级运维process id (just like "SHOW PROCESSLIST") but really need to know IN WHICH process the query are?


You can use connection_id() function.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号