Re: LAST_INSERT_ID and CRC32

2009-05-06 Thread thun...@isfahan.at
Thank you very much for all answers I will trying Triggers and the example with the update after an INSERT. Ant then, I use the best for me;-) Thunder Yes, Triggers... I so rarely use them I forget they exist. On Tue, May 5, 2009 at 10:22 AM, Thomas Pundt mli...@rp-online.de wrote:

Re: LAST_INSERT_ID and CRC32

2009-05-05 Thread Thomas Pundt
Johnny Withers schrieb: Well, I think an update after insert is the only way. Other than perpopulating another table with possibe crc values then usinga join: Select id from testtable Inner join crctable on testtable.id=crctable.id Where crctable.crcval='xxx' Just be sure to index the

Re: LAST_INSERT_ID and CRC32

2009-05-05 Thread Johnny Withers
Yes, Triggers... I so rarely use them I forget they exist. On Tue, May 5, 2009 at 10:22 AM, Thomas Pundt mli...@rp-online.de wrote: Johnny Withers schrieb: Well, I think an update after insert is the only way. Other than perpopulating another table with possibe crc values then usinga join:

LAST_INSERT_ID and CRC32

2009-05-03 Thread thun...@isfahan.at
Hello, I have a questions and I hope, that is possible in MySQL. I have the following short Table. CREATE TABLE IF NOT EXISTS `testtable` ( `id` bigint(20) unsigned NOT NULL auto_increment, `id-crc` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id-crc` (`id-crc`) )

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread Johnny Withers
INTO testtable(NULL,LAST_INSERT_ID()); INSERT INTO testtable(NULL,LAST_INSERT_ID()); would produce IDCRC32ID 1 0 2 1 You could run an update immediately after the insert to set the CRC32 column: UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE id=LAST_INSERT_ID

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread thun...@isfahan.at
1 You could run an update immediately after the insert to set the CRC32 column: UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE id=LAST_INSERT_ID(); Not quite sure why you need the CRC32 value of the ID, will it not always be the same value for the given ID number? Wouldn't it be easier

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread thun...@isfahan.at
to set the CRC32 column: UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE id=LAST_INSERT_ID(); Not quite sure why you need the CRC32 value of the ID, will it not always be the same value for the given ID number? Wouldn't it be easier to do it on the select side of the equation? SELECT id

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread Johnny Withers
(NULL,LAST_INSERT_ID()); would produce ID    CRC32ID 1       0 2       1 You could run an update immediately after the insert to set the CRC32 column: UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE id=LAST_INSERT_ID(); Not quite sure why you need the CRC32 value of the ID