DanilGholtsman
DanilGholtsman

Reputation: 2374

Sparx EA : detect what database type currently using

Is there are way to detect what type of database currenlty is in use as project datasource?

Because I need to get some inner scripts information. And, in case of simple .EAP project, SQL-query would look like (because of Access db in use):

_repository.SQLQuery(string.Format(@"SELECT * FROM t_script WHERE Notes LIKE '*Script Name=""{0}""*';", scriptName));

But, in case of SQL server I need to execute (as you already guessed I bet) slighly different written query: _repository.SQLQuery(string.Format(@"SELECT * FROM t_script WHERE Notes LIKE '%Script Name=""{0}""%';", scriptName));

So, is it possible?

UPD:

I found one option - looks like there are _repository.ConnectionString property which could be parsed

"SparxEaDatabase --- DBType=1;Connect=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SparxEaDatabase;Data Source=SOURCENAME;LazyLoad=1;"

Is there are more?

Upvotes: 2

Views: 276

Answers (1)

qwerty_so
qwerty_so

Reputation: 36333

I would just look into Repository.RepositoryType. This will return for Example: JET, MYSQL, or SQLSVR.

Upvotes: 2

Related Questions