Skip to content

Commit

Permalink
implemented simple select_sql
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Masak committed Sep 19, 2009
1 parent 76f110f commit eb6fcd0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Squerl.pm
Expand Up @@ -81,6 +81,11 @@ class Squerl::Dataset does Positional {
}
$name;
}

method select_sql() {
# RAKUDO: Real string interpolation
"SELECT * FROM {%!opts<from>}";
}
}

class Squerl::Database {
Expand Down
16 changes: 16 additions & 0 deletions t/squerl/02-dataset.t
Expand Up @@ -181,4 +181,20 @@ $dataset = Squerl::Dataset.new(undef).from('items');
is_deeply $clone.opts<from>, ['other'], 'cloned .opts<from> changed'
}

{
# TODO: Can't realisticly do this one yet.

# m = Module.new do
# def __xyz__; "xyz"; end
# end
# @dataset.extend(m)
# @dataset.clone({}).should respond_to(:__xyz__)
}

$dataset = Squerl::Dataset.new(undef).from('test');

{
is $dataset.select_sql, 'SELECT * FROM test';
}

done_testing;

0 comments on commit eb6fcd0

Please sign in to comment.