How can I parse throught such script ?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

How can I parse throught such script ?

Post by swierzbicki » Fri 09 Sep 2005 13:31

Hi,

I'm working with complex script.
Here is one example (of many scripts i'm using).
/*Mise à jour Répartition par entêtes groupe de produits Bennes*/

/*Affectation du devis*/
Set @Devis = :IdDevis;

/*Récupération de la variante principale*/
Set @VariantePrincipale = (Select MIN(IdVarianteClient) from DevisFE2000 Where DevisFE2000.IdDevis = @Devis);

/*Calcul du PRE Total grp produit pour proratisation cout benne*/
Set @PRETotalGrpProduitBenne =
(Select SUM(PVTotalProduitHT) + SUM(PVTotalPoseHT )
from DevisFE2000
INNER JOIN devisrepartition ON (DevisFE2000.IdDevis=devisrepartition.IdDevis)
Where DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` not in ('LO1','LO2','S')
and DevisFE2000.`IDVarianteClient` = @VariantePrincipale
and devisrepartition.IdGroupeProduitRepartition = 'LO2'
and devisrepartition.IdGroupeProduit = DevisFE2000.IdGroupeProduit);

/*Calcul du cout benne total*/
Set @CoutBenneTotal = (Select SUM(PVTotalProduitHT)
from DevisFE2000
Where DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` in ('LO2'));

/*Passage de tous les repères a zéro*/
UPDATE DevisFE2000
Set
DevisFE2000.`ProrataCoutBenne` = 0
Where
DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` not in ('LO1','LO2','S');

/*Passage de tous les repères a zéro*/
UPDATE DevisFE2000
Set
DevisFE2000.`Visible` = 0
Where
DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` in ('LO2');


/*Mise à jour des Entetes principales de la variante principale par rapport au groupe produit Cout Benne*/
UPDATE DevisFE2000,DevisRepartition
Set
DevisFE2000.`ProrataCoutBenne` = (DevisFE2000.PRETotalProduitHT / @PRETotalGrpProduitBenne) * @CoutBenneTotal
Where
DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` not in ('LO1','LO2','S')
and DevisFE2000.`IDVarianteClient` = @VariantePrincipale
and DevisFE2000.IdDevis = DevisRepartition.IdDevis
and DevisRepartition.`IdGroupeProduitRepartition` = 'LO2'
and devisrepartition.IdGroupeProduit = DevisFE2000.IdGroupeProduit;


/*Mise à jour des Entetes principales des autres variante*/
DROP TEMPORARY TABLE IF EXISTS DevisFE200GrpTmp;
CREATE TEMPORARY TABLE IF NOT EXISTS DevisFE200GrpTmp
Select
DevisFE2000.`ProrataCoutBenne`,
DevisFE2000.`IdRepereClient`
From DevisFE2000
Where
DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` not in ('LO1','LO2','S')
and DevisFE2000.`IDVarianteClient` = @VariantePrincipale;

UPDATE DevisFE2000,DevisFE200GrpTmp
Set
DevisFE2000.`ProrataCoutBenne` = DevisFE200GrpTmp.`ProrataCoutBenne`
Where
DevisFE2000.IdDevis = @Devis and DevisFE2000.entete and DevisFE2000.`IdGroupeProduit` not in ('LO1','LO2','S')
and DevisFE2000.`IDVarianteClient` @VariantePrincipale AND DevisFE2000.`IdRepereClient`= DevisFE200GrpTmp.`IdRepereClient`;

DROP TEMPORARY TABLE IF EXISTS DevisFE200GrpTmp;
How can I parse through all available statement ?
Could you please provide us the ability of doing this ?

I'll be happy to have a function giving me a statement :

Script.parse;
Test:= Script.SQLStatement[1]

This is HIGHLY missing in crlab mydac product

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 09 Sep 2005 15:13

Now MyDAC does not provide such functionality

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Fri 09 Sep 2005 15:55

I add, like in my previous post on the same topic, I'm also in the need of this. I don't care if it's directly integrated, a small explanation of how to do this with the internal parser would be enought.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Fri 09 Sep 2005 18:21

Yes, is that so much work for giving us an exemple ?

Post Reply