close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 18 years ago

Closed 17 years ago

#485 closed defect (fixed)

DBSeries makes the series global

Reported by: Francisco Muñoz Owned by: Víctor de Buen Remiro
Priority: normal Milestone:
Component: DataBase Version: 1.1.5
Severity: normal Keywords:
Cc:

Description

DBSeries creates global series allways, even if you get a set.

Sample code: I removed a couple of layers of functions from but it gives the same error.

Real DBOpen(GlAlias, GlUser, GlPass);
Text ThQuery4Output =

"select valueDate, value

from texttable " +

" where output = " + SqlFormatText("Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori", GesAct) +
" order by valueDate asc";
Set testDBS =DBSeries(

ThQuery4Output,
Eval(Name(Trimestral)),
SetOfText("Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori")

);

Serie Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori = SubSer(testDBS[1],y2001m01d01,y2006m07d01);
/
Fails because Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori seems already defined even if its inside of the testDBS set...

Past versions doesn't have this behaviour and it really hinders migration to new ones. Or at least should have

Change History (3)

comment:1 Changed 18 years ago by Víctor de Buen Remiro

Owner: changed from danirus to Víctor de Buen Remiro

Sorry, I don't understand you.

You say "DBSeries creates global series allways, even if you get a set."

1)DBSeries always returns a set, why you write "even"?

2)DBSeries always has globalized by default its series in all old versions of TOL

3)There is a global variable Real GlobalizeSeries to control if you want to globalize or not series returned by DBSeries* and IncludeBDT that are called in a local scope.

4)A set is not a local scope. Only code between {} is a local scope.

You must call DBSeries in a local scope, its to say between {}, and set GlobalizeSeries to 0 and this is the behaviour since some years ago.

If you runs DBSeries without matching these conditions its possible that global series remains in memory avoiding a future right local calling. Then you must to restart TOL. This is the only circumstance that I've get to reproduce your complaint. Please, test this TOL code in a clean TOL session and tell us if problem is fixed:

Real GlobalizeSeries := 0;

Real DBOpen(GlAlias, GlUser, GlPass);
Set testDBS =
{

Text ThQuery4Output =

"select valueDate, value

from texttable " +

" where output = " +

SqlFormatText("Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori", GesAct) +

" order by valueDate asc";

DBSeries(

ThQuery4Output,
Eval(Name(Trimestral)),
SetOfText("Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori")

)

};

Serie Pos_Tot_AB_Vod_Lin_Mi_Tri_Ori =

SubSer(testDBS[1],y2001m01d01,y2006m07d01);

I cannot check exactly this code due I don´t have your database but I've checked a similar one and it works as expected.

Thanks to report and I hope this answer help you

Victor de Buen
Tol Development Team

comment:2 Changed 18 years ago by Francisco Muñoz

Currently my the code works with 1.1.3 but fails in 1.1.5.
It isn't very important as the code can be used with that version, but I wanted to get the new database speed improvments.
Using your example I tried to wrap the call in { } but also fails.
Maybe is a problem with some of the functions used in the project.
A small example...

Real DBOpen(Alias, User, Password);
Serie Pre_Tot_BN_Ora_Lin_Mi_Men =

ToPrevEnd (Serie {SqlDerDatGetSerie( "0604_C",
"Pre_Tot_BN_Ora_Lin_Mi_Men",Mensual, ?)});

ToPrevEnd is only a SubSer wrapper and
SqlDerDatGetSerie is defined as...

Serie SqlDerDatGetSerie
(

Text ArSesi,
Text ArDerived,
TimeSet ArDating,
Real ArDefault

)

{

Text ThQuery =
"select valueDate, value

from " + TDerivedData +

" where derived = " + SqlFormatText(ArDerived, GesAct) +
" and sesi = " + SqlFormatText(ArSesi, GesAct) +
" order by valueDate asc";

Real SqlTrace("SqlDerDatGetSerie", "Llamando a SqlDBSeries");

Set ThSerieS = SqlDBSeries(

ThQuery,
ArDating,
SetOfText(ArDerived),
SetOfText("Datos de tabla " + TDerivedData + " para derived " +

ArDerived + " y sesi " + ArSesi),

ArDefault

);

Serie If(IsEmpty(ThSerieS),

{

Real SqlTrace("SqlDerDatGetSerie",
"ERROR: no se encuentran registros asociados al output
<" + ArDerived + "> y sesi <" + ArSesi + ">");
CalInd(C, ArDating)

},
ThSerieS[1]

)

};

comment:3 Changed 17 years ago by Víctor de Buen Remiro

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.