 
 
  
  
MobiLink Synchronization User's Guide
  The CustDB Sample Application
    Maintaining the customer and order primary key pools
The following scripts are defined in the ULOrderIDPool table:
download_cursor The download_cursor script for CustDB is as follows:
SELECT pool_order_id FROM ULOrderIDPool
  WHERE last_modified > ?
    AND pool_emp_id = ?end_upload This end_upload script ensures that after each upload 20 order IDs remain in the order ID pool.
CALL ULOrderIDPool_maintain( ? )
The UL_OrderIDPool_maintain procedure for CustDB is as follows:
ALTER PROCEDURE ULOrderIDPool_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 ULOrderIDPool
    WHERE pool_emp_id = syncuser_id;
  -- Top up the pool with new ids
  WHILE pool_count < 20 LOOP
    INSERT INTO ULOrderIDPool ( pool_emp_id )
      VALUES ( syncuser_id );
    SET pool_count = pool_count + 1;
  END LOOP;
ENDupload_insert The upload_insert script for CustDB is as follows:
INSERT INTO ULOrderIDPool ( pool_order_id ) VALUES( ? )
upload_delete The upload_delete script for CustDB is as follows:
DELETE FROM ULOrderIDPool WHERE pool_order_id = ?
 
 
  
 