Lorenzo,

Try this, if may help you .-

Procedure Main()
   Local ID_TAB_AGENTI := "TAB_AGENTI"
   Local ID_TAB_CODDSP := "TAB_AGENTI"
   Local cSql          := "select 'Hello' as fld"
   Local cAnnDsp       := "2000"
   Local cFrmSQL

#pragma __cstream|cFrmSQL:=%s

select ( select substr( crectab, 1, 20 ) as crectab
   from tabtab where ctiptab = %1$t
   and ckeytab = ccodage order by 1 ) as cdesage, ;
   sum( case when ( select substr( crectab, 35, 1 ) from tabtab
   where ctiptab = %2$t and ckeytab = ccoddsp ) = '' or
   ( select substr( crectab, 35, 1 ) from tabtab
   where ctiptab = %2$t and ckeytab = ccoddsp ) is null
   then nimpdsp
   else 0 end) as ntotfat0,
   sum( case when ( select substr( crectab, 35,1 ) from tabtab
   where ctiptab = %2$t and ckeytab = ccoddsp ) = '1'
   then nimpdsp
   else 0 end) as ntotfat1,sum(nimpdsp) as ntotdsp,
   %3$s from tabtotdsp
   left join tabtab on tabtab.ctiptab= %2$t and ccoddsp=tabtab.ckeytab
   where canndoc = %4$t

#pragma __endtext

   ? sql_Sprintf( cFrmSQL, ID_TAB_AGENTI, ID_TAB_CODDSP, cSql, cAnnDsp )

   Wait
return

It seems to me that does the same and more.

HTH
--
Xavi

El 24/02/2010 21:03, Lorenzo Fiorini escribió:
On Wed, Feb 24, 2010 at 8:10 PM, Viktor Szakáts

It would be good to hear from you (as the only known
user of this feature) what is the benefit of using it,
f.e. over #pragma __cstream. Maybe there exists better
solution to keep support for it, than build-time or
compile-time switch.

For me it is not a compatibility issue but an absolute requirement.
All my code counts on it and will ever do. It would be completely
INSANE to write sql statements without HB_PP_MULTILINE.

This is a small example:

...
cSql := "select ( select substr( crectab, 1, 20 ) as crectab ;
                         from tabtab where ctiptab = '" + ID_TAB_AGENTI + "' ;
                          and ckeytab = ccodage order by 1 ) as cdesage, ;
                          sum( case when ( select substr( crectab, 35,
1 ) from tabtab ;
                                             where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '' or ;
                                         ( select substr( crectab, 35,
1 ) from tabtab ;
                                             where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) is null ;
                                    then nimpdsp ;
                                    else 0 end) as ntotfat0, ;
                          sum( case when ( select substr( crectab, 35,
1 ) from tabtab ;
                                             where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '1' ;
                                    then nimpdsp ;
                                    else 0 end) as ntotfat1,
sum(nimpdsp) as ntotdsp,;
                          " + cSql + " from tabtotdsp ;
                         left join tabtab on tabtab.ctiptab= '" +
ID_TAB_CODDSP + "' and ccoddsp=tabtab.ckeytab ;
                          where canndoc = '" + cAnnDsp + "'"
...

best regards,
Lorenzo
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to