Skip to content

DS Archive Support Website

Sections
Personal tools
You are here: Home » Members » kunzem's Home » Pointless Blog » Attribute Language

Attribute Language Attribute Language

Submitted by . on 2004-09-22 02:34 PM. DataSpliceDevelopment
Let's change the way dynamic attributes are specified because we can!

Query attributes currently look like:

QUERY: view={view name};field={field name};where="{where clause}"...

As far as dynamic attributes are concerned, the only thing we can do is process query attributes.

What if we combine the statement parsing code we have elsewhere with some minimal functions to create dynamic attributes? Query values could then look like: := {statement } where the := prefix means the query value is to be evaluate from the statement.

This would allow:

:= min(5, ${other attribute})

and

:= lookup(viewName, fieldName, "{where clause}")

Cool functions I can think of at the moment:

  • lookup: replace current query-based attributes
  • min/max/floor/etc.
  • date parsing and formatting functions (ie: time only)

The parser destroyer

Posted by bnroy at 2005-01-14 10:57 AM
Below is some nasty combinations of tests that will ensure the proper functionality exists for our parser.

Paren Tests
Good parens
()
((3)+(4)-(5) + 5)
(6+5)
(( (3)+6))
(3)+(3)+(3)+(3)+(3)+(3)+(3)+(3)+(3)
(3)+(3)+(3)+3+(3)+(3)+3+(3)+(3)
((((((((((&))))))))))
((((((((((&))))))))))+((9))
( (6.3) + (6*3) )
( (6.3) + 9-6 )
( ( (6.3) + 9-6 ) + 6 + 8)

Bad Parens
)
)(
)(5)+7(
( (3)+6))
((((((((((6)))))))))))
(((6 + 9 - 6 * 5 - 9))

To be or to not be a string

Good String Combos
12 + 66!
12 + 66@
12 + 66#
12 + 66$
12 + 66%
12 + 66^
12 + 66&
12 + 66*
12 + 66_
12 + 66-
12 + 66}
12 + 66{
12 + 66;
12 + 66:
12 + 66<
12 + 66>
12 + 66?
12 + 66~
12 + 66`

'hehhhhe+adsfasdfa'
"hehhhhe+adsfasdfa"

Basic lists declarations
(7)
(7,8,5)
(7, "6", '6', 5, 4$, $4, 4, 4)


evaluation of basic operators + - * / ()
1 + 3 - 7 / 2 * 6
1 + 3 - 7 / (2 * 6)
(1 + 3) - 7 / 2 * 6
0/0
(1 + 2 - 3 )/ 0
(1 + 2 - 3 )/ 0 + 1
(1 + 2 - 0 )/ 4 + 1
(3)/ 4 +1
3/4
10/5.2
10/6
10/6.0
10/6
5 - -6
-6
5-6


OR's where answer is true
5 = 5
5 = 0 or 5 <> 0
10/2 = 4 or 1

ORs where answer is false
10/2 = 4 or 0
5 != 5 and 6
5 and 6
4 = 5 and 6
5 in (5)
5 in (5) and 5 in (6, 6)


Ands where answer is false
4 <> 5 and 6 not in (4,5,6,7,8,9,0)
57 like 5? and 6 not in (4,5,6,7,8,9,0)
(10/6.1 -1.639344) and 0
(10/6.1 -1.639344) and 1
0.000000 and 1

Concationation operations
d || 3
3 || 4
"f" || 6
f || ge
f || 'g'
faint || " heart"
primus || " su" || 'cks'


Strings and Concats
"`~!@#$%^&*'()_-+=|\'}]{[:;>.<,?/`"
" ' ' "
" ' " || "' "
" ' " || "' "
"hehehe" || '""'


Bad ones
"`~!@#$%^&*'()_-+=|\'}]{[:;>.<,?/`"'

Aggregate operators
BETWEEN
1 BETWEEN 0 and 1
1 between 0 and 1.1
.000002 BETWEEN .000001 AND .000003

NOT BETWEEN
1.6 not between 0 and 1
9 not between 10 and 100

These should throw errors
3.1 BETWEEN 4 AND 3
3.1 NOT BETWEEN 4 AND 3

LIKE including our friends * and ? and +

Likes that eval as true
57 like 5?
57 like 5?? !!Bing Don't try this at home
57777 like 57+
57777 like 57*
5778 like 57?8

likes that evaluate as false
57777 like 57?

NOT LIKE
57 not like 5?? !!Bing Don't try this at home.


Blog
 
 

Powered by Plone

This site conforms to the following standards: