Book a Demo

Author Topic: What is the real risk of using Repository.Execute  (Read 5875 times)

dangel

  • EA User
  • **
  • Posts: 74
  • Karma: +0/-0
    • View Profile
What is the real risk of using Repository.Execute
« on: September 05, 2015, 11:27:01 pm »
I have read it is unsupported method and risky to use!!
so the question why and what is exactly the risk?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: What is the real risk of using Repository.Exec
« Reply #1 on: September 06, 2015, 12:45:19 am »
a) It is unsupported.

b) You can turn your repository into a trash bin by e.g. executing
Code: [Select]
DELETE FROM t_object

 or

UPDATE t_object SET name=' '
.

q.
« Last Edit: September 06, 2015, 12:47:49 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: What is the real risk of using Repository.Exec
« Reply #2 on: September 06, 2015, 04:20:12 pm »
One of the dangers I only discovered recently is that EA only executed the code until the line that contains a comment.
So
Code: [Select]
-- this is my sql code
Delete from t_object
Will actually do nothing as the comment is found on the first line.
In my case it was a bit more devious. I had something like
Code: [Select]
Delete from t_objectproperties
-- where object_ID = 1234
where object_ID in (<selection of object id's>)
and Property = 'Name of TV to be deleted'

The line where object_ID = 1234 was used during testing so I would only delete TV's from one object. So I put that line in comments and then executed the whole thing, resulting in a repository without a single tagged value :o

Luckily I was executing this on a test environment and not directly into the production repository - no harm done ;D

Geert
« Last Edit: September 06, 2015, 04:20:44 pm by Geert.Bellekens »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: What is the real risk of using Repository.Exec
« Reply #3 on: September 06, 2015, 06:49:33 pm »
Whoa. What does this tell us? Sparx code has a comment detection which make things go wrong. So most likely Sparx' code itself has no inline comment ::)

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: What is the real risk of using Repository.Exec
« Reply #4 on: September 07, 2015, 09:51:07 am »
Thanks for the "Heads Up", Geert!    :'(

I presume you reported the bug...

Paolo
« Last Edit: September 07, 2015, 09:52:17 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: What is the real risk of using Repository.Exec
« Reply #5 on: September 07, 2015, 06:42:18 pm »
I guess not. As mentioned so often: the method in question is unsupported.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: What is the real risk of using Repository.Exec
« Reply #6 on: September 07, 2015, 06:46:38 pm »
Quote
I guess not. As mentioned so often: the method in question is unsupported.

q.
No indeed, i did not.
Maybe we could anyway. Who knows, it might even get fixed one day.

Geert