Browse Source

Explode dates and symbols.

tags/v1.0^2
Ben Kurtovic 10 years ago
parent
commit
1111afc198
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      bitshift/database/__init__.py

+ 10
- 5
bitshift/database/__init__.py View File

@@ -68,13 +68,18 @@ class Database(object):
# (FTS: author_name) vs. node.name (_Literal) # (FTS: author_name) vs. node.name (_Literal)
pass pass
elif isinstance(node, Date): elif isinstance(node, Date):
# read node.type, node.relation
# (>=/<=: codelet_date_created / codelet_date_modified) vs. node.date (datetime.datetime)
pass
column = {node.CREATE: "codelet_date_created",
node.MODIFY: "codelet_date_modified"}[node.type]
op = {node.BEFORE: "<=", node.AFTER: ">="}[node.relation]
return "(" + column + " " + op + " ?)", [node.date]
elif isinstance(node, Symbol): elif isinstance(node, Symbol):
tables |= {"symbols"} tables |= {"symbols"}
# (symbol_type, symbol_name) vs. (node.type, node.name)
pass
if node.type == node.ALL:
# OR all of the types of symbol_types
pass
else:
cond = "(symbol_type = ? AND symbol_name = ?)"
return cond, [node.type, node.name]
elif isinstance(node, BinaryOp): elif isinstance(node, BinaryOp):
left_cond, left_args = _parse_node(node.left) left_cond, left_args = _parse_node(node.left)
right_cond, right_args = _parse_node(node.right) right_cond, right_args = _parse_node(node.right)


Loading…
Cancel
Save