Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi,

I wonder what the exact parameters for the upload-delete table event are? By accident I coded (generated) an upload-delete event like follows:


DECLARE 
    lv_new lfv_del_pos%ROWTYPE; 
BEGIN
    lv_new.avisnr   :={ml r.avisnr};     -- PK
    lv_new.aviscode :={ml r.aviscode};   -- PK
    lv_new.itemnr   :={ml r.itemnr};     -- PK
    lv_new.amount   :={ml r.amount};     -- NOT PK
    ...
END; 
That runs without any problem (what makes me glad). The column amount isn't part of the primary key of the table neither in the consolidated nor in the remote database. But the documentation seems to say only primary key columns are allowed as parameters for this event: upload_delete table event Of course I don't need the non-pk parameter but I wonder if the doc is wrong or that behaviour may be changed in future releases?

Mayby someone can clarify because that would have impact on the code generation tool.

TIA

Chris Werner

asked 12 Aug '14, 12:18

Chris%20Werner's gravatar image

Chris Werner
20691018
accept rate: 100%

edited 12 Aug '14, 12:20

What's the schema for the table that was generated?

(12 Aug '14, 12:44) Jeff Albion

Consolidated (Oracle):


create table lfv_del_pos 
(
   avisnr    varchar2(10)  not null,
   aviscode  varchar2(1)   not null,
   itemnr    varchar2(18)  not null,
   amount    number(4)     null,
   ml_stat   varchar2(2)   not null,
   ml_lstmod varchar2(14)  not null, 
   constraint pk_lfv_del_pos primary key (avisnr, aviscode, itemnr)
);

Remote (Ultralite):


create table lfv_del_pos 
(
   avisnr    varchar(10)  not null,
   aviscode  varchar(1)   not null,
   itemnr    varchar(18)  not null,
   amount    numeric(4)   null,
   constraint pk_lfv_del_pos primary key (avisnr, aviscode, itemnr)
);

(12 Aug '14, 13:00) Chris Werner

It is possible that Mobilink wants to compare old and new values before deleting the record. E.g. imagine if someone already modified the field "amount". If you want to delete it, because you have old values, you probably will not want to do this. And in theory, you have to fetch the changes again and delete the record.

E.g. the upload part is described here: http://dcx.sybase.com/index.html#1200/en/mlstart/foursteps-ml-basics.html

(13 Aug '14, 02:40) Vlad

Thanks Vlad, you are right, the text explains the behaviour: "The upload consists of a set of new and old row values for rows modified in the remote database. (Updates have new and old row values; deletes have old values; and inserts have new values.)" and that makes sense too. Then the documentation for the upload-delete table event explains the parameters wrong: http://dcx.sybase.com/index.html#sa160/en/mlserver/upload-delete-ml-scriptsref.html*d5e19662

(13 Aug '14, 03:34) Chris Werner

I will not be surprised if these parameters go through all synchronization scripts. Because the request from the device has already reached the server, and it is up to MobiLink to filter or not, parameters that came from the client :)

(14 Aug '14, 02:38) Vlad

The table lists the required parameters (all PK columns) and some of the optional named parameters. Other named parameters, including non-PK columns, can also be used.

FYI, the {ml o.} syntax is only applicable to the upload_update event.

permanent link

answered 19 Aug '14, 12:36

Graham%20Hurst's gravatar image

Graham Hurst
2.7k11843
accept rate: 29%

edited 19 Aug '14, 12:45

Blob column values are not uploaded for delete operations, and so should not be used.

(19 Aug '14, 13:58) Bill Somers
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×371
×23
×13
×10

question asked: 12 Aug '14, 12:18

question was seen: 2,006 times

last updated: 19 Aug '14, 13:58