labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
HVDataBulkInsert
Parameters
Name
Type
Mode
incoming
text
IN
Definition
BEGIN DECLARE table_name VARCHAR(50) DEFAULT ''; DECLARE columns_list VARCHAR(2000) DEFAULT ''; DECLARE values_list TEXT DEFAULT ''; DECLARE cur_position INT DEFAULT 1; DECLARE cur_string VARCHAR(2000); DECLARE delimiter_length TINYINT UNSIGNED; DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK; DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK; SET cur_position = 1; SET delimiter_length = CHAR_LENGTH('||'); WHILE CHAR_LENGTH(incoming) > 0 AND cur_position > 0 DO SET cur_position = INSTR(incoming, '||'); IF cur_position = 0 THEN SET cur_string = incoming; ELSE SET cur_string = LEFT(incoming, cur_position - 1); END IF; IF TRIM(cur_string) != '' THEN CALL HVDataInsert(cur_string); END IF; SET incoming = SUBSTRING(incoming, cur_position + delimiter_length); END WHILE; END