Get current session /process id from inside a mysql query
- by Indra Ginanjar
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?