dataset de data para campo não funciona

jcesarml
Thu, 20 Sep 2012 18:25:14 +0000

Boa tarde a todos,

Eu estou desenvolvendo um formulário que pega os dias da semana que vem, através da macro sc_lookup, pego a segunda, a terça, a quarta, etc, todos os dias da semana que vem, sendo que o prazo sempre termina nas sextas-feiras.

A query ficou perfeita e pode ser testada sem problema no sql builder:

select if(dayofweek(now())=1, "domingo", if(dayofweek(now())=2, "segunda", if(dayofweek(now())=3, "terça", if(dayofweek(now())=4, "quarta", if(dayofweek(now())=5, "quinta", if(dayofweek(now())=6, "sexta","sabado")))))) as dia_de_hoje, date(now()) as hoje_eh, if(dayofweek(now())=1, +7, if(dayofweek(now())=2, +13, if(dayofweek(now())=3, +12, if(dayofweek(now())=4, +11, if(dayofweek(now())=5, +10, if(dayofweek(now())=6, +9, +8)))))) as diff_dias, date(date_add(now(), interval if(dayofweek(now())=1, +7, if(dayofweek(now())=2, +13, if(dayofweek(now())=3, +12, if(dayofweek(now())=4, +11, if(dayofweek(now())=5, +10, if(dayofweek(now())=6, +9,+8)))))) day)) as domingo
Resposta:

dia_de_hoje hoje_eh diff_dias domingo
quinta 2012-09-20 10 2012-09-30

criei uma função PHP com esse dataset dessa forma:

[code]sc_lookup(ds_domingo,“select
if(dayofweek(now())=1, “domingo”,
if(dayofweek(now())=2, “segunda”,
if(dayofweek(now())=3, “terça”,
if(dayofweek(now())=4, “quarta”,
if(dayofweek(now())=5, “quinta”,
if(dayofweek(now())=6, “sexta”,“sabado”)))))) as dia_de_hoje, date(now()) as hoje_eh,
if(dayofweek(now())=1, +7,
if(dayofweek(now())=2, +13,
if(dayofweek(now())=3, +12,
if(dayofweek(now())=4, +11,
if(dayofweek(now())=5, +10,
if(dayofweek(now())=6, +9, +8)))))) as diff_dias,
date(date_add(now(), interval if(dayofweek(now())=1, +7,
if(dayofweek(now())=2, +13,
if(dayofweek(now())=3, +12,
if(dayofweek(now())=4, +11,
if(dayofweek(now())=5, +10,
if(dayofweek(now())=6, +9,+8)))))) day)) as domingo”);

{domingo} = {ds_domingo[0][3]};[/code]

O problema é que o select funciona perfeitamente no SQL Builder e não funciona no dataset, sendo que o erro acusado não tem lógica, que é um erro de sintaxe na segunda linha da query.
Isso seria um bug?