Demo entry 1808073

my mysql latex

   

Submitted by anonymous on Jun 03, 2015 at 17:10
Language: MySQL. Code size: 972 Bytes.

-- running as buddy_updater
USE buddy;

set @user_name = CONCAT(conv(floor(rand() * 99999999999999), 20, 36), UNIX_TIMESTAMP());
set @user_role = 'agent';
set @desc = CONCAT('desc ' , CONCAT(conv(floor(rand() * 99999999999999), 20, 36) , UNIX_TIMESTAMP()));
set @rsa_pub_key = CONCAT(CONCAT(conv(floor(rand() * 99999999999999), 20, 36)  , CONCAT(conv(floor(rand() * 99999999999999), 20, 36) , CONCAT(conv(floor(rand() * 99999999999999), 20, 36) ))));

-- for checks
set @last_inserted_user_id = -1;
set @rows_inserted = -1;

start transaction;
INSERT INTO `v_service_user`
(`user_name`,
 `user_role`,
 `desc`,
 `rsa_pub_key`
 )
VALUES (
  @user_name,
  @user_role,
  @desc,
  @rsa_pub_key)
 ;

-- set before commit;
set @rows_inserted = ROW_COUNT();

commit;

set @last_inserted_user_id = LAST_INSERT_ID();

select @rows_inserted;
select @last_inserted_user_id;

select * from `v_service_user`
where `user_id` = @last_inserted_user_id;

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).