Created
March 24, 2010 18:14
-
-
Save chromakode/342577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mgood@capstone11 ~/D/c/b/boots.mgood> boots -H capstonedd -l python | |
Boots (v0.2.0) | |
capstonedd:3306 (server v2009.11.1220) | |
> from boots.api import constructors | |
> @constructors.register('reverse') | |
+ def reverse(): | |
+ from boots.api.nodes.node import SyncNode | |
+ from boots.api.api import Rows | |
+ def reverse_data(data): | |
+ return Rows((("".join(reversed(field)) if isinstance(field,basestring) else field | |
+ for field in row) | |
+ for row in data) | |
+ , data.description) | |
+ | |
+ return SyncNode(reverse_data) | |
+ | |
> \use pipedsql | |
> use world; | |
0 rows affected (0.00 seconds) | |
> SELECT * FROM city WHERE district='Oregon'; | reverse() | |
+------+----------+-------------+----------+------------+ | |
| ID | Name | CountryCode | District | Population | | |
+------+----------+-------------+----------+------------+ | |
| 0283 | dnaltroP | ASU | nogerO | 121925 | | |
| 0593 | eneguE | ASU | nogerO | 398731 | | |
| 2593 | melaS | ASU | nogerO | 429631 | | |
+------+----------+-------------+----------+------------+ | |
3 rows in set (0.00 seconds) | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment