DATABASE logix
DEFINE sql_stmt CHAR(500)
DEFINE where_clause CHAR(500)
DEFINE i smallint
DEFINE x char(1)
DEFINE lr_dados RECORD
valor DECIMAL(15,3),
texto CHAR(20)
END RECORD
MAIN
DEFER INTERRUPT
create temp table teste_construct (valor decimal(15,3),
texto char(20))
insert into teste_construct values (10.01,'10.01')
insert into teste_construct values (10.01,'10,01')
insert into teste_construct values (11.25,'11.25')
insert into teste_construct values (11.25,'11,25')
insert into teste_construct values (1.2,'1.2')
insert into teste_construct values (1.2,'1,2')
OPEN WINDOW w_teste AT 2,2 WITH FORM "tec-2330"
ATTRIBUTE(BORDER, MESSAGE LINE LAST, PROMPT LINE LAST)
DISPLAY "DBMONEY VALOR ATUAL = ",fgl_getenv("DBMONEY") AT 03,02 attribute(reverse)
MENU "OPÇÃO: "
COMMAND "INPUT"
call executa_input()
COMMAND "CONSTRUCT"
call executa_construct()
COMMAND "SETAR PONTO"
call setdecimal()
COMMAND "FIM"
EXIT MENU
END MENU
CLOSE WINDOW w_teste
END MAIN
FUNCTION executa_construct()
LET int_flag = 0
WHILE int_flag = 0
DISPLAY 78 spaces at 13,2
CONSTRUCT where_clause ON valor,
texto
FROM valor,
texto
if int_flag <> 0 THEN
EXIT WHILE
END IF
DISPLAY "WHERE: "||where_clause at 13,2 attribute(reverse)
CALL conout("WHERE: "||where_clause CLIPPED)
LET sql_stmt = "select * FROM teste_construct where ",where_clause
prepare var_teste from sql_stmt
declare cq_cursor cursor FOR var_teste
LET i = 0
FOREACH cq_cursor INTO lr_dados.*
LET i = i + 1
PROMPT "registro encontrado ",i USING "<<<&",": "," valor: "||lr_dados.valor," texto: "||lr_dados.texto
for char x
END FOREACH
IF i = 0 THEN
PROMPT "Não encontrou registro..." FOR char x
END IF
END WHILE
DISPLAY 78 spaces at 13,2
END FUNCTION
FUNCTION executa_input()
initialize lr_dados.* TO NULL
LET int_flag = 0
INPUT by name lr_dados.* WITHOUT DEFAULTS
END FUNCTION
FUNCTION setdecimal()
call conout("teste de SetClientDecimalSymbol")
call SetClientDecimalSymbol(".")
END FUNCTION
|