Get current session /process id from inside a mysql query

Posted by Indra Ginanjar on Stack Overflow See other posts from Stack Overflow or by Indra Ginanjar
Published on 2010-04-13T04:54:47Z Indexed on 2010/04/13 6:52 UTC
Read the original article Hit count: 189

Filed under:

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?

© Stack Overflow or respective owner

Related posts about mysql