Created
June 12, 2011 15:18
-
-
Save francescoagati/1021664 to your computer and use it in GitHub Desktop.
phare with idiorm -> sql and lisp and php
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
(:: ORM (configure "mysql:host=localhost;dbname=my_database")) | |
(:: ORM (configure #username #database_user)) | |
(:: ORM (configure #password #top_secret )) | |
(def people | |
(-> (:: ORM (for_table #person)) | |
(where #name "Fred") | |
(where_raw "(`age` = ? OR `age` = ?)" [20,25]) | |
(order_by_asc #name) | |
(find_many) | |
)) | |
(def user (-> (:: ORM (for_table #users)) (find_one 5))) | |
(= (-> user age) 20) | |
(-> user (save)) | |
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
<?php | |
require_once('/Users/Francesco/Downloads/Scriptor-pharen-aea8dc4/lang.php'); | |
Lexical::$scopes['bindings'] = array(); | |
$__scope_id = Lexical::init_closure("bindings", 55); | |
ORM::configure("mysql:host=localhost;dbname=my_database"); | |
ORM::configure("username", "database_user"); | |
ORM::configure("password", "top_secret"); | |
$people = ORM::for_table("person")->where("name", "Fred")->where_raw("(`age` = ? OR `age` = ?)", array(20, 25))->order_by_asc("name")->find_many(); | |
Lexical::bind_lexing("bindings", 55, '$people', $people); | |
$user = ORM::for_table("users")->find_one(5); | |
Lexical::bind_lexing("bindings", 55, '$user', $user); | |
$user->age = 20; | |
$user->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment