cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove a list of "ml_add_table_script" executions from mobilink consolidated database ?

Former Member
0 Kudos
1,480

Hi,

we have a legacy tool that helps us generate a list of "ml_add_table_script" executions, but whenever having changes I get a new list of "ml_add_table_script" executions... and the "script_version" table gets a bit hard to oversee.

It looks like this procedure mostly just fills the tables "ml_script_version", "ml_script", "ml_table_script" ...

I would like to perform a litle clean up.

Would it be okay If i just write my own script to remove contenst from "ml_table_script", "ml_script" and "ml_script_version" .... Or would I still be missing something ? (or maybe there is a better way?)

Thank you,

Breck_Carter
Participant

In addition to what Volker said...

What version of MobiLink server are you running? There have been changes to the supporting tables, so any suggestions about "what's safe to purge and what must be protected if you don't want all your syncs to fail" depend on the version.

Also, what software are you using for the consolidated database?

Before purging anything, however, get your house in order; i.e., test you script creation process on an empty database to make sure that (a) it creates everything you need and (b) doesn't leave anything unnecessary behind when you run it multiple times. IMO all the scripts should be maintained in text files just like any other critical piece of source code (which they are)... and they should be written to be re-runnable without issue.

VolkerBarth
Contributor

FWIW, a look at the MobiLink setup script for the according consolidated database (in folder %SQLANYxx%\\MobiLink\\Setup) may help to get to know the implementation of the ML system procedures. That way you may see if you are missing something...

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

AFAIK the official way to delete unnecessary scripts is to add them with NULL as script contents, such as

ml_add_table_script('v1', 'Customer', 'upload_insert', NULL);


Immediately accessing the ML system tables may work, too, but it may also bear the risk of having missed something, as you suspect...


If you need to delete more than a few scripts, it certainly is possible to generate the according ml_add_...script statements automatically, e.g. with a cursor loop over the according script entries and then calling the ml system procedure with the appropriate parameters. In case you are using SQL Anywhere as consolidated database, the FOR statement would be handy IMHO to do so.

Breck_Carter
Participant

[thread-drift]

Or CALL ml_add_table_script ( 'v1', 'hello_world', 'upload_insert', '' ); for a HANA consolidated. The rules might have changed (they are CONSTANTLY changing for HANA), and I can't remember if NULL throws an error or just gets converted to '', but HANA does not support calling stored procedures with NULLs for scalar input parameters. The synchana.sql script accomodates this fact (and the possibility that NULL will be supported eventually:

if :p_script is not null and :p_script <> '' then

IMO MobiLink should have always have treated '' as a delete request... or maybe not, since SQL Server and Oracle rules for ''-versus-NULL are both different and both wrong 🙂

[/thread-drift]

Former Member

Hi, I accepted your answer. Also thanks for all the other comments. I'm using oracle as a consolidated database. I guess I'll have to modify the legacy app that generates the ml_add_table_script to also generate a delete script with Null as the last parameter...

Answers (0)