Evaluation

SQL во всех проявлениях - от ANSI-92 до TSQL.

Модераторы: Yurich, Absurd

Ответить
Sench4
Сообщения: 2
Зарегистрирован: 12 мар 2008, 09:26

HI ALL

If I have a value of type VARCHAR Ex. '3+(5-2)/3' How can I evaluate this to get value of type INTEGER 4 ?

Thanks
Владимир
Сообщения: 56
Зарегистрирован: 25 апр 2005, 13:57

I think, you should write your own string parser
Аватара пользователя
somewhere
Сообщения: 1858
Зарегистрирован: 31 авг 2006, 17:14
Откуда: 71 RUS
Контактная информация:

I think your main task is to parse expression on constants, operations and functions. Because of operations have an evaluation priority you can present them as tree nodes. Then you start evaluate from the most distant node up to root.
Also the easiest way is to use already done functions from imported dll's, you'll easy get it from web.
It's a long way to the top if you wanna rock'n'roll
Ответить