以下のスクリプトは、ULCustomerIDPool テーブルで定義されています。
download_cursor
SELECT pool_cust_id FROM ULCustomerIDPool WHERE last_modified >= {ml s.last_table_download} AND pool_emp_id = {ml s.username} |
upload_insert CustDB の upload_insert スクリプトを次に示します。
INSERT INTO ULCustomerIDPool ( pool_cust_id ) VALUES( {ml r.pool_cust_id} ) |
upload_delete CustDB の upload_delete スクリプトを次に示します。
DELETE FROM ULCustomerIDPool WHERE pool_cust_id = {ml r.pool_cust_id} |
end_upload 次の end_upload スクリプトは、各アップロードの完了後に 20 個の顧客 ID が顧客 ID プールに残るように処理を行います。
CALL ULOrderIDPool_maintain( {ml s.username} ) |
CustDB の UL_CustomerIDPool_maintain プロシージャを次に示します。
CREATE PROCEDURE ULCustomerIDPool_maintain ( IN syncuser_id INTEGER ) BEGIN DECLARE pool_count INTEGER; -- Determine how many ids to add to the pool SELECT COUNT(*) INTO pool_count FROM ULCustomerIDPool WHERE pool_emp_id = syncuser_id; -- Top up the pool with new ids WHILE pool_count < 20 LOOP INSERT INTO ULCustomerIDPool ( pool_emp_id ) VALUES ( syncuser_id ); SET pool_count = pool_count + 1; END LOOP; END |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |