├── .gitignore ├── SAMPLE ├── BLOG │ ├── CR │ │ ├── .travis.yml │ │ ├── .gitignore │ │ ├── spec │ │ │ ├── spec_helper.cr │ │ │ └── blog_spec.cr │ │ ├── public │ │ │ └── static │ │ │ │ ├── img │ │ │ │ ├── 0.jpg │ │ │ │ ├── 1.jpg │ │ │ │ ├── 2.jpg │ │ │ │ ├── 3.jpg │ │ │ │ ├── 4.jpg │ │ │ │ ├── 5.jpg │ │ │ │ ├── 6.jpg │ │ │ │ ├── 7.jpg │ │ │ │ ├── 8.jpg │ │ │ │ ├── 9.jpg │ │ │ │ ├── 10.jpg │ │ │ │ ├── 11.jpg │ │ │ │ ├── 12.jpg │ │ │ │ ├── 13.jpg │ │ │ │ ├── 14.jpg │ │ │ │ ├── 15.jpg │ │ │ │ ├── 16.jpg │ │ │ │ ├── 17.jpg │ │ │ │ ├── 18.jpg │ │ │ │ └── 19.jpg │ │ │ │ └── fonts │ │ │ │ └── roboto │ │ │ │ ├── Roboto-Bold.woff │ │ │ │ ├── Roboto-Thin.woff │ │ │ │ ├── Roboto-Bold.woff2 │ │ │ │ ├── Roboto-Light.woff │ │ │ │ ├── Roboto-Light.woff2 │ │ │ │ ├── Roboto-Medium.woff │ │ │ │ ├── Roboto-Thin.woff2 │ │ │ │ ├── Roboto-Medium.woff2 │ │ │ │ ├── Roboto-Regular.woff │ │ │ │ └── Roboto-Regular.woff2 │ │ ├── .editorconfig │ │ ├── src │ │ │ ├── CONTROLLER │ │ │ │ ├── controller.cr │ │ │ │ ├── disconnect_user_controller.cr │ │ │ │ ├── add_subscriber_controller.cr │ │ │ │ ├── add_comment_controller.cr │ │ │ │ ├── connect_user_controller.cr │ │ │ │ ├── show_section_controller.cr │ │ │ │ └── show_article_controller.cr │ │ │ ├── MODEL │ │ │ │ ├── model.cr │ │ │ │ ├── subscriber.cr │ │ │ │ ├── section.cr │ │ │ │ ├── user.cr │ │ │ │ ├── session.cr │ │ │ │ ├── comment.cr │ │ │ │ └── article.cr │ │ │ ├── VIEW │ │ │ │ ├── show_section_view.ecr │ │ │ │ ├── show_article_view.ecr │ │ │ │ └── show_page_view.ecr │ │ │ └── application.cr │ │ ├── shard.yml │ │ ├── shard.lock │ │ ├── README.md │ │ └── LICENSE │ ├── get.sh │ ├── run.sh │ ├── SQL │ │ ├── make.sh │ │ ├── run.sh │ │ ├── blog_dump.sql │ │ ├── blog.basil │ │ ├── blog.sql │ │ ├── blog_data.sql │ │ └── blog.txt │ ├── make.sh │ └── CB │ │ └── src │ │ ├── CONTROLLER │ │ ├── controller.cb │ │ ├── disconnect_user_controller.cb │ │ ├── add_subscriber_controller.cb │ │ ├── add_comment_controller.cb │ │ ├── connect_user_controller.cb │ │ ├── show_section_controller.cb │ │ └── show_article_controller.cb │ │ ├── MODEL │ │ ├── model.cb │ │ ├── subscriber.cb │ │ ├── section.cb │ │ ├── user.cb │ │ ├── session.cb │ │ ├── comment.cb │ │ └── article.cb │ │ ├── VIEW │ │ ├── show_section_view.ecb │ │ ├── show_article_view.ecb │ │ └── show_page_view.ecb │ │ └── application.cb └── FIBONACCI │ ├── run.sh │ ├── make.sh │ ├── CR │ └── sample.cr │ ├── RB │ └── sample.rb │ └── CB │ └── sample.cb ├── TEST ├── run.sh ├── make.sh ├── CB │ ├── test.ecb │ └── test.cb ├── CR │ ├── test.ecr │ └── test.cr └── RB │ ├── test.erb │ └── test.rb ├── make.sh ├── release.sh ├── LOGO ├── cibyl.png └── cibyl.svg ├── debug.sh ├── dictionary.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | cibyl 2 | *.o 3 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/.travis.yml: -------------------------------------------------------------------------------- 1 | language: crystal 2 | -------------------------------------------------------------------------------- /TEST/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | cd CR/ 4 | crystal test.cr 5 | -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | dmd -m64 cibyl.d 4 | rm *.o 5 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/get.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | cd CR 4 | shards install 5 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | dmd -O -m64 cibyl.d 4 | rm *.o 5 | -------------------------------------------------------------------------------- /LOGO/cibyl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/LOGO/cibyl.png -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/.gitignore: -------------------------------------------------------------------------------- 1 | /docs/ 2 | /lib/ 3 | /bin/ 4 | /.shards/ 5 | *.dwarf 6 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/spec/spec_helper.cr: -------------------------------------------------------------------------------- 1 | require "spec" 2 | require "../src/blog" 3 | -------------------------------------------------------------------------------- /SAMPLE/FIBONACCI/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | cd CR/ 4 | crystal sample.cr 5 | -------------------------------------------------------------------------------- /debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | dmd -debug -g -gf -gs -m64 cibyl.d 4 | rm *.o 5 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | cd CR 4 | crystal run src/application.cr 5 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | ../../../../BASIL/basil --sql blog.basil 4 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/0.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/1.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/2.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/3.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/4.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/5.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/6.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/7.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/8.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/9.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/10.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/11.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/12.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/13.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/14.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/15.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/16.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/17.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/18.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/img/19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/img/19.jpg -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | cat blog.sql blog_data.sql blog_dump.sql | mysql -t -u root -p | tee blog.txt 4 | -------------------------------------------------------------------------------- /SAMPLE/FIBONACCI/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | ../../cibyl --ruby --compact CB/ RB/ 4 | ../../cibyl --crystal --compact CB/ CR/ 5 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | ../../cibyl --crystal --replace ../../dictionary.txt --convert --join --create --watch CB/ CR/ 4 | -------------------------------------------------------------------------------- /dictionary.txt: -------------------------------------------------------------------------------- 1 | DB 2 | ECR 3 | HTML 4 | HTTP 5 | IO 6 | UINT16 : UInt16 7 | UINT32 : UInt32 8 | UINT64 : UInt64 9 | UINT8 : UInt8 10 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Bold.woff -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Thin.woff -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Light.woff -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Light.woff2 -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Medium.woff -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Medium.woff2 -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Regular.woff -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SenseLogic/CIBYL/HEAD/SAMPLE/BLOG/CR/public/static/fonts/roboto/Roboto-Regular.woff2 -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/spec/blog_spec.cr: -------------------------------------------------------------------------------- 1 | require "./spec_helper" 2 | 3 | describe Blog do 4 | # TODO: Write tests 5 | 6 | it "works" do 7 | false.should eq(true) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /TEST/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | ../cibyl --ruby --replace ../dictionary.txt --convert --join --compact CB/ RB/ 4 | ../cibyl --crystal --replace ../dictionary.txt --convert --join --create --watch CB/ CR/ 5 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.cr] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 2 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /SAMPLE/FIBONACCI/CR/sample.cr: -------------------------------------------------------------------------------- 1 | # Recursive Fibonacci function 2 | 3 | def fibonacci( 4 | n : Int32 5 | ) 6 | if ( n <= 1 ) 7 | return n; 8 | else 9 | return fibonacci( n - 1 ) + fibonacci( n - 2 ); 10 | end 11 | end 12 | 13 | puts fibonacci( 8 ); 14 | -------------------------------------------------------------------------------- /SAMPLE/FIBONACCI/RB/sample.rb: -------------------------------------------------------------------------------- 1 | # Recursive Fibonacci function 2 | 3 | def fibonacci( 4 | n : Int32 5 | ) 6 | if ( n <= 1 ) 7 | return n; 8 | else 9 | return fibonacci( n - 1 ) + fibonacci( n - 2 ); 10 | end 11 | end 12 | 13 | puts fibonacci( 8 ); 14 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/controller.cr: -------------------------------------------------------------------------------- 1 | # -- IMPORTS 2 | 3 | require "./add_comment_controller.cr"; 4 | require "./disconnect_user_controller.cr"; 5 | require "./show_section_controller.cr"; 6 | require "./add_subscriber_controller.cr"; 7 | require "./connect_user_controller.cr"; 8 | require "./show_article_controller.cr"; 9 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/controller.cb: -------------------------------------------------------------------------------- 1 | // -- IMPORTS 2 | 3 | require "./add_comment_controller.cr"; 4 | require "./disconnect_user_controller.cr"; 5 | require "./show_section_controller.cr"; 6 | require "./add_subscriber_controller.cr"; 7 | require "./connect_user_controller.cr"; 8 | require "./show_article_controller.cr"; 9 | -------------------------------------------------------------------------------- /SAMPLE/FIBONACCI/CB/sample.cb: -------------------------------------------------------------------------------- 1 | // Recursive Fibonacci function 2 | 3 | def fibonacci( 4 | n : Int32 5 | ) 6 | { 7 | if ( n <= 1 ) 8 | { 9 | return n; 10 | } 11 | else 12 | { 13 | return fibonacci( n - 1 ) + fibonacci( n - 2 ); 14 | } 15 | } 16 | 17 | puts fibonacci( 8 ); 18 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/shard.yml: -------------------------------------------------------------------------------- 1 | name: blog 2 | version: 0.1.0 3 | 4 | authors: 5 | - senselogic 6 | 7 | dependencies: 8 | kemal: 9 | github: kemalcr/kemal 10 | kemal-session: 11 | github: kemalcr/kemal-session 12 | mysql: 13 | github: crystal-lang/crystal-mysql 14 | 15 | targets: 16 | blog: 17 | main: src/blog.cr 18 | 19 | crystal: 0.27.0 20 | 21 | license: MIT 22 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/disconnect_user_controller.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- OPERATIONS 6 | 7 | def DisconnectUser( 8 | context : HTTP::SERVER::CONTEXT 9 | ) 10 | { 11 | session = SESSION.New( context ); 12 | 13 | session.UserIsConnected = false; 14 | session.Store( context ); 15 | 16 | context.Redirect( session.Path ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/disconnect_user_controller.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- OPERATIONS 6 | 7 | def disconnect_user( 8 | context : HTTP::Server::Context 9 | ) 10 | 11 | session = Session.new( context ); 12 | 13 | session.user_is_connected = false; 14 | session.store( context ); 15 | 16 | context.redirect( session.path ); 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/blog_dump.sql: -------------------------------------------------------------------------------- 1 | show databases; 2 | 3 | use BLOG; 4 | show tables; 5 | 6 | select 'ARTICLE' AS ''; 7 | describe ARTICLE; 8 | select * from ARTICLE; 9 | 10 | select 'COMMENT' AS ''; 11 | describe COMMENT; 12 | select * from COMMENT; 13 | 14 | select 'SECTION' AS ''; 15 | describe SECTION; 16 | select * from SECTION; 17 | 18 | select 'SUBSCRIBER' AS ''; 19 | describe SUBSCRIBER; 20 | select * from SUBSCRIBER; 21 | 22 | select 'USER' AS ''; 23 | describe USER; 24 | select * from USER; 25 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/add_subscriber_controller.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- OPERATIONS 6 | 7 | def AddSubscriber( 8 | context : HTTP::SERVER::CONTEXT 9 | ) 10 | { 11 | session = SESSION.New( context ); 12 | 13 | AddSubscriber( context.Params.Body[ "email" ] ); 14 | 15 | session.UserHasSubscribed = true; 16 | session.Message = "Thanks for your subscription."; 17 | session.Store( context ); 18 | 19 | context.Redirect( session.Path ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/add_subscriber_controller.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- OPERATIONS 6 | 7 | def add_subscriber( 8 | context : HTTP::Server::Context 9 | ) 10 | 11 | session = Session.new( context ); 12 | 13 | add_subscriber( context.params.body[ "email" ] ); 14 | 15 | session.user_has_subscribed = true; 16 | session.message = "Thanks for your subscription."; 17 | session.store( context ); 18 | 19 | context.redirect( session.path ); 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/shard.lock: -------------------------------------------------------------------------------- 1 | version: 1.0 2 | shards: 3 | db: 4 | github: crystal-lang/crystal-db 5 | version: 0.5.1 6 | 7 | exception_page: 8 | github: crystal-loot/exception_page 9 | version: 0.1.1 10 | 11 | kemal: 12 | github: kemalcr/kemal 13 | version: 0.25.1 14 | 15 | kemal-session: 16 | github: kemalcr/kemal-session 17 | version: 0.11.0 18 | 19 | kilt: 20 | github: jeromegn/kilt 21 | version: 0.4.0 22 | 23 | mysql: 24 | github: crystal-lang/crystal-mysql 25 | version: 0.5.1 26 | 27 | radix: 28 | github: luislavena/radix 29 | version: 0.3.8 30 | 31 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/model.cr: -------------------------------------------------------------------------------- 1 | # -- IMPORTS 2 | 3 | require "./article.cr"; 4 | require "./comment.cr"; 5 | require "./section.cr"; 6 | require "./session.cr"; 7 | require "./subscriber.cr"; 8 | require "./user.cr"; 9 | 10 | # -- MODULES 11 | 12 | module Blog 13 | 14 | # -- FUNCTIONS 15 | 16 | def get_last_insert_id( 17 | ) : Int32 18 | 19 | new_id = 0; 20 | 21 | database.query_each( "select last_insert_id()" ) \ 22 | do | result_set | 23 | 24 | new_id = result_set.read( Int64 ).to_i32(); 25 | end 26 | 27 | return new_id; 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/add_comment_controller.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- OPERATIONS 6 | 7 | def AddComment( 8 | context : HTTP::SERVER::CONTEXT, 9 | article_id : INT32 10 | ) 11 | { 12 | session = SESSION.New( context ); 13 | 14 | text = context.Params.Body[ "text" ]; 15 | article = GetArticleById( article_id ); 16 | AddComment( article_id, session.UserId, text ); 17 | 18 | session.Message = "Your comment has been added."; 19 | session.Store( context ); 20 | 21 | context.Redirect( session.Path ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/model.cb: -------------------------------------------------------------------------------- 1 | // -- IMPORTS 2 | 3 | require "./article.cr"; 4 | require "./comment.cr"; 5 | require "./section.cr"; 6 | require "./session.cr"; 7 | require "./subscriber.cr"; 8 | require "./user.cr"; 9 | 10 | // -- MODULES 11 | 12 | module BLOG 13 | { 14 | // -- FUNCTIONS 15 | 16 | def GetLastInsertId( 17 | ) : INT32 18 | { 19 | new_id = 0; 20 | 21 | Database.QueryEach( "select last_insert_id()" ) 22 | do | result_set | 23 | { 24 | new_id = result_set.Read( INT64 ).ToI32(); 25 | } 26 | 27 | return new_id; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/add_comment_controller.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- OPERATIONS 6 | 7 | def add_comment( 8 | context : HTTP::Server::Context, 9 | article_id : Int32 10 | ) 11 | 12 | session = Session.new( context ); 13 | 14 | text = context.params.body[ "text" ]; 15 | article = get_article_by_id( article_id ); 16 | add_comment( article_id, session.user_id, text ); 17 | 18 | session.message = "Your comment has been added."; 19 | session.store( context ); 20 | 21 | context.redirect( session.path ); 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/VIEW/show_section_view.ecb: -------------------------------------------------------------------------------- 1 |

2 | 3 | <%~ section.Name %> 4 | 5 |

6 | 7 |

8 | <%~ section.Text %> 9 |

10 |
11 | <% article_array.Each do | article | %> 12 |
13 | 14 | <%~ article.Title %> 15 | 16 |
17 |
18 | <% article_user = article.User; %> 19 | <%~ article_user ? article_user.Pseudonym : "" %> - <%~ article.Date.ToS() %> 20 |
21 | <% end %> 22 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/README.md: -------------------------------------------------------------------------------- 1 | # blog 2 | 3 | TODO: Write a description here 4 | 5 | ## Installation 6 | 7 | TODO: Write installation instructions here 8 | 9 | ## Usage 10 | 11 | TODO: Write usage instructions here 12 | 13 | ## Development 14 | 15 | TODO: Write development instructions here 16 | 17 | ## Contributing 18 | 19 | 1. Fork it () 20 | 2. Create your feature branch (`git checkout -b my-new-feature`) 21 | 3. Commit your changes (`git commit -am 'Add some feature'`) 22 | 4. Push to the branch (`git push origin my-new-feature`) 23 | 5. Create a new Pull Request 24 | 25 | ## Contributors 26 | 27 | - [senselogic](https://github.com/your-github-user) - creator and maintainer 28 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/VIEW/show_section_view.ecr: -------------------------------------------------------------------------------- 1 |

2 | 3 | <%= HTML.escape( section.name ) %> 4 | 5 |

6 | 7 |

8 | <%= HTML.escape( section.text ) %> 9 |

10 |
11 | <% article_array.each do | article | %> 12 |
13 | 14 | <%= HTML.escape( article.title ) %> 15 | 16 |
17 |
18 | <% article_user = article.user; %> 19 | <%= HTML.escape( article_user ? article_user.pseudonym : "" ) %> - <%= HTML.escape( article.date.to_s() ) %> 20 |
21 | <% end %> 22 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/connect_user_controller.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- OPERATIONS 6 | 7 | def connect_user( 8 | context : HTTP::Server::Context 9 | ) 10 | 11 | session = Session.new( context ); 12 | 13 | user \ 14 | = get_user_by_pseudonym_and_password( 15 | context.params.body[ "pseudonym" ], 16 | context.params.body[ "password" ] 17 | ); 18 | 19 | if ( user.nil?() ) 20 | 21 | session.message = "Invalid pseudonym or password."; 22 | 23 | else 24 | 25 | session.user_id = user.id; 26 | session.user_is_connected = true; 27 | session.user_is_administrator = user.is_administrator; 28 | end 29 | 30 | session.store( context ); 31 | 32 | context.redirect( session.path ); 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/connect_user_controller.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- OPERATIONS 6 | 7 | def ConnectUser( 8 | context : HTTP::SERVER::CONTEXT 9 | ) 10 | { 11 | session = SESSION.New( context ); 12 | 13 | user 14 | = GetUserByPseudonymAndPassword( 15 | context.Params.Body[ "pseudonym" ], 16 | context.Params.Body[ "password" ] 17 | ); 18 | 19 | if ( user.Nil?() ) 20 | { 21 | session.Message = "Invalid pseudonym or password."; 22 | } 23 | else 24 | { 25 | session.UserId = user.Id; 26 | session.UserIsConnected = true; 27 | session.UserIsAdministrator = user.IsAdministrator; 28 | } 29 | 30 | session.Store( context ); 31 | 32 | context.Redirect( session.Path ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/show_section_controller.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- OPERATIONS 6 | 7 | def show_section( 8 | context : HTTP::Server::Context, 9 | section_id : Int32 10 | ) 11 | 12 | session = Session.new( context ); 13 | 14 | session.path = context.request.path; 15 | session.store( context ); 16 | 17 | section_array = get_section_array(); 18 | 19 | if ( section_id <= 0 ) 20 | 21 | section_id = section_array[ 0 ].id; 22 | end 23 | 24 | section = get_section_by_id( section_id ); 25 | 26 | if ( section ) 27 | 28 | article_array = get_article_array_by_section_id( section_id ); 29 | inflate_article_array( article_array ); 30 | 31 | section.image_index = section_id % 20; 32 | 33 | render( "src/VIEW/show_section_view.ecr", "src/VIEW/show_page_view.ecr" ); 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/show_section_controller.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- OPERATIONS 6 | 7 | def ShowSection( 8 | context : HTTP::SERVER::CONTEXT, 9 | section_id : INT32 10 | ) 11 | { 12 | session = SESSION.New( context ); 13 | 14 | session.Path = context.Request.Path; 15 | session.Store( context ); 16 | 17 | section_array = GetSectionArray(); 18 | 19 | if ( section_id <= 0 ) 20 | { 21 | section_id = section_array[ 0 ].Id; 22 | } 23 | 24 | section = GetSectionById( section_id ); 25 | 26 | if ( section ) 27 | { 28 | article_array = GetArticleArrayBySectionId( section_id ); 29 | InflateArticleArray( article_array ); 30 | 31 | section.ImageIndex = section_id % 20; 32 | 33 | Render( "src/VIEW/show_section_view.ecr", "src/VIEW/show_page_view.ecr" ); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/CONTROLLER/show_article_controller.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- OPERATIONS 6 | 7 | def show_article( 8 | context : HTTP::Server::Context, 9 | article_id : Int32 10 | ) 11 | 12 | session = Session.new( context ); 13 | 14 | session.path = context.request.path; 15 | session.store( context ); 16 | 17 | article = get_article_by_id( article_id ); 18 | 19 | if ( article ) 20 | 21 | section = get_section_by_id( article.section_id ); 22 | 23 | if ( section ) 24 | 25 | section_array = get_section_array(); 26 | comment_array = get_comment_array_by_article_id( article_id ); 27 | 28 | article.image_index = article.id % 20; 29 | inflate_article( article ); 30 | inflate_comment_array( comment_array ); 31 | 32 | render( "src/VIEW/show_article_view.ecr", "src/VIEW/show_page_view.ecr" ); 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/CONTROLLER/show_article_controller.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- OPERATIONS 6 | 7 | def ShowArticle( 8 | context : HTTP::SERVER::CONTEXT, 9 | article_id : INT32 10 | ) 11 | { 12 | session = SESSION.New( context ); 13 | 14 | session.Path = context.Request.Path; 15 | session.Store( context ); 16 | 17 | article = GetArticleById( article_id ); 18 | 19 | if ( article ) 20 | { 21 | section = GetSectionById( article.SectionId ); 22 | 23 | if ( section ) 24 | { 25 | section_array = GetSectionArray(); 26 | comment_array = GetCommentArrayByArticleId( article_id ); 27 | 28 | article.ImageIndex = article.Id % 20; 29 | InflateArticle( article ); 30 | InflateCommentArray( comment_array ); 31 | 32 | Render( "src/VIEW/show_article_view.ecr", "src/VIEW/show_page_view.ecr" ); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/blog.basil: -------------------------------------------------------------------------------- 1 | BLOG | count 5 2 | 3 | SECTION 4 | 5 | Id : INT32 | key, unique, incremented 6 | Number : UINT32 7 | Name : STRING | capacity 45 8 | Text : STRING 9 | Image : STRING | capacity 45 10 | 11 | USER 12 | 13 | Id : INT32 | key, unique, incremented 14 | Email : STRING | capacity 45 15 | Pseudonym : STRING | capacity 45 16 | Password : STRING | capacity 45 17 | IsAdministrator : BOOL 18 | 19 | ARTICLE | count 15 20 | 21 | Id : INT32 | key, unique, incremented 22 | SectionId : SECTION.Id 23 | UserId : USER.Id 24 | Title : STRING 25 | Text : STRING 26 | Image : STRING | capacity 45 27 | Date : DATE 28 | 29 | COMMENT | count 30 30 | 31 | Id : INT32 | key, unique, incremented 32 | ArticleId : ARTICLE.Id 33 | UserId : USER.Id 34 | Text : STRING | english 2 4 5 7 35 | DateTime : DATETIME 36 | 37 | SUBSCRIBER 38 | 39 | Id : INT32 | key, unique, incremented 40 | Email : STRING | capacity 45 41 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 senselogic 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/VIEW/show_article_view.ecb: -------------------------------------------------------------------------------- 1 |

2 | 3 | <%~ section.Name %> 4 | 5 |

6 |

7 | 8 | <%~ article.Title %> 9 | 10 |

11 |
12 | <% article_user = article.User; %> 13 | <%~ article_user ? article_user.Pseudonym : "" %> - <%~ article.Date.ToS() %> 14 |
15 | 16 |

17 | <%~ article.Text %> 18 |

19 |
20 | <% if ( session.UserIsConnected ) %> 21 |

22 | Comment 23 |

24 |
25 | 28 | 29 | 30 |
31 | <% end %> 32 |
33 | <% comment_array.Each do | comment | %> 34 |
35 | <% comment_user = comment.User; %> 36 | <%~ comment_user ? comment_user.Pseudonym : "" %> - <%~ comment.DateTime.ToS() %> 37 |
38 |

39 | <%~ comment.Text %> 40 |

41 | <% end %> 42 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/VIEW/show_article_view.ecr: -------------------------------------------------------------------------------- 1 |

2 | 3 | <%= HTML.escape( section.name ) %> 4 | 5 |

6 |

7 | 8 | <%= HTML.escape( article.title ) %> 9 | 10 |

11 |
12 | <% article_user = article.user; %> 13 | <%= HTML.escape( article_user ? article_user.pseudonym : "" ) %> - <%= HTML.escape( article.date.to_s() ) %> 14 |
15 | 16 |

17 | <%= HTML.escape( article.text ) %> 18 |

19 |
20 | <% if ( session.user_is_connected ) %> 21 |

22 | Comment 23 |

24 |
25 | 28 | 29 | 30 |
31 | <% end %> 32 |
33 | <% comment_array.each do | comment | %> 34 |
35 | <% comment_user = comment.user; %> 36 | <%= HTML.escape( comment_user ? comment_user.pseudonym : "" ) %> - <%= HTML.escape( comment.date_time.to_s() ) %> 37 |
38 |

39 | <%= HTML.escape( comment.text ) %> 40 |

41 | <% end %> 42 | -------------------------------------------------------------------------------- /TEST/CB/test.ecb: -------------------------------------------------------------------------------- 1 | <% /* This is a comment */ %> 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

9 | Time 10 |

11 |
12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 |

27 | <%= if ( person_array.Size 28 | > 0 ) 29 | person_array.Size.ToS() + " persons :"; 30 | else 31 | "Nobody."; 32 | end %> 33 |

34 | 35 | "> 36 | 37 | 38 | 39 | <% person_array.Each do | person | %> 40 | 41 | 42 | 43 | 44 | <% end %> 45 |
NameAge
<%-~ person.Name -%><%= person.Age %>
46 | 47 | 48 | <% // This is a comment. %> 49 | -------------------------------------------------------------------------------- /TEST/CR/test.ecr: -------------------------------------------------------------------------------- 1 | <% # This is a comment %> 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

9 | Time 10 |

11 |
12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 |

27 | <%= if ( person_array.size \ 28 | > 0 ) 29 | person_array.size.to_s() + " persons :"; 30 | else 31 | "Nobody."; 32 | end %> 33 |

34 | 35 | "> 36 | 37 | 38 | 39 | <% person_array.each do | person | %> 40 | 41 | 42 | 43 | 44 | <% end %> 45 |
NameAge
<%-= HTML.escape( person.name ) -%><%= person.age %>
46 | 47 | 48 | <% # This is a comment. %> 49 | -------------------------------------------------------------------------------- /TEST/RB/test.erb: -------------------------------------------------------------------------------- 1 | <% # This is a comment %> 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

9 | Time 10 |

11 |
12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 |

27 | <%= if ( person_array.size \ 28 | > 0 ) 29 | person_array.size.to_s() + " persons :"; 30 | else 31 | "Nobody."; 32 | end %> 33 |

34 | 35 | "> 36 | 37 | 38 | 39 | <% person_array.each do | person | %> 40 | 41 | 42 | 43 | 44 | <% end %> 45 |
NameAge
<%-= HTML.escape( person.name ) -%><%= person.age %>
46 | 47 | 48 | <% # This is a comment. %> 49 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/subscriber.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- TYPES 6 | 7 | class Subscriber 8 | 9 | # -- ATTRIBUTES 10 | 11 | property \ 12 | id : Int32, 13 | email : String; 14 | 15 | # -- CONSTRUCTORS 16 | 17 | def initialize( 18 | @id = 0, 19 | @email = "" 20 | ) : Void 21 | 22 | end 23 | end 24 | 25 | # -- FUNCTIONS 26 | 27 | def get_subscriber( 28 | result_set : DB::ResultSet 29 | ) : Subscriber 30 | 31 | return Subscriber.new( 32 | result_set.read( Int32 ), 33 | result_set.read( String ) 34 | ); 35 | end 36 | 37 | # ~~ 38 | 39 | def get_subscriber_array( 40 | ) : Array( Subscriber ) 41 | 42 | subscriber_array = Array( Subscriber ).new(); 43 | 44 | database.query_each "select * from SUBSCRIBER order by Email asc" \ 45 | do | result_set | 46 | 47 | subscriber_array.push( get_subscriber( result_set ) ); 48 | end 49 | 50 | return subscriber_array; 51 | end 52 | 53 | # ~~ 54 | 55 | def get_subscriber_by_id( 56 | id : Int32 57 | ) : Subscriber | Nil 58 | 59 | database.query_each "select * from SUBSCRIBER where Id = ?", id \ 60 | do | result_set | 61 | 62 | return get_subscriber( result_set ); 63 | end 64 | 65 | return nil; 66 | end 67 | 68 | # ~~ 69 | 70 | def change_subscriber( 71 | id : Int32, 72 | email : String 73 | ) : Void 74 | 75 | database.exec( 76 | "update SUBSCRIBER set Id = ?, Email = ? where Id = ?", 77 | id, 78 | email, 79 | id 80 | ); 81 | end 82 | 83 | # ~~ 84 | 85 | def add_subscriber( 86 | email : String 87 | ) : Int32 88 | 89 | database.exec( 90 | "insert into SUBSCRIBER ( Email ) values ( ? )", 91 | email 92 | ); 93 | 94 | return get_last_insert_id(); 95 | end 96 | 97 | # ~~ 98 | 99 | def remove_subscriber( 100 | id : Int32 101 | ) : Void 102 | 103 | database.exec( 104 | "delete from SUBSCRIBER where Id = ?", 105 | id 106 | ); 107 | end 108 | end 109 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/subscriber.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- TYPES 6 | 7 | class SUBSCRIBER 8 | { 9 | // -- ATTRIBUTES 10 | 11 | property 12 | Id : INT32, 13 | Email : STRING; 14 | 15 | // -- CONSTRUCTORS 16 | 17 | def Initialize( 18 | @Id = 0, 19 | @Email = "" 20 | ) : VOID 21 | { 22 | } 23 | } 24 | 25 | // -- FUNCTIONS 26 | 27 | def GetSubscriber( 28 | result_set : DB::RESULT_SET 29 | ) : SUBSCRIBER 30 | { 31 | return SUBSCRIBER.New( 32 | result_set.Read( INT32 ), 33 | result_set.Read( STRING ) 34 | ); 35 | } 36 | 37 | // ~~ 38 | 39 | def GetSubscriberArray( 40 | ) : ARRAY( SUBSCRIBER ) 41 | { 42 | subscriber_array = ARRAY( SUBSCRIBER ).New(); 43 | 44 | Database.QueryEach "select * from SUBSCRIBER order by Email asc" 45 | do | result_set | 46 | { 47 | subscriber_array.Push( GetSubscriber( result_set ) ); 48 | } 49 | 50 | return subscriber_array; 51 | } 52 | 53 | // ~~ 54 | 55 | def GetSubscriberById( 56 | id : INT32 57 | ) : SUBSCRIBER | NIL 58 | { 59 | Database.QueryEach "select * from SUBSCRIBER where Id = ?", id 60 | do | result_set | 61 | { 62 | return GetSubscriber( result_set ); 63 | } 64 | 65 | return nil; 66 | } 67 | 68 | // ~~ 69 | 70 | def ChangeSubscriber( 71 | id : INT32, 72 | email : STRING 73 | ) : VOID 74 | { 75 | Database.Exec( 76 | "update SUBSCRIBER set Id = ?, Email = ? where Id = ?", 77 | id, 78 | email, 79 | id 80 | ); 81 | } 82 | 83 | // ~~ 84 | 85 | def AddSubscriber( 86 | email : STRING 87 | ) : INT32 88 | { 89 | Database.Exec( 90 | "insert into SUBSCRIBER ( Email ) values ( ? )", 91 | email 92 | ); 93 | 94 | return GetLastInsertId(); 95 | } 96 | 97 | // ~~ 98 | 99 | def RemoveSubscriber( 100 | id : INT32 101 | ) : VOID 102 | { 103 | Database.Exec( 104 | "delete from SUBSCRIBER where Id = ?", 105 | id 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/application.cr: -------------------------------------------------------------------------------- 1 | # -- IMPORTS 2 | 3 | require "db"; 4 | require "ecr"; 5 | require "kemal"; 6 | require "kemal-session"; 7 | require "mysql"; 8 | require "./CONTROLLER/controller.cr"; 9 | require "./MODEL/model.cr"; 10 | 11 | # -- TYPES 12 | 13 | class Application 14 | 15 | # -- IMPORTS 16 | 17 | include Blog; 18 | 19 | # -- ATTRIBUTES 20 | 21 | property \ 22 | database : DB::Database; 23 | 24 | # -- CONSTRUCTORS 25 | 26 | def initialize( 27 | @database = DB.open( "mysql://root:root@localhost:3306/BLOG" ) 28 | ) : Void 29 | 30 | end 31 | 32 | # -- OPERATIONS 33 | 34 | def run( 35 | ) : Void 36 | 37 | Kemal::Session.config \ 38 | do | configuration | 39 | 40 | configuration.secret = "Top secret ;)"; 41 | end 42 | 43 | get( "/" ) \ 44 | do | context | 45 | 46 | show_section( context, 0 ); 47 | end 48 | 49 | get( "/show_section/:section_id" ) \ 50 | do | context | 51 | 52 | section_id = context.params.url[ "section_id" ]; 53 | show_section( context, section_id.to_i32() ); 54 | end 55 | 56 | get( "/show_article/:article_id" ) \ 57 | do | context | 58 | 59 | article_id = context.params.url[ "article_id" ]; 60 | show_article( context, article_id.to_i32() ); 61 | end 62 | 63 | post( "/add_comment/:article_id" ) \ 64 | do | context | 65 | 66 | article_id = context.params.url[ "article_id" ]; 67 | add_comment( context, article_id.to_i32() ); 68 | end 69 | 70 | post( "/add_subscriber" ) \ 71 | do | context | 72 | 73 | add_subscriber( context ); 74 | end 75 | 76 | post( "/connect_user" ) \ 77 | do | context | 78 | 79 | connect_user( context ); 80 | end 81 | 82 | post( "/disconnect_user" ) \ 83 | do | context | 84 | 85 | disconnect_user( context ); 86 | end 87 | 88 | Kemal.run() \ 89 | do | configuration | 90 | 91 | configuration.server.not_nil!().bind_tcp( "0.0.0.0", 3000, reuse_port: true ); 92 | end 93 | end 94 | end 95 | 96 | # -- STATEMENTS 97 | 98 | application = Application.new(); 99 | application.run(); 100 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/application.cb: -------------------------------------------------------------------------------- 1 | // -- IMPORTS 2 | 3 | require "db"; 4 | require "ecr"; 5 | require "kemal"; 6 | require "kemal-session"; 7 | require "mysql"; 8 | require "./CONTROLLER/controller.cr"; 9 | require "./MODEL/model.cr"; 10 | 11 | // -- TYPES 12 | 13 | class APPLICATION 14 | { 15 | // -- IMPORTS 16 | 17 | include BLOG; 18 | 19 | // -- ATTRIBUTES 20 | 21 | property 22 | Database : DB::DATABASE; 23 | 24 | // -- CONSTRUCTORS 25 | 26 | def Initialize( 27 | @Database = DB.Open( "mysql://root:root@localhost:3306/BLOG" ) 28 | ) : VOID 29 | { 30 | } 31 | 32 | // -- OPERATIONS 33 | 34 | def Run( 35 | ) : VOID 36 | { 37 | KEMAL::SESSION.Config 38 | do | configuration | 39 | { 40 | configuration.secret = "Top secret ;)"; 41 | } 42 | 43 | Get( "/" ) 44 | do | context | 45 | { 46 | ShowSection( context, 0 ); 47 | } 48 | 49 | Get( "/show_section/:section_id" ) 50 | do | context | 51 | { 52 | section_id = context.Params.Url[ "section_id" ]; 53 | ShowSection( context, section_id.ToI32() ); 54 | } 55 | 56 | Get( "/show_article/:article_id" ) 57 | do | context | 58 | { 59 | article_id = context.Params.Url[ "article_id" ]; 60 | ShowArticle( context, article_id.ToI32() ); 61 | } 62 | 63 | Post( "/add_comment/:article_id" ) 64 | do | context | 65 | { 66 | article_id = context.Params.Url[ "article_id" ]; 67 | AddComment( context, article_id.ToI32() ); 68 | } 69 | 70 | Post( "/add_subscriber" ) 71 | do | context | 72 | { 73 | AddSubscriber( context ); 74 | } 75 | 76 | Post( "/connect_user" ) 77 | do | context | 78 | { 79 | ConnectUser( context ); 80 | } 81 | 82 | Post( "/disconnect_user" ) 83 | do | context | 84 | { 85 | DisconnectUser( context ); 86 | } 87 | 88 | KEMAL.Run() 89 | do | configuration | 90 | { 91 | configuration.Server.NotNil!().BindTcp( "0.0.0.0", 3000, reuse_port: true ); 92 | } 93 | } 94 | } 95 | 96 | // -- STATEMENTS 97 | 98 | application = APPLICATION.New(); 99 | application.Run(); 100 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/blog.sql: -------------------------------------------------------------------------------- 1 | set @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; 2 | set @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; 3 | set @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; 4 | 5 | drop schema if exists `BLOG`; 6 | 7 | create schema if not exists `BLOG` default character set utf8 collate utf8_general_ci; 8 | 9 | use `BLOG`; 10 | 11 | drop table if exists `BLOG`.`SECTION`; 12 | 13 | create table if not exists `BLOG`.`SECTION`( 14 | `Id` INT NOT NULL AUTO_INCREMENT, 15 | `Number` INT UNSIGNED NULL, 16 | `Name` VARCHAR( 45 ) NULL, 17 | `Text` TEXT NULL, 18 | `Image` VARCHAR( 45 ) NULL, 19 | primary key( `Id` ) 20 | ) engine = InnoDB; 21 | 22 | drop table if exists `BLOG`.`USER`; 23 | 24 | create table if not exists `BLOG`.`USER`( 25 | `Id` INT NOT NULL AUTO_INCREMENT, 26 | `Email` VARCHAR( 45 ) NULL, 27 | `Pseudonym` VARCHAR( 45 ) NULL, 28 | `Password` VARCHAR( 45 ) NULL, 29 | `IsAdministrator` TINYINT UNSIGNED NULL, 30 | primary key( `Id` ) 31 | ) engine = InnoDB; 32 | 33 | drop table if exists `BLOG`.`ARTICLE`; 34 | 35 | create table if not exists `BLOG`.`ARTICLE`( 36 | `Id` INT NOT NULL AUTO_INCREMENT, 37 | `SectionId` INT NULL, 38 | `UserId` INT NULL, 39 | `Title` TEXT NULL, 40 | `Text` TEXT NULL, 41 | `Image` VARCHAR( 45 ) NULL, 42 | `Date` DATE NULL, 43 | primary key( `Id` ), 44 | index `fk_article_section_1_idx`( `SectionId` ASC ), 45 | index `fk_article_user_2_idx`( `UserId` ASC ), 46 | constraint `fk_article_section_1` 47 | foreign key( `SectionId` ) 48 | references `BLOG`.`SECTION`( `Id` ) 49 | on delete set null 50 | on update no action, 51 | constraint `fk_article_user_2` 52 | foreign key( `UserId` ) 53 | references `BLOG`.`USER`( `Id` ) 54 | on delete set null 55 | on update no action 56 | ) engine = InnoDB; 57 | 58 | drop table if exists `BLOG`.`COMMENT`; 59 | 60 | create table if not exists `BLOG`.`COMMENT`( 61 | `Id` INT NOT NULL AUTO_INCREMENT, 62 | `ArticleId` INT NULL, 63 | `UserId` INT NULL, 64 | `Text` TEXT NULL, 65 | `DateTime` DATETIME NULL, 66 | primary key( `Id` ), 67 | index `fk_comment_article_1_idx`( `ArticleId` ASC ), 68 | index `fk_comment_user_2_idx`( `UserId` ASC ), 69 | constraint `fk_comment_article_1` 70 | foreign key( `ArticleId` ) 71 | references `BLOG`.`ARTICLE`( `Id` ) 72 | on delete set null 73 | on update no action, 74 | constraint `fk_comment_user_2` 75 | foreign key( `UserId` ) 76 | references `BLOG`.`USER`( `Id` ) 77 | on delete set null 78 | on update no action 79 | ) engine = InnoDB; 80 | 81 | drop table if exists `BLOG`.`SUBSCRIBER`; 82 | 83 | create table if not exists `BLOG`.`SUBSCRIBER`( 84 | `Id` INT NOT NULL AUTO_INCREMENT, 85 | `Email` VARCHAR( 45 ) NULL, 86 | primary key( `Id` ) 87 | ) engine = InnoDB; 88 | 89 | set SQL_MODE=@OLD_SQL_MODE; 90 | set FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; 91 | set UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; 92 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/section.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- TYPES 6 | 7 | class Section 8 | 9 | # -- ATTRIBUTES 10 | 11 | property \ 12 | id : Int32, 13 | number : Int32, 14 | name : String, 15 | text : String, 16 | image : String, 17 | image_index : Int32; 18 | 19 | # -- CONSTRUCTORS 20 | 21 | def initialize( 22 | @id = 0, 23 | @number = 0, 24 | @name = "", 25 | @text = "", 26 | @image = "", 27 | @image_index = 0 28 | ) : Void 29 | 30 | end 31 | end 32 | 33 | # -- FUNCTIONS 34 | 35 | def get_section( 36 | result_set : DB::ResultSet 37 | ) : Section 38 | 39 | return Section.new( 40 | result_set.read( Int32 ), 41 | result_set.read( Int32 ), 42 | result_set.read( String ), 43 | result_set.read( String ), 44 | result_set.read( String ) 45 | ); 46 | end 47 | 48 | # ~~ 49 | 50 | def get_section_array( 51 | ) : Array( Section ) 52 | 53 | section_array = Array( Section ).new(); 54 | 55 | database.query_each "select * from SECTION order by Number asc" \ 56 | do | result_set | 57 | 58 | section_array.push( get_section( result_set ) ); 59 | end 60 | 61 | return section_array; 62 | end 63 | 64 | # ~~ 65 | 66 | def get_section_by_id( 67 | id : Int32 68 | ) : Section | Nil 69 | 70 | database.query_each "select * from SECTION where Id = ?", id \ 71 | do | result_set | 72 | 73 | return get_section( result_set ); 74 | end 75 | 76 | return nil; 77 | end 78 | 79 | # ~~ 80 | 81 | def change_section( 82 | id : Int32, 83 | number : Int32, 84 | name : String, 85 | text : String, 86 | image : String 87 | ) : Void 88 | 89 | database.exec( 90 | "update SECTION set Id = ?, Number = ?, Name = ?, Text = ?, Image = ? where Id = ?", 91 | id, 92 | number, 93 | name, 94 | text, 95 | image, 96 | id 97 | ); 98 | end 99 | 100 | # ~~ 101 | 102 | def add_section( 103 | number : Int32, 104 | name : String, 105 | text : String, 106 | image : String 107 | ) : Int32 108 | 109 | database.exec( 110 | "insert into SECTION ( Number, Name, Text, Image ) values ( ?, ?, ?, ? )", 111 | number, 112 | name, 113 | text, 114 | image 115 | ); 116 | 117 | return get_last_insert_id(); 118 | end 119 | 120 | # ~~ 121 | 122 | def remove_section( 123 | id : Int32 124 | ) : Void 125 | 126 | database.exec( 127 | "delete from SECTION where Id = ?", 128 | id 129 | ); 130 | end 131 | end 132 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/section.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- TYPES 6 | 7 | class SECTION 8 | { 9 | // -- ATTRIBUTES 10 | 11 | property 12 | Id : INT32, 13 | Number : INT32, 14 | Name : STRING, 15 | Text : STRING, 16 | Image : STRING, 17 | ImageIndex : INT32; 18 | 19 | // -- CONSTRUCTORS 20 | 21 | def Initialize( 22 | @Id = 0, 23 | @Number = 0, 24 | @Name = "", 25 | @Text = "", 26 | @Image = "", 27 | @ImageIndex = 0 28 | ) : VOID 29 | { 30 | } 31 | } 32 | 33 | // -- FUNCTIONS 34 | 35 | def GetSection( 36 | result_set : DB::RESULT_SET 37 | ) : SECTION 38 | { 39 | return SECTION.New( 40 | result_set.Read( INT32 ), 41 | result_set.Read( INT32 ), 42 | result_set.Read( STRING ), 43 | result_set.Read( STRING ), 44 | result_set.Read( STRING ) 45 | ); 46 | } 47 | 48 | // ~~ 49 | 50 | def GetSectionArray( 51 | ) : ARRAY( SECTION ) 52 | { 53 | section_array = ARRAY( SECTION ).New(); 54 | 55 | Database.QueryEach "select * from SECTION order by Number asc" 56 | do | result_set | 57 | { 58 | section_array.Push( GetSection( result_set ) ); 59 | } 60 | 61 | return section_array; 62 | } 63 | 64 | // ~~ 65 | 66 | def GetSectionById( 67 | id : INT32 68 | ) : SECTION | NIL 69 | { 70 | Database.QueryEach "select * from SECTION where Id = ?", id 71 | do | result_set | 72 | { 73 | return GetSection( result_set ); 74 | } 75 | 76 | return nil; 77 | } 78 | 79 | // ~~ 80 | 81 | def ChangeSection( 82 | id : INT32, 83 | number : INT32, 84 | name : STRING, 85 | text : STRING, 86 | image : STRING 87 | ) : VOID 88 | { 89 | Database.Exec( 90 | "update SECTION set Id = ?, Number = ?, Name = ?, Text = ?, Image = ? where Id = ?", 91 | id, 92 | number, 93 | name, 94 | text, 95 | image, 96 | id 97 | ); 98 | } 99 | 100 | // ~~ 101 | 102 | def AddSection( 103 | number : INT32, 104 | name : STRING, 105 | text : STRING, 106 | image : STRING 107 | ) : INT32 108 | { 109 | Database.Exec( 110 | "insert into SECTION ( Number, Name, Text, Image ) values ( ?, ?, ?, ? )", 111 | number, 112 | name, 113 | text, 114 | image 115 | ); 116 | 117 | return GetLastInsertId(); 118 | } 119 | 120 | // ~~ 121 | 122 | def RemoveSection( 123 | id : INT32 124 | ) : VOID 125 | { 126 | Database.Exec( 127 | "delete from SECTION where Id = ?", 128 | id 129 | ); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/user.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- TYPES 6 | 7 | class User 8 | 9 | # -- ATTRIBUTES 10 | 11 | property \ 12 | id : Int32, 13 | email : String, 14 | pseudonym : String, 15 | password : String, 16 | is_administrator : Bool; 17 | 18 | # -- CONSTRUCTORS 19 | 20 | def initialize( 21 | @id = 0, 22 | @email = "", 23 | @pseudonym = "", 24 | @password = "", 25 | @is_administrator = false 26 | ) : Void 27 | 28 | end 29 | end 30 | 31 | # -- FUNCTIONS 32 | 33 | def get_user( 34 | result_set : DB::ResultSet 35 | ) : User 36 | 37 | return User.new( 38 | result_set.read( Int32 ), 39 | result_set.read( String ), 40 | result_set.read( String ), 41 | result_set.read( String ), 42 | result_set.read( Int8 ) ? true : false 43 | ); 44 | end 45 | 46 | # ~~ 47 | 48 | def get_user_array( 49 | ) : Array( User ) 50 | 51 | user_array = Array( User ).new(); 52 | 53 | database.query_each "select * from USER order by Email asc" \ 54 | do | result_set | 55 | 56 | user_array.push( get_user( result_set ) ); 57 | end 58 | 59 | return user_array; 60 | end 61 | 62 | # ~~ 63 | 64 | def get_user_by_id( 65 | id : Int32 66 | ) : User | Nil 67 | 68 | database.query_each "select * from USER where Id = ?", id \ 69 | do | result_set | 70 | 71 | return get_user( result_set ); 72 | end 73 | 74 | return nil; 75 | end 76 | 77 | # ~~ 78 | 79 | def get_user_by_pseudonym_and_password( 80 | pseudonym : String, 81 | password : String 82 | ) : User | Nil 83 | 84 | database.query_each "select * from USER where Pseudonym = ? and Password = ?", pseudonym, password \ 85 | do | result_set | 86 | 87 | return get_user( result_set ); 88 | end 89 | 90 | return nil; 91 | end 92 | 93 | # ~~ 94 | 95 | def change_user( 96 | id : Int32, 97 | email : String, 98 | pseudonym : String, 99 | password : String, 100 | it_is_administrator : Bool 101 | ) : Void 102 | 103 | database.exec( 104 | "update USER set Id = ?, Email = ?, Pseudonym = ?, Password = ?, IsAdministrator = ? where Id = ?", 105 | id, 106 | email, 107 | pseudonym, 108 | password, 109 | it_is_administrator ? 1 : 0, 110 | id 111 | ); 112 | end 113 | 114 | # ~~ 115 | 116 | def add_user( 117 | email : String, 118 | pseudonym : String, 119 | password : String, 120 | it_is_administrator : Bool 121 | ) : Int32 122 | 123 | database.exec( 124 | "insert into USER ( Email, Pseudonym, Password, IsAdministrator ) values ( ?, ?, ?, ? )", 125 | email, 126 | pseudonym, 127 | password, 128 | it_is_administrator ? 1 : 0 129 | ); 130 | 131 | return get_last_insert_id(); 132 | end 133 | 134 | # ~~ 135 | 136 | def remove_user( 137 | id : Int32 138 | ) : Void 139 | 140 | database.exec( 141 | "delete from USER where Id = ?", 142 | id 143 | ); 144 | end 145 | end 146 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/user.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- TYPES 6 | 7 | class USER 8 | { 9 | // -- ATTRIBUTES 10 | 11 | property 12 | Id : INT32, 13 | Email : STRING, 14 | Pseudonym : STRING, 15 | Password : STRING, 16 | IsAdministrator : BOOL; 17 | 18 | // -- CONSTRUCTORS 19 | 20 | def Initialize( 21 | @Id = 0, 22 | @Email = "", 23 | @Pseudonym = "", 24 | @Password = "", 25 | @IsAdministrator = false 26 | ) : VOID 27 | { 28 | } 29 | } 30 | 31 | // -- FUNCTIONS 32 | 33 | def GetUser( 34 | result_set : DB::RESULT_SET 35 | ) : USER 36 | { 37 | return USER.New( 38 | result_set.Read( INT32 ), 39 | result_set.Read( STRING ), 40 | result_set.Read( STRING ), 41 | result_set.Read( STRING ), 42 | result_set.Read( INT8 ) ? true : false 43 | ); 44 | } 45 | 46 | // ~~ 47 | 48 | def GetUserArray( 49 | ) : ARRAY( USER ) 50 | { 51 | user_array = ARRAY( USER ).New(); 52 | 53 | Database.QueryEach "select * from USER order by Email asc" 54 | do | result_set | 55 | { 56 | user_array.Push( GetUser( result_set ) ); 57 | } 58 | 59 | return user_array; 60 | } 61 | 62 | // ~~ 63 | 64 | def GetUserById( 65 | id : INT32 66 | ) : USER | NIL 67 | { 68 | Database.QueryEach "select * from USER where Id = ?", id 69 | do | result_set | 70 | { 71 | return GetUser( result_set ); 72 | } 73 | 74 | return nil; 75 | } 76 | 77 | // ~~ 78 | 79 | def GetUserByPseudonymAndPassword( 80 | pseudonym : STRING, 81 | password : STRING 82 | ) : USER | NIL 83 | { 84 | Database.QueryEach "select * from USER where Pseudonym = ? and Password = ?", pseudonym, password 85 | do | result_set | 86 | { 87 | return GetUser( result_set ); 88 | } 89 | 90 | return nil; 91 | } 92 | 93 | // ~~ 94 | 95 | def ChangeUser( 96 | id : INT32, 97 | email : STRING, 98 | pseudonym : STRING, 99 | password : STRING, 100 | it_is_administrator : BOOL 101 | ) : VOID 102 | { 103 | Database.Exec( 104 | "update USER set Id = ?, Email = ?, Pseudonym = ?, Password = ?, IsAdministrator = ? where Id = ?", 105 | id, 106 | email, 107 | pseudonym, 108 | password, 109 | it_is_administrator ? 1 : 0, 110 | id 111 | ); 112 | } 113 | 114 | // ~~ 115 | 116 | def AddUser( 117 | email : STRING, 118 | pseudonym : STRING, 119 | password : STRING, 120 | it_is_administrator : BOOL 121 | ) : INT32 122 | { 123 | Database.Exec( 124 | "insert into USER ( Email, Pseudonym, Password, IsAdministrator ) values ( ?, ?, ?, ? )", 125 | email, 126 | pseudonym, 127 | password, 128 | it_is_administrator ? 1 : 0 129 | ); 130 | 131 | return GetLastInsertId(); 132 | } 133 | 134 | // ~~ 135 | 136 | def RemoveUser( 137 | id : INT32 138 | ) : VOID 139 | { 140 | Database.Exec( 141 | "delete from USER where Id = ?", 142 | id 143 | ); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/session.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- TYPES 6 | 7 | class Session 8 | 9 | # -- ATTRIBUTES 10 | 11 | property \ 12 | path : String, 13 | message : String, 14 | user_id : Int32, 15 | user_is_connected : Bool, 16 | user_is_administrator : Bool, 17 | user_has_subscribed : Bool; 18 | 19 | # -- CONSTRUCTORS 20 | 21 | def initialize( 22 | context : HTTP::Server::Context 23 | ) : Void 24 | 25 | @path = get_session_string( context, "Path", "" ); 26 | @message = get_session_string( context, "Message", "" ); 27 | @user_id = get_session_integer( context, "UserId", 0 ); 28 | @user_is_connected = get_session_boolean( context, "UserIsConnected", false ); 29 | @user_is_administrator = get_session_boolean( context, "UserIsAdministrator", false ); 30 | @user_has_subscribed = get_session_boolean( context, "UserHasSubscribed", false ); 31 | end 32 | 33 | # -- OPERATIONS 34 | 35 | def store( 36 | context : HTTP::Server::Context 37 | ) : Void 38 | 39 | set_session_string( context, "Path", @path ); 40 | set_session_string( context, "Message", @message ); 41 | set_session_integer( context, "UserId", @user_id ); 42 | set_session_boolean( context, "UserIsConnected", @user_is_connected ); 43 | set_session_boolean( context, "UserIsAdministrator", @user_is_administrator ); 44 | set_session_boolean( context, "UserHasSubscribed", @user_has_subscribed ); 45 | end 46 | 47 | # ~~ 48 | 49 | def set_session_boolean( 50 | context : HTTP::Server::Context, 51 | key : String, 52 | boolean : Bool 53 | ) 54 | 55 | context.session.bool( key, boolean ); 56 | end 57 | 58 | # ~~ 59 | 60 | def get_session_boolean( 61 | context : HTTP::Server::Context, 62 | key : String, 63 | default_boolean : Bool 64 | ) : Bool 65 | 66 | boolean = context.session.bool?( key ); 67 | 68 | if ( boolean.nil?() ) 69 | 70 | return default_boolean; 71 | 72 | else 73 | 74 | return boolean; 75 | end 76 | end 77 | 78 | # ~~ 79 | 80 | def set_session_integer( 81 | context : HTTP::Server::Context, 82 | key : String, 83 | integer : Int32 84 | ) 85 | 86 | context.session.int( key, integer ); 87 | end 88 | 89 | # ~~ 90 | 91 | def get_session_integer( 92 | context : HTTP::Server::Context, 93 | key : String, 94 | default_integer : Int32 95 | ) : Int32 96 | 97 | integer = context.session.int?( key ); 98 | 99 | if ( integer.nil?() ) 100 | 101 | return default_integer; 102 | 103 | else 104 | 105 | return integer; 106 | end 107 | end 108 | 109 | # ~~ 110 | 111 | def set_session_string( 112 | context : HTTP::Server::Context, 113 | key : String, 114 | string : String 115 | ) 116 | 117 | context.session.string( key, string ); 118 | end 119 | 120 | # ~~ 121 | 122 | def get_session_string( 123 | context : HTTP::Server::Context, 124 | key : String, 125 | default_string : String 126 | ) : String 127 | 128 | string = context.session.string?( key ); 129 | 130 | if ( string.nil?() ) 131 | 132 | return default_string; 133 | 134 | else 135 | 136 | return string; 137 | end 138 | end 139 | end 140 | end 141 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/session.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- TYPES 6 | 7 | class SESSION 8 | { 9 | // -- ATTRIBUTES 10 | 11 | property 12 | Path : STRING, 13 | Message : STRING, 14 | UserId : INT32, 15 | UserIsConnected : BOOL, 16 | UserIsAdministrator : BOOL, 17 | UserHasSubscribed : BOOL; 18 | 19 | // -- CONSTRUCTORS 20 | 21 | def Initialize( 22 | context : HTTP::SERVER::CONTEXT 23 | ) : VOID 24 | { 25 | @Path = GetSessionString( context, "Path", "" ); 26 | @Message = GetSessionString( context, "Message", "" ); 27 | @UserId = GetSessionInteger( context, "UserId", 0 ); 28 | @UserIsConnected = GetSessionBoolean( context, "UserIsConnected", false ); 29 | @UserIsAdministrator = GetSessionBoolean( context, "UserIsAdministrator", false ); 30 | @UserHasSubscribed = GetSessionBoolean( context, "UserHasSubscribed", false ); 31 | } 32 | 33 | // -- OPERATIONS 34 | 35 | def Store( 36 | context : HTTP::SERVER::CONTEXT 37 | ) : VOID 38 | { 39 | SetSessionString( context, "Path", @Path ); 40 | SetSessionString( context, "Message", @Message ); 41 | SetSessionInteger( context, "UserId", @UserId ); 42 | SetSessionBoolean( context, "UserIsConnected", @UserIsConnected ); 43 | SetSessionBoolean( context, "UserIsAdministrator", @UserIsAdministrator ); 44 | SetSessionBoolean( context, "UserHasSubscribed", @UserHasSubscribed ); 45 | } 46 | 47 | // ~~ 48 | 49 | def SetSessionBoolean( 50 | context : HTTP::SERVER::CONTEXT, 51 | key : STRING, 52 | boolean : BOOL 53 | ) 54 | { 55 | context.session.bool( key, boolean ); 56 | } 57 | 58 | // ~~ 59 | 60 | def GetSessionBoolean( 61 | context : HTTP::SERVER::CONTEXT, 62 | key : STRING, 63 | default_boolean : BOOL 64 | ) : BOOL 65 | { 66 | boolean = context.session.bool?( key ); 67 | 68 | if ( boolean.Nil?() ) 69 | { 70 | return default_boolean; 71 | } 72 | else 73 | { 74 | return boolean; 75 | } 76 | } 77 | 78 | // ~~ 79 | 80 | def SetSessionInteger( 81 | context : HTTP::SERVER::CONTEXT, 82 | key : STRING, 83 | integer : INT32 84 | ) 85 | { 86 | context.session.int( key, integer ); 87 | } 88 | 89 | // ~~ 90 | 91 | def GetSessionInteger( 92 | context : HTTP::SERVER::CONTEXT, 93 | key : STRING, 94 | default_integer : INT32 95 | ) : INT32 96 | { 97 | integer = context.session.int?( key ); 98 | 99 | if ( integer.Nil?() ) 100 | { 101 | return default_integer; 102 | } 103 | else 104 | { 105 | return integer; 106 | } 107 | } 108 | 109 | // ~~ 110 | 111 | def SetSessionString( 112 | context : HTTP::SERVER::CONTEXT, 113 | key : STRING, 114 | string : STRING 115 | ) 116 | { 117 | context.session.string( key, string ); 118 | } 119 | 120 | // ~~ 121 | 122 | def GetSessionString( 123 | context : HTTP::SERVER::CONTEXT, 124 | key : STRING, 125 | default_string : STRING 126 | ) : STRING 127 | { 128 | string = context.session.string?( key ); 129 | 130 | if ( string.Nil?() ) 131 | { 132 | return default_string; 133 | } 134 | else 135 | { 136 | return string; 137 | } 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://github.com/senselogic/CIBYL/blob/master/LOGO/cibyl.png) 2 | 3 | # Cibyl 4 | 5 | Lightweight curly-bracket language which compiles to Ruby and Crystal. 6 | 7 | # Description 8 | 9 | Cibyl allows to develop Ruby and Crystal applications with a C-like syntax : 10 | 11 | ```ruby 12 | // Recursive Fibonacci function 13 | 14 | def fibonacci( 15 | n : Int32 16 | ) 17 | { 18 | if ( n <= 1 ) 19 | { 20 | return n; 21 | } 22 | else 23 | { 24 | return fibonacci( n - 1 ) + fibonacci( n - 2 ); 25 | } 26 | } 27 | 28 | puts fibonacci( 8 ); 29 | ``` 30 | 31 | Optionally, Cibyl allows to use other case conventions : 32 | 33 | ```ruby 34 | require "http/server"; 35 | 36 | server = HTTP::SERVER.New 37 | do | context | 38 | { 39 | context.Response.ContentType = "text/plain"; 40 | context.Response.Print( "Hello world! The time is #{TIME.Now}" ); 41 | } 42 | 43 | address = server.BindTcp( 8080 ); 44 | Puts( "Listening on http://#{address}" ); 45 | server.Listen(); 46 | ``` 47 | 48 | ## Syntax 49 | 50 | Most of the Ruby/Crystal syntax is kept unchanged, except that : 51 | 52 | * `.cb` files contain Cibyl code 53 | * `.ecb` files contain embedded Cibyl code 54 | * blocks start by a `{` line and end by a `}` line 55 | * `do` blocks start their own lines 56 | * short comments start by `//` 57 | * long comments start by `/*` and end by `*/` 58 | * `<%~` `%>` blocks apply `HTML.escape` to their content 59 | 60 | If the `--convert` option is used : 61 | 62 | * `$` prefixes are converted to `@@` 63 | * `PascalCase` identifiers are converted to `snake_case` 64 | * `UPPER_CASE` identifiers are converted to `PascalCase` 65 | * `PascalCase` identifiers prefixed with `#` are converted to `UPPER_CASE` 66 | * `snake_case` identifiers prefixed with `#` are converted to `PascalCase` 67 | 68 | Characters and identifiers prefixed with `\` are kept unchanged. 69 | 70 | ## Limitations 71 | 72 | * Blocks must be properly aligned. 73 | * Multi-line strings are not supported. 74 | * Curly bracket blocks can't be used in embedded code. 75 | 76 | ## Installation 77 | 78 | Install the [DMD 2 compiler](https://dlang.org/download.html) (using the MinGW setup option on Windows). 79 | 80 | Build the executable with the following command line : 81 | 82 | ```bash 83 | dmd -m64 cibyl.d 84 | ``` 85 | 86 | ## Command line 87 | 88 | ``` 89 | cibyl [options] INPUT_FOLDER/ OUTPUT_FOLDER/ 90 | ``` 91 | 92 | ### Options 93 | 94 | ``` 95 | --ruby : generate Ruby files 96 | --crystal : generate Crystal files 97 | --replace dictionary.txt : replace identifiers defined in this dictionary 98 | --convert : convert the identifier case 99 | --join : join split statements 100 | --compact : remove unused lines 101 | --create : create the output folders if needed 102 | --watch : watch the Cibyl files for modifications 103 | --pause 500 : time to wait before checking the Cibyl files again 104 | --tabulation 4 : set the tabulation space count 105 | ``` 106 | 107 | ### Examples 108 | 109 | ```bash 110 | cibyl --ruby --compact CB/ RB/ 111 | ``` 112 | 113 | Converts the Cibyl files of the input folder into matching Ruby files in the output folder. 114 | 115 | ```bash 116 | cibyl --crystal --create --watch CB/ CR/ 117 | ``` 118 | 119 | Converts the Cibyl files of the input folder into matching Crystal files in the output folder 120 | (creating the Crystal folders if needed), 121 | then watches the Cibyl files for modifications. 122 | 123 | ```bash 124 | cibyl --crystal --replace dictionary.txt --convert --join --create --watch CB/ CR/ 125 | ``` 126 | 127 | Converts the Cibyl files of the input folder into matching Crystal files in the output folder 128 | (replacing the identifiers defined in the dictionary, converting the identifier case, 129 | joining split statements and creating the Crystal folders if needed), 130 | then watches the Cibyl files for modifications. 131 | 132 | ## Version 133 | 134 | 1.3 135 | 136 | ## Author 137 | 138 | Eric Pelzer (ecstatic.coder@gmail.com). 139 | 140 | ## License 141 | 142 | This project is licensed under the GNU General Public License version 3. 143 | 144 | See the [LICENSE.md](LICENSE.md) file for details. 145 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/comment.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- TYPES 6 | 7 | class Comment 8 | 9 | # -- ATTRIBUTES 10 | 11 | property \ 12 | id : Int32, 13 | article_id : Int32, 14 | user_id : Int32, 15 | text : String, 16 | date_time : Time, 17 | article : Article | Nil, 18 | user : User | Nil; 19 | 20 | # -- CONSTRUCTORS 21 | 22 | def initialize( 23 | @id = 0, 24 | @article_id = 0, 25 | @user_id = 0, 26 | @text = 0, 27 | @date_time = Time.utc( 1, 1, 1, 0, 0, 0 ), 28 | @article = nil, 29 | @user = nil 30 | ) : Void 31 | 32 | end 33 | end 34 | 35 | # -- FUNCTIONS 36 | 37 | def get_comment( 38 | result_set : DB::ResultSet 39 | ) : Comment 40 | 41 | return Comment.new( 42 | result_set.read( Int32 ), 43 | result_set.read( Int32 ), 44 | result_set.read( Int32 ), 45 | result_set.read( String ), 46 | result_set.read( Time ) 47 | ); 48 | end 49 | 50 | # ~~ 51 | 52 | def inflate_comment( 53 | comment : Comment 54 | ) : Void 55 | 56 | comment.article = get_article_by_id( comment.article_id ); 57 | comment.user = get_user_by_id( comment.user_id ); 58 | end 59 | 60 | # ~~ 61 | 62 | def inflate_comment_array( 63 | comment_array : Array( Comment ) 64 | ) : Void 65 | 66 | comment_array.each \ 67 | do | comment | 68 | 69 | inflate_comment( comment ); 70 | end 71 | end 72 | 73 | # ~~ 74 | 75 | def get_comment_array( 76 | ) : Array( Comment ) 77 | 78 | comment_array = Array( Comment ).new(); 79 | 80 | database.query_each "select * from COMMENT order by DateTime DESC" \ 81 | do | result_set | 82 | 83 | comment_array.push( get_comment( result_set ) ); 84 | end 85 | 86 | return comment_array; 87 | end 88 | 89 | # ~~ 90 | 91 | def get_comment_by_id( 92 | id : Int32 93 | ) : Comment | Nil 94 | 95 | database.query_each "select * from COMMENT where Id = ?", id \ 96 | do | result_set | 97 | 98 | return get_comment( result_set ); 99 | end 100 | 101 | return nil; 102 | end 103 | 104 | # ~~ 105 | 106 | def get_comment_array_by_article_id( 107 | article_id : Int32 108 | ) : Array( Comment ) 109 | 110 | comment_array = Array( Comment ).new(); 111 | 112 | database.query_each "select * from COMMENT where ArticleId = ? order by DateTime DESC", article_id \ 113 | do | result_set | 114 | 115 | comment_array.push( get_comment( result_set ) ); 116 | end 117 | 118 | return comment_array; 119 | end 120 | 121 | # ~~ 122 | 123 | def change_comment( 124 | id : Int32, 125 | article_id : Int32, 126 | user_id : Int32, 127 | text : String, 128 | date_time : String 129 | ) : Void 130 | 131 | database.exec( 132 | "update COMMENT set Id = ?, ArticleId = ?, UserId = ?, Text = ?, DateTime = ? where Id = ?", 133 | id, 134 | article_id, 135 | user_id, 136 | text, 137 | date_time, 138 | id 139 | ); 140 | end 141 | 142 | # ~~ 143 | 144 | def add_comment( 145 | article_id : Int32, 146 | user_id : Int32, 147 | text : String 148 | ) : Int32 149 | 150 | database.exec( 151 | "insert into COMMENT ( ArticleId, UserId, Text, DateTime ) values ( ?, ?, ?, NOW() )", 152 | article_id, 153 | user_id, 154 | text 155 | ); 156 | 157 | return get_last_insert_id(); 158 | end 159 | 160 | # ~~ 161 | 162 | def remove_comment( 163 | id : Int32 164 | ) : Void 165 | 166 | database.exec( 167 | "delete from COMMENT where Id = ?", 168 | id 169 | ); 170 | end 171 | end 172 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/comment.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- TYPES 6 | 7 | class COMMENT 8 | { 9 | // -- ATTRIBUTES 10 | 11 | property 12 | Id : INT32, 13 | ArticleId : INT32, 14 | UserId : INT32, 15 | Text : STRING, 16 | DateTime : TIME, 17 | Article : ARTICLE | NIL, 18 | User : USER | NIL; 19 | 20 | // -- CONSTRUCTORS 21 | 22 | def Initialize( 23 | @Id = 0, 24 | @ArticleId = 0, 25 | @UserId = 0, 26 | @Text = 0, 27 | @DateTime = TIME.Utc( 1, 1, 1, 0, 0, 0 ), 28 | @Article = nil, 29 | @User = nil 30 | ) : VOID 31 | { 32 | } 33 | } 34 | 35 | // -- FUNCTIONS 36 | 37 | def GetComment( 38 | result_set : DB::RESULT_SET 39 | ) : COMMENT 40 | { 41 | return COMMENT.New( 42 | result_set.Read( INT32 ), 43 | result_set.Read( INT32 ), 44 | result_set.Read( INT32 ), 45 | result_set.Read( STRING ), 46 | result_set.Read( TIME ) 47 | ); 48 | } 49 | 50 | // ~~ 51 | 52 | def InflateComment( 53 | comment : COMMENT 54 | ) : VOID 55 | { 56 | comment.Article = GetArticleById( comment.ArticleId ); 57 | comment.User = GetUserById( comment.UserId ); 58 | } 59 | 60 | // ~~ 61 | 62 | def InflateCommentArray( 63 | comment_array : ARRAY( COMMENT ) 64 | ) : VOID 65 | { 66 | comment_array.Each 67 | do | comment | 68 | { 69 | InflateComment( comment ); 70 | } 71 | } 72 | 73 | // ~~ 74 | 75 | def GetCommentArray( 76 | ) : ARRAY( COMMENT ) 77 | { 78 | comment_array = ARRAY( COMMENT ).New(); 79 | 80 | Database.QueryEach "select * from COMMENT order by DateTime DESC" 81 | do | result_set | 82 | { 83 | comment_array.Push( GetComment( result_set ) ); 84 | } 85 | 86 | return comment_array; 87 | } 88 | 89 | // ~~ 90 | 91 | def GetCommentById( 92 | id : INT32 93 | ) : COMMENT | NIL 94 | { 95 | Database.QueryEach "select * from COMMENT where Id = ?", id 96 | do | result_set | 97 | { 98 | return GetComment( result_set ); 99 | } 100 | 101 | return nil; 102 | } 103 | 104 | // ~~ 105 | 106 | def GetCommentArrayByArticleId( 107 | article_id : INT32 108 | ) : ARRAY( COMMENT ) 109 | { 110 | comment_array = ARRAY( COMMENT ).New(); 111 | 112 | Database.QueryEach "select * from COMMENT where ArticleId = ? order by DateTime DESC", article_id 113 | do | result_set | 114 | { 115 | comment_array.Push( GetComment( result_set ) ); 116 | } 117 | 118 | return comment_array; 119 | } 120 | 121 | // ~~ 122 | 123 | def ChangeComment( 124 | id : INT32, 125 | article_id : INT32, 126 | user_id : INT32, 127 | text : STRING, 128 | date_time : STRING 129 | ) : VOID 130 | { 131 | Database.Exec( 132 | "update COMMENT set Id = ?, ArticleId = ?, UserId = ?, Text = ?, DateTime = ? where Id = ?", 133 | id, 134 | article_id, 135 | user_id, 136 | text, 137 | date_time, 138 | id 139 | ); 140 | } 141 | 142 | // ~~ 143 | 144 | def AddComment( 145 | article_id : INT32, 146 | user_id : INT32, 147 | text : STRING 148 | ) : INT32 149 | { 150 | Database.Exec( 151 | "insert into COMMENT ( ArticleId, UserId, Text, DateTime ) values ( ?, ?, ?, NOW() )", 152 | article_id, 153 | user_id, 154 | text 155 | ); 156 | 157 | return GetLastInsertId(); 158 | } 159 | 160 | // ~~ 161 | 162 | def RemoveComment( 163 | id : INT32 164 | ) : VOID 165 | { 166 | Database.Exec( 167 | "delete from COMMENT where Id = ?", 168 | id 169 | ); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/VIEW/show_page_view.ecb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Blog 9 | 10 | 11 | 12 |
13 | 31 |
32 |
33 |
34 |

35 | Blog 36 |

37 | <%= content %> 38 |
39 |
40 | <% if ( session.UserIsConnected ) %> 41 |
42 |
43 |
44 | 45 | 46 |
47 |
48 |
49 | <% else %> 50 |
51 |
52 |
53 | Connection 54 |
55 |
56 | 60 | 64 | 65 |
66 |
67 |
68 | <% end %> 69 | <% if ( !session.UserHasSubscribed ) %> 70 |
71 |
72 |
73 | Newsletter 74 |
75 |
76 | 80 | 81 |
82 |
83 |
84 | <% end %> 85 |
86 |
87 | 88 | 89 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/VIEW/show_page_view.ecr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Blog 9 | 10 | 11 | 12 |
13 | 31 |
32 |
33 |
34 |

35 | Blog 36 |

37 | <%= content %> 38 |
39 |
40 | <% if ( session.user_is_connected ) %> 41 |
42 |
43 |
44 | 45 | 46 |
47 |
48 |
49 | <% else %> 50 |
51 |
52 |
53 | Connection 54 |
55 |
56 | 60 | 64 | 65 |
66 |
67 |
68 | <% end %> 69 | <% if ( !session.user_has_subscribed ) %> 70 |
71 |
72 |
73 | Newsletter 74 |
75 |
76 | 80 | 81 |
82 |
83 |
84 | <% end %> 85 |
86 |
87 | 88 | 89 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CR/src/MODEL/article.cr: -------------------------------------------------------------------------------- 1 | # -- MODULES 2 | 3 | module Blog 4 | 5 | # -- TYPES 6 | 7 | class Article 8 | 9 | # -- ATTRIBUTES 10 | 11 | property \ 12 | id : Int32, 13 | section_id : Int32, 14 | user_id : Int32, 15 | title : String, 16 | text : String, 17 | image : String, 18 | date : Time, 19 | section : Section | Nil, 20 | user : User | Nil, 21 | image_index : Int32; 22 | 23 | # -- CONSTRUCTORS 24 | 25 | def initialize( 26 | @id = 0, 27 | @section_id = 0, 28 | @user_id = 0, 29 | @title = "", 30 | @text = "", 31 | @image = "", 32 | @date = Time.utc( 1, 1, 1, 0, 0, 0 ), 33 | @section = nil, 34 | @user = nil, 35 | @image_index = 0 36 | ) : Void 37 | 38 | end 39 | end 40 | 41 | # -- FUNCTIONS 42 | 43 | def get_article( 44 | result_set : DB::ResultSet 45 | ) : Article 46 | 47 | return Article.new( 48 | result_set.read( Int32 ), 49 | result_set.read( Int32 ), 50 | result_set.read( Int32 ), 51 | result_set.read( String ), 52 | result_set.read( String ), 53 | result_set.read( String ), 54 | result_set.read( Time ) 55 | ); 56 | end 57 | 58 | # ~~ 59 | 60 | def inflate_article( 61 | article : Article 62 | ) : Void 63 | 64 | article.section = get_section_by_id( article.section_id ); 65 | article.user = get_user_by_id( article.user_id ); 66 | end 67 | 68 | # ~~ 69 | 70 | def inflate_article_array( 71 | article_array : Array( Article ) 72 | ) : Void 73 | 74 | article_array.each \ 75 | do | article | 76 | 77 | inflate_article( article ); 78 | end 79 | end 80 | 81 | # ~~ 82 | 83 | def get_article_array( 84 | ) : Array( Article ) 85 | 86 | article_array = Array( Article ).new(); 87 | 88 | database.query_each "select * from ARTICLE order by Date DESC" \ 89 | do | result_set | 90 | 91 | article_array.push( get_article( result_set ) ); 92 | end 93 | 94 | return article_array; 95 | end 96 | 97 | # ~~ 98 | 99 | def get_article_by_id( 100 | id : Int32 101 | ) : Article | Nil 102 | 103 | database.query_each "select * from ARTICLE where Id = ?", id \ 104 | do | result_set | 105 | 106 | return get_article( result_set ); 107 | end 108 | 109 | return nil; 110 | end 111 | 112 | # ~~ 113 | 114 | def get_article_array_by_section_id( 115 | section_id : Int32 116 | ) : Array( Article ) 117 | 118 | article_array = Array( Article ).new(); 119 | 120 | database.query_each "select * from ARTICLE where SectionId = ? order by Date DESC", section_id \ 121 | do | result_set | 122 | 123 | article_array.push( get_article( result_set ) ); 124 | end 125 | 126 | return article_array; 127 | end 128 | 129 | # ~~ 130 | 131 | def change_article( 132 | id : Int32, 133 | title : String, 134 | text : String, 135 | image : String, 136 | date : String, 137 | section_id : Int32, 138 | user_id : Int32 139 | ) : Void 140 | 141 | database.exec( 142 | "update ARTICLE set Id = ?, SectionId = ?, UserId = ?, Title = ?, Text = ?, Image = ?, Date = ? where Id = ?", 143 | id, 144 | section_id, 145 | user_id, 146 | title, 147 | text, 148 | image, 149 | date, 150 | id 151 | ); 152 | end 153 | 154 | # ~~ 155 | 156 | def add_article( 157 | title : String, 158 | text : String, 159 | image : String, 160 | section_id : Int32, 161 | user_id : Int32 162 | ) : Int32 163 | 164 | database.exec( 165 | "insert into ARTICLE ( SectionId, UserId, Title, Text, Image, Date ) values ( ?, ?, ?, ?, ?, NOW() )", 166 | section_id, 167 | user_id, 168 | title, 169 | text, 170 | image 171 | ); 172 | 173 | return get_last_insert_id(); 174 | end 175 | 176 | # ~~ 177 | 178 | def remove_article( 179 | id : Int32 180 | ) : Void 181 | 182 | database.exec( 183 | "delete from ARTICLE where Id = ?", 184 | id 185 | ); 186 | end 187 | end 188 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/CB/src/MODEL/article.cb: -------------------------------------------------------------------------------- 1 | // -- MODULES 2 | 3 | module BLOG 4 | { 5 | // -- TYPES 6 | 7 | class ARTICLE 8 | { 9 | // -- ATTRIBUTES 10 | 11 | property 12 | Id : INT32, 13 | SectionId : INT32, 14 | UserId : INT32, 15 | Title : STRING, 16 | Text : STRING, 17 | Image : STRING, 18 | Date : TIME, 19 | Section : SECTION | NIL, 20 | User : USER | NIL, 21 | ImageIndex : INT32; 22 | 23 | // -- CONSTRUCTORS 24 | 25 | def Initialize( 26 | @Id = 0, 27 | @SectionId = 0, 28 | @UserId = 0, 29 | @Title = "", 30 | @Text = "", 31 | @Image = "", 32 | @Date = TIME.Utc( 1, 1, 1, 0, 0, 0 ), 33 | @Section = nil, 34 | @User = nil, 35 | @ImageIndex = 0 36 | ) : VOID 37 | { 38 | } 39 | } 40 | 41 | // -- FUNCTIONS 42 | 43 | def GetArticle( 44 | result_set : DB::RESULT_SET 45 | ) : ARTICLE 46 | { 47 | return ARTICLE.New( 48 | result_set.Read( INT32 ), 49 | result_set.Read( INT32 ), 50 | result_set.Read( INT32 ), 51 | result_set.Read( STRING ), 52 | result_set.Read( STRING ), 53 | result_set.Read( STRING ), 54 | result_set.Read( TIME ) 55 | ); 56 | } 57 | 58 | // ~~ 59 | 60 | def InflateArticle( 61 | article : ARTICLE 62 | ) : VOID 63 | { 64 | article.Section = GetSectionById( article.SectionId ); 65 | article.User = GetUserById( article.UserId ); 66 | } 67 | 68 | // ~~ 69 | 70 | def InflateArticleArray( 71 | article_array : ARRAY( ARTICLE ) 72 | ) : VOID 73 | { 74 | article_array.Each 75 | do | article | 76 | { 77 | InflateArticle( article ); 78 | } 79 | } 80 | 81 | // ~~ 82 | 83 | def GetArticleArray( 84 | ) : ARRAY( ARTICLE ) 85 | { 86 | article_array = ARRAY( ARTICLE ).New(); 87 | 88 | Database.QueryEach "select * from ARTICLE order by Date DESC" 89 | do | result_set | 90 | { 91 | article_array.Push( GetArticle( result_set ) ); 92 | } 93 | 94 | return article_array; 95 | } 96 | 97 | // ~~ 98 | 99 | def GetArticleById( 100 | id : INT32 101 | ) : ARTICLE | NIL 102 | { 103 | Database.QueryEach "select * from ARTICLE where Id = ?", id 104 | do | result_set | 105 | { 106 | return GetArticle( result_set ); 107 | } 108 | 109 | return nil; 110 | } 111 | 112 | // ~~ 113 | 114 | def GetArticleArrayBySectionId( 115 | section_id : INT32 116 | ) : ARRAY( ARTICLE ) 117 | { 118 | article_array = ARRAY( ARTICLE ).New(); 119 | 120 | Database.QueryEach "select * from ARTICLE where SectionId = ? order by Date DESC", section_id 121 | do | result_set | 122 | { 123 | article_array.Push( GetArticle( result_set ) ); 124 | } 125 | 126 | return article_array; 127 | } 128 | 129 | // ~~ 130 | 131 | def ChangeArticle( 132 | id : INT32, 133 | title : STRING, 134 | text : STRING, 135 | image : STRING, 136 | date : STRING, 137 | section_id : INT32, 138 | user_id : INT32 139 | ) : VOID 140 | { 141 | Database.Exec( 142 | "update ARTICLE set Id = ?, SectionId = ?, UserId = ?, Title = ?, Text = ?, Image = ?, Date = ? where Id = ?", 143 | id, 144 | section_id, 145 | user_id, 146 | title, 147 | text, 148 | image, 149 | date, 150 | id 151 | ); 152 | } 153 | 154 | // ~~ 155 | 156 | def AddArticle( 157 | title : STRING, 158 | text : STRING, 159 | image : STRING, 160 | section_id : INT32, 161 | user_id : INT32 162 | ) : INT32 163 | { 164 | Database.Exec( 165 | "insert into ARTICLE ( SectionId, UserId, Title, Text, Image, Date ) values ( ?, ?, ?, ?, ?, NOW() )", 166 | section_id, 167 | user_id, 168 | title, 169 | text, 170 | image 171 | ); 172 | 173 | return GetLastInsertId(); 174 | } 175 | 176 | // ~~ 177 | 178 | def RemoveArticle( 179 | id : INT32 180 | ) : VOID 181 | { 182 | Database.Exec( 183 | "delete from ARTICLE where Id = ?", 184 | id 185 | ); 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /LOGO/cibyl.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | image/svg+xmlCIBYL 138 | -------------------------------------------------------------------------------- /TEST/RB/test.rb: -------------------------------------------------------------------------------- 1 | # -- IMPORTS 2 | 3 | require "ecr" 4 | require "http/server"; 5 | 6 | # -- MODULES 7 | 8 | module Test 9 | # -- TYPES 10 | 11 | abstract struct Abstract 12 | end 13 | 14 | # ~~ 15 | 16 | struct Position 17 | # -- ATTRIBUTES 18 | 19 | protected property \ 20 | x : Float64, 21 | y : Float64, 22 | z : Float64; 23 | class_property \ 24 | zero = Position.new( 0.0, 0.0, 0.0 ); 25 | 26 | # -- CONSTRUCTORS 27 | 28 | def initialize( 29 | @x, 30 | @y, 31 | @z 32 | ) : Void 33 | end 34 | 35 | # -- INQUIRIES 36 | 37 | def is_zero( 38 | ) : Bool 39 | return 40 | x == @@zero.x \ 41 | && y == @@zero.y \ 42 | && z == @@zero.z; 43 | end 44 | end 45 | 46 | # ~~ 47 | 48 | enum Color 49 | # -- CONSTANTS 50 | 51 | RED 52 | GREEN 53 | BLUE 54 | 55 | # -- INQUIRIES 56 | 57 | def is_red?( 58 | ) : Bool 59 | return self == RED; 60 | end 61 | end 62 | 63 | # ~~ 64 | 65 | struct Point 66 | # -- CONSTRUCTORS 67 | 68 | def initialize( 69 | @name : String, 70 | @position : Position, 71 | @color : Color 72 | ) : Void 73 | end 74 | 75 | # -- INQUIRIES 76 | 77 | def is_blue( 78 | ) : Bool 79 | return @color == Color::BLUE; 80 | end 81 | end 82 | 83 | # ~~ 84 | 85 | struct Person 86 | # -- ATTRIBUTES 87 | 88 | property \ 89 | name : String, 90 | age : Int32, 91 | color : Color; 92 | class_property \ 93 | minimum_age : Int32 = 25, 94 | maximum_age : Int32 = 70; 95 | 96 | # -- CONSTRUCTORS 97 | 98 | def initialize( 99 | @name, 100 | @age, 101 | @color 102 | ) : Void 103 | if ( @age < @@minimum_age ) 104 | puts( "Studying" ); 105 | elsif ( @age >= @@minimum_age \ 106 | && @age < @@maximum_age ) 107 | puts( "Working" ); 108 | else 109 | puts( "Retreated" ); 110 | end 111 | end 112 | 113 | # -- INQUIRIES 114 | 115 | def is_green?( 116 | ) : Bool 117 | return color == Color::GREEN; 118 | end 119 | 120 | # -- OPERATIONS 121 | 122 | protected def print( 123 | ) : Void 124 | puts( "#{age} - #{name}" ); 125 | end 126 | end 127 | 128 | # ~~ 129 | 130 | class Test 131 | # -- CONSTRUCTORS 132 | 133 | def initialize( 134 | @hello : String, 135 | @world : String 136 | ) : Void 137 | end 138 | 139 | # -- OPERATIONS 140 | 141 | def test_comment( 142 | count : Int32 143 | ) : Int32 144 | #**************** 145 | # This is 146 | # a single-line 147 | # comment. 148 | #**************** 149 | # This is a single-line comment. 150 | # This is 151 | # 152 | # a multi-line 153 | # 154 | # comment. 155 | # 156 | # This is 157 | # 158 | # a multi-line 159 | # 160 | # comment. 161 | # 162 | # This is 163 | # 164 | # a multi-line 165 | # 166 | # comment. 167 | # This is 168 | # 169 | #a multi-line 170 | # 171 | #comment. 172 | # This 173 | # 174 | # is 175 | # 176 | #a multi-line 177 | # 178 | # comment. 179 | # This is 180 | # 181 | # a multi-line 182 | # 183 | # comment. 184 | 185 | if ( count <= 1 ) # This is a comment. 186 | return 10; # This is a comment. 187 | else 188 | return 20; # This is a comment. 189 | end 190 | end 191 | 192 | # ~~ 193 | 194 | def test_if( 195 | count : Int32 196 | ) : Int32 197 | if ( count <= 1 ) 198 | return 10; 199 | end 200 | 201 | if ( count <= 1 ) 202 | return 10; 203 | else 204 | return 20; 205 | end 206 | 207 | if ( count <= 1 ) 208 | return 10; 209 | elsif ( count <= 2 ) 210 | return 20; 211 | elsif ( count <= 3 \ 212 | && count != 1 \ 213 | && count != 2 ) 214 | return 30; 215 | else 216 | return 40; 217 | end 218 | 219 | if ( count >= 1 \ 220 | && count * 2 \ 221 | < count * 3 - 5 ) 222 | count \ 223 | += test_unless( 224 | count * 3 - 5 \ 225 | - count * 2 226 | ); 227 | end 228 | end 229 | 230 | # ~~ 231 | 232 | def test_unless( 233 | count : Int32 234 | ) : Int32 235 | unless ( count > 1 ) 236 | return 10; 237 | end 238 | 239 | unless ( count > 1 ) 240 | return 10; 241 | else 242 | return 20; 243 | end 244 | end 245 | 246 | # ~~ 247 | 248 | def test_while( 249 | count : Int32 250 | ) : Int32 251 | index = 0; 252 | 253 | while ( index < count ) 254 | index = index + 1; 255 | end 256 | 257 | return index; 258 | end 259 | 260 | # ~~ 261 | 262 | def test_until( 263 | count : Int32 264 | ) : Int32 265 | index = 0; 266 | 267 | until ( index >= count ) 268 | index = index + 1; 269 | end 270 | 271 | return index; 272 | end 273 | 274 | # ~~ 275 | 276 | def test_case( 277 | count : Int32 278 | ) : Int32 279 | case ( count ) 280 | when 1 281 | return 10; 282 | end 283 | 284 | case ( count ) 285 | when 1 286 | return 10; 287 | when 2 288 | return 20; 289 | end 290 | 291 | case ( count ) 292 | when 1 293 | return 10; 294 | when 2 295 | return 20; 296 | else 297 | return 30; 298 | end 299 | end 300 | 301 | # ~~ 302 | 303 | def test_begin( 304 | ) : Int32 305 | begin 306 | result = 10; 307 | rescue 308 | result = 20; 309 | else 310 | result = 30; 311 | ensure 312 | result = 40; 313 | end 314 | end 315 | 316 | # ~~ 317 | 318 | def test_rescue( 319 | ) : Int32 320 | result = 10; 321 | rescue 322 | result = 20; 323 | else 324 | result = 30; 325 | ensure 326 | result = 40; 327 | end 328 | 329 | # ~~ 330 | 331 | def test_each( 332 | ) : Bool 333 | "0123456789".each_char \ 334 | do | character | 335 | print( character ); 336 | end 337 | 338 | print( '\n' ); 339 | 340 | [ 341 | { 1, "A" }, 342 | { 2, "B" } 343 | ].each \ 344 | do | key, value | 345 | puts( "#{key} : #{value}" ); 346 | end 347 | 348 | return true; 349 | end 350 | 351 | # ~~ 352 | 353 | def test_type( 354 | ) : Bool 355 | data = Array( NamedTuple( id: Int32, name: String ) ).new(); 356 | data.push( { id: 1, name: "Toto" } ); 357 | data.push( { id: 2, name: "Tutu" } ); 358 | data.push( { id: 3, name: "Tata" } ); 359 | data.push( { id: 4, name: "Titi" } ); 360 | 361 | puts( data ); 362 | 363 | return true; 364 | end 365 | 366 | # ~~ 367 | 368 | def test_character( 369 | ) : Bool 370 | puts( '\'' ); 371 | puts( '\\' ); 372 | puts( '\u0041' ); 373 | puts( '\u{41}' ); 374 | puts( 'a' ); 375 | puts( 'あ' ); 376 | 377 | return true; 378 | end 379 | 380 | # ~~ 381 | 382 | def test_string( 383 | ) : Bool 384 | puts( "Test #{@hello + " Test #{@hello} #{@world} Test " + @world} Test" ); 385 | puts( %(Test #{@hello + %( Test #{@hello} #{@world} Test ) + @world} Test) ); 386 | puts( %[Test #{@hello + %[ Test #{@hello} #{@world} Test ] + @world} Test] ); 387 | puts( %{Test #{@hello + %{ Test #{@hello} #{@world} Test } + @world} Test} ); 388 | puts( % + @world} Test> ); 389 | puts( %|Test #{@hello + %| Test #{@hello} #{@world} Test | + @world} Test| ); 390 | puts( %(Test #{@hello + %[ Test #{@hello} #{@world} Test ] + @world} Test) ); 391 | puts( %Q(Test #{@hello + %Q( Test #{@hello} #{@world} Test ) + @world} Test) ); 392 | puts( %Q[Test #{@hello + %Q[ Test #{@hello} #{@world} Test ] + @world} Test] ); 393 | puts( %Q{Test #{@hello + %Q{ Test #{@hello} #{@world} Test } + @world} Test} ); 394 | puts( %Q + @world} Test> ); 395 | puts( %Q|Test #{@hello + %Q| Test #{@hello} #{@world} Test | + @world} Test| ); 396 | puts( %Q(Test #{@hello + %Q[ Test #{@hello} #{@world} Test ] + @world} Test) ); 397 | 398 | puts( "Test \#{@Hello + \" Test \#{@Hello} \#{@World} Test \" + @World} Test" ); 399 | puts( %q(Test #{@Hello + %q( Test #{@Hello} #{@World} Test ) + @World} Test) ); 400 | puts( %q[Test #{@Hello + %q[ Test #{@Hello} #{@World} Test ] + @World} Test] ); 401 | puts( %q{Test #{@Hello + %q{ Test #{@Hello} #{@World} Test } + @World} Test} ); 402 | puts( %q + @World} Test> ); 403 | puts( %q(Test #{@Hello + %q[ Test #{@Hello} #{@World} Test ] + @World} Test) ); 404 | 405 | [ "", " ", "x", "x x", " Hello World ! " ].each \ 406 | do | old_text | 407 | part_array = old_text.split( ' ' ); 408 | new_text = part_array.join( ' ' ); 409 | puts( "'#{old_text}' => #{part_array} => '#{new_text}'" ); 410 | end 411 | 412 | return true; 413 | end 414 | 415 | # ~~ 416 | 417 | def test_letter_case( 418 | ) : Bool 419 | # snake_case PascalCase UPPER_CASE 420 | # snake_case PascalCase UPPER_CASE 421 | # snake_case PascalCase UPPER_CASE 422 | # // \ $snake_case #snake_case UINT32 UInt32 423 | 424 | return true; 425 | end 426 | 427 | # ~~ 428 | 429 | def test_server( 430 | server_is_run 431 | ) : Bool 432 | if ( server_is_run ) 433 | server = HTTP::Server.new \ 434 | do | context | 435 | context.response.content_type = "text/plain"; 436 | context.response.print( "Hello world! The time is #{Time.now}" ); 437 | end 438 | 439 | address = server.bind_tcp( 8080 ); 440 | puts( "Listening on http://#{address}" ); 441 | server.listen(); 442 | end 443 | 444 | return true; 445 | end 446 | 447 | # ~~ 448 | 449 | def run( 450 | ) : Void 451 | puts( test_comment( 1 ) ); 452 | puts( test_if( 1 ) ); 453 | puts( test_unless( 1 ) ); 454 | puts( test_while( 10 ) ); 455 | puts( test_until( 10 ) ); 456 | puts( test_case( 1 ) ); 457 | puts( test_begin() ); 458 | puts( test_rescue() ); 459 | puts( test_each() ); 460 | puts( test_type() ); 461 | puts( test_character() ); 462 | puts( test_string() ); 463 | puts( test_letter_case() ); 464 | puts( test_server( false ) ); 465 | end 466 | end 467 | 468 | # -- STATEMENTS 469 | 470 | test = Test.new( "Hello", "World" ); 471 | test.run(); 472 | 473 | # ~~ 474 | 475 | point \ 476 | = Point.new( 477 | "point", 478 | Position.new( 1.0, 2.0, 3.0 ), 479 | Color::BLUE 480 | ); 481 | 482 | puts( 483 | point.@position.x, 484 | point.@position.y, 485 | point.@position.z, 486 | Person.minimum_age, 487 | Person.maximum_age 488 | ); 489 | 490 | # ~~ 491 | 492 | person_array = Array( Person ).new(); 493 | person_array.push( Person.new( "Red", 15, Color::RED ) ); 494 | person_array.push( Person.new( "Green", 35, Color::GREEN ) ); 495 | person_array.push( Person.new( "Blue", 75, Color::BLUE ) ); 496 | 497 | # ~~ 498 | 499 | server = HTTP::Server.new \ 500 | do | context | 501 | request = context.request; 502 | 503 | response = context.response; 504 | response.headers[ "Server" ] = "Crystal"; 505 | response.headers[ "Date" ] = HTTP.format_time( Time.now ); 506 | response.headers[ "Content-Type" ] = "text/html; charset=UTF-8"; 507 | response.status_code = 200; 508 | 509 | case ( request.path ) 510 | when "/" 511 | ECR.embed "test.ecr", response 512 | when "/get" 513 | response.print( "

#{request.path}

" ); 514 | request.query_params.each \ 515 | do | name, value | 516 | response.print( "

#{name} : #{value}

" ); 517 | end 518 | when "/post" 519 | response.print( "

#{request.path}

" ); 520 | request_body = request.body; 521 | 522 | if ( request_body ) 523 | HTTP::Params.parse( request_body.gets_to_end ).each \ 524 | do | name, value | 525 | response.print( "

#{name} : #{value}

" ); 526 | end 527 | end 528 | when "/time" 529 | response.print( "

The time is #{Time.now}

" ); 530 | else 531 | response.print( "

Oops...

#{request.path}

" ); 532 | response.status_code = 404; 533 | end 534 | 535 | response.print( "

Back

" ); 536 | end 537 | 538 | puts( "Listening on http://127.0.0.1:8080" ); 539 | 540 | server.listen( "127.0.0.1", 8080, reuse_port: true ) 541 | end 542 | -------------------------------------------------------------------------------- /TEST/CR/test.cr: -------------------------------------------------------------------------------- 1 | # -- IMPORTS 2 | 3 | require "ecr" 4 | require "http/server"; 5 | 6 | # -- MODULES 7 | 8 | module Test 9 | 10 | # -- TYPES 11 | 12 | abstract struct Abstract 13 | 14 | end 15 | 16 | # ~~ 17 | 18 | struct Position 19 | 20 | # -- ATTRIBUTES 21 | 22 | protected property \ 23 | x : Float64, 24 | y : Float64, 25 | z : Float64; 26 | class_property \ 27 | zero = Position.new( 0.0, 0.0, 0.0 ); 28 | 29 | # -- CONSTRUCTORS 30 | 31 | def initialize( 32 | @x, 33 | @y, 34 | @z 35 | ) : Void 36 | 37 | end 38 | 39 | # -- INQUIRIES 40 | 41 | def is_zero( 42 | ) : Bool 43 | 44 | return 45 | x == @@zero.x \ 46 | && y == @@zero.y \ 47 | && z == @@zero.z; 48 | end 49 | end 50 | 51 | # ~~ 52 | 53 | enum Color 54 | 55 | # -- CONSTANTS 56 | 57 | RED 58 | GREEN 59 | BLUE 60 | 61 | # -- INQUIRIES 62 | 63 | def is_red?( 64 | ) : Bool 65 | 66 | return self == RED; 67 | end 68 | end 69 | 70 | # ~~ 71 | 72 | struct Point 73 | 74 | # -- CONSTRUCTORS 75 | 76 | def initialize( 77 | @name : String, 78 | @position : Position, 79 | @color : Color 80 | ) : Void 81 | 82 | end 83 | 84 | # -- INQUIRIES 85 | 86 | def is_blue( 87 | ) : Bool 88 | 89 | return @color == Color::BLUE; 90 | end 91 | end 92 | 93 | # ~~ 94 | 95 | struct Person 96 | 97 | # -- ATTRIBUTES 98 | 99 | property \ 100 | name : String, 101 | age : Int32, 102 | color : Color; 103 | class_property \ 104 | minimum_age : Int32 = 25, 105 | maximum_age : Int32 = 70; 106 | 107 | # -- CONSTRUCTORS 108 | 109 | def initialize( 110 | @name, 111 | @age, 112 | @color 113 | ) : Void 114 | 115 | if ( @age < @@minimum_age ) 116 | 117 | puts( "Studying" ); 118 | 119 | elsif ( @age >= @@minimum_age \ 120 | && @age < @@maximum_age ) 121 | 122 | puts( "Working" ); 123 | 124 | else 125 | 126 | puts( "Retreated" ); 127 | end 128 | end 129 | 130 | # -- INQUIRIES 131 | 132 | def is_green?( 133 | ) : Bool 134 | 135 | return color == Color::GREEN; 136 | end 137 | 138 | # -- OPERATIONS 139 | 140 | protected def print( 141 | ) : Void 142 | 143 | puts( "#{age} - #{name}" ); 144 | end 145 | end 146 | 147 | # ~~ 148 | 149 | class Test 150 | 151 | # -- CONSTRUCTORS 152 | 153 | def initialize( 154 | @hello : String, 155 | @world : String 156 | ) : Void 157 | 158 | end 159 | 160 | # -- OPERATIONS 161 | 162 | def test_comment( 163 | count : Int32 164 | ) : Int32 165 | 166 | #**************** 167 | # This is 168 | # a single-line 169 | # comment. 170 | #**************** 171 | # This is a single-line comment. 172 | # This is 173 | # 174 | # a multi-line 175 | # 176 | # comment. 177 | # 178 | # This is 179 | # 180 | # a multi-line 181 | # 182 | # comment. 183 | # 184 | # This is 185 | # 186 | # a multi-line 187 | # 188 | # comment. 189 | # This is 190 | # 191 | #a multi-line 192 | # 193 | #comment. 194 | # This 195 | # 196 | # is 197 | # 198 | #a multi-line 199 | # 200 | # comment. 201 | # This is 202 | # 203 | # a multi-line 204 | # 205 | # comment. 206 | 207 | if ( count <= 1 ) # This is a comment. 208 | 209 | return 10; # This is a comment. 210 | 211 | else 212 | 213 | return 20; # This is a comment. 214 | end 215 | end 216 | 217 | # ~~ 218 | 219 | def test_if( 220 | count : Int32 221 | ) : Int32 222 | 223 | if ( count <= 1 ) 224 | 225 | return 10; 226 | end 227 | 228 | if ( count <= 1 ) 229 | 230 | return 10; 231 | 232 | else 233 | 234 | return 20; 235 | end 236 | 237 | if ( count <= 1 ) 238 | 239 | return 10; 240 | 241 | elsif ( count <= 2 ) 242 | 243 | return 20; 244 | 245 | elsif ( count <= 3 \ 246 | && count != 1 \ 247 | && count != 2 ) 248 | 249 | return 30; 250 | 251 | else 252 | 253 | return 40; 254 | end 255 | 256 | if ( count >= 1 \ 257 | && count * 2 \ 258 | < count * 3 - 5 ) 259 | 260 | count \ 261 | += test_unless( 262 | count * 3 - 5 \ 263 | - count * 2 264 | ); 265 | end 266 | end 267 | 268 | # ~~ 269 | 270 | def test_unless( 271 | count : Int32 272 | ) : Int32 273 | 274 | unless ( count > 1 ) 275 | 276 | return 10; 277 | end 278 | 279 | unless ( count > 1 ) 280 | 281 | return 10; 282 | 283 | else 284 | 285 | return 20; 286 | end 287 | end 288 | 289 | # ~~ 290 | 291 | def test_while( 292 | count : Int32 293 | ) : Int32 294 | 295 | index = 0; 296 | 297 | while ( index < count ) 298 | 299 | index = index + 1; 300 | end 301 | 302 | return index; 303 | end 304 | 305 | # ~~ 306 | 307 | def test_until( 308 | count : Int32 309 | ) : Int32 310 | 311 | index = 0; 312 | 313 | until ( index >= count ) 314 | 315 | index = index + 1; 316 | end 317 | 318 | return index; 319 | end 320 | 321 | # ~~ 322 | 323 | def test_case( 324 | count : Int32 325 | ) : Int32 326 | 327 | case ( count ) 328 | 329 | when 1 330 | 331 | return 10; 332 | 333 | end 334 | 335 | case ( count ) 336 | 337 | when 1 338 | 339 | return 10; 340 | 341 | when 2 342 | 343 | return 20; 344 | 345 | end 346 | 347 | case ( count ) 348 | 349 | when 1 350 | 351 | return 10; 352 | 353 | when 2 354 | 355 | return 20; 356 | 357 | else 358 | 359 | return 30; 360 | 361 | end 362 | end 363 | 364 | # ~~ 365 | 366 | def test_begin( 367 | ) : Int32 368 | 369 | begin 370 | 371 | result = 10; 372 | 373 | rescue 374 | 375 | result = 20; 376 | 377 | else 378 | 379 | result = 30; 380 | 381 | ensure 382 | 383 | result = 40; 384 | end 385 | end 386 | 387 | # ~~ 388 | 389 | def test_rescue( 390 | ) : Int32 391 | 392 | result = 10; 393 | 394 | rescue 395 | 396 | result = 20; 397 | 398 | else 399 | 400 | result = 30; 401 | 402 | ensure 403 | 404 | result = 40; 405 | end 406 | 407 | # ~~ 408 | 409 | def test_each( 410 | ) : Bool 411 | 412 | "0123456789".each_char \ 413 | do | character | 414 | 415 | print( character ); 416 | end 417 | 418 | print( '\n' ); 419 | 420 | [ 421 | { 1, "A" }, 422 | { 2, "B" } 423 | ].each \ 424 | do | key, value | 425 | 426 | puts( "#{key} : #{value}" ); 427 | end 428 | 429 | return true; 430 | end 431 | 432 | # ~~ 433 | 434 | def test_type( 435 | ) : Bool 436 | 437 | data = Array( NamedTuple( id: Int32, name: String ) ).new(); 438 | data.push( { id: 1, name: "Toto" } ); 439 | data.push( { id: 2, name: "Tutu" } ); 440 | data.push( { id: 3, name: "Tata" } ); 441 | data.push( { id: 4, name: "Titi" } ); 442 | 443 | puts( data ); 444 | 445 | return true; 446 | end 447 | 448 | # ~~ 449 | 450 | def test_character( 451 | ) : Bool 452 | 453 | puts( '\'' ); 454 | puts( '\\' ); 455 | puts( '\u0041' ); 456 | puts( '\u{41}' ); 457 | puts( 'a' ); 458 | puts( 'あ' ); 459 | 460 | return true; 461 | end 462 | 463 | # ~~ 464 | 465 | def test_string( 466 | ) : Bool 467 | 468 | puts( "Test #{@hello + " Test #{@hello} #{@world} Test " + @world} Test" ); 469 | puts( %(Test #{@hello + %( Test #{@hello} #{@world} Test ) + @world} Test) ); 470 | puts( %[Test #{@hello + %[ Test #{@hello} #{@world} Test ] + @world} Test] ); 471 | puts( %{Test #{@hello + %{ Test #{@hello} #{@world} Test } + @world} Test} ); 472 | puts( % + @world} Test> ); 473 | puts( %|Test #{@hello + %| Test #{@hello} #{@world} Test | + @world} Test| ); 474 | puts( %(Test #{@hello + %[ Test #{@hello} #{@world} Test ] + @world} Test) ); 475 | puts( %Q(Test #{@hello + %Q( Test #{@hello} #{@world} Test ) + @world} Test) ); 476 | puts( %Q[Test #{@hello + %Q[ Test #{@hello} #{@world} Test ] + @world} Test] ); 477 | puts( %Q{Test #{@hello + %Q{ Test #{@hello} #{@world} Test } + @world} Test} ); 478 | puts( %Q + @world} Test> ); 479 | puts( %Q|Test #{@hello + %Q| Test #{@hello} #{@world} Test | + @world} Test| ); 480 | puts( %Q(Test #{@hello + %Q[ Test #{@hello} #{@world} Test ] + @world} Test) ); 481 | 482 | puts( "Test \#{@Hello + \" Test \#{@Hello} \#{@World} Test \" + @World} Test" ); 483 | puts( %q(Test #{@Hello + %q( Test #{@Hello} #{@World} Test ) + @World} Test) ); 484 | puts( %q[Test #{@Hello + %q[ Test #{@Hello} #{@World} Test ] + @World} Test] ); 485 | puts( %q{Test #{@Hello + %q{ Test #{@Hello} #{@World} Test } + @World} Test} ); 486 | puts( %q + @World} Test> ); 487 | puts( %q(Test #{@Hello + %q[ Test #{@Hello} #{@World} Test ] + @World} Test) ); 488 | 489 | [ "", " ", "x", "x x", " Hello World ! " ].each \ 490 | do | old_text | 491 | 492 | part_array = old_text.split( ' ' ); 493 | new_text = part_array.join( ' ' ); 494 | puts( "'#{old_text}' => #{part_array} => '#{new_text}'" ); 495 | end 496 | 497 | return true; 498 | end 499 | 500 | # ~~ 501 | 502 | def test_letter_case( 503 | ) : Bool 504 | 505 | # snake_case PascalCase UPPER_CASE 506 | # snake_case PascalCase UPPER_CASE 507 | # snake_case PascalCase UPPER_CASE 508 | # // \ $snake_case #snake_case UINT32 UInt32 509 | 510 | return true; 511 | end 512 | 513 | # ~~ 514 | 515 | def test_server( 516 | server_is_run 517 | ) : Bool 518 | 519 | if ( server_is_run ) 520 | 521 | server = HTTP::Server.new \ 522 | do | context | 523 | 524 | context.response.content_type = "text/plain"; 525 | context.response.print( "Hello world! The time is #{Time.now}" ); 526 | end 527 | 528 | address = server.bind_tcp( 8080 ); 529 | puts( "Listening on http://#{address}" ); 530 | server.listen(); 531 | end 532 | 533 | return true; 534 | end 535 | 536 | # ~~ 537 | 538 | def run( 539 | ) : Void 540 | 541 | puts( test_comment( 1 ) ); 542 | puts( test_if( 1 ) ); 543 | puts( test_unless( 1 ) ); 544 | puts( test_while( 10 ) ); 545 | puts( test_until( 10 ) ); 546 | puts( test_case( 1 ) ); 547 | puts( test_begin() ); 548 | puts( test_rescue() ); 549 | puts( test_each() ); 550 | puts( test_type() ); 551 | puts( test_character() ); 552 | puts( test_string() ); 553 | puts( test_letter_case() ); 554 | puts( test_server( false ) ); 555 | end 556 | end 557 | 558 | # -- STATEMENTS 559 | 560 | test = Test.new( "Hello", "World" ); 561 | test.run(); 562 | 563 | # ~~ 564 | 565 | point \ 566 | = Point.new( 567 | "point", 568 | Position.new( 1.0, 2.0, 3.0 ), 569 | Color::BLUE 570 | ); 571 | 572 | puts( 573 | point.@position.x, 574 | point.@position.y, 575 | point.@position.z, 576 | Person.minimum_age, 577 | Person.maximum_age 578 | ); 579 | 580 | # ~~ 581 | 582 | person_array = Array( Person ).new(); 583 | person_array.push( Person.new( "Red", 15, Color::RED ) ); 584 | person_array.push( Person.new( "Green", 35, Color::GREEN ) ); 585 | person_array.push( Person.new( "Blue", 75, Color::BLUE ) ); 586 | 587 | # ~~ 588 | 589 | server = HTTP::Server.new \ 590 | do | context | 591 | 592 | request = context.request; 593 | 594 | response = context.response; 595 | response.headers[ "Server" ] = "Crystal"; 596 | response.headers[ "Date" ] = HTTP.format_time( Time.now ); 597 | response.headers[ "Content-Type" ] = "text/html; charset=UTF-8"; 598 | response.status_code = 200; 599 | 600 | case ( request.path ) 601 | 602 | when "/" 603 | 604 | ECR.embed "test.ecr", response 605 | 606 | when "/get" 607 | 608 | response.print( "

#{request.path}

" ); 609 | request.query_params.each \ 610 | do | name, value | 611 | 612 | response.print( "

#{name} : #{value}

" ); 613 | end 614 | 615 | when "/post" 616 | 617 | response.print( "

#{request.path}

" ); 618 | request_body = request.body; 619 | 620 | if ( request_body ) 621 | 622 | HTTP::Params.parse( request_body.gets_to_end ).each \ 623 | do | name, value | 624 | 625 | response.print( "

#{name} : #{value}

" ); 626 | end 627 | end 628 | 629 | when "/time" 630 | 631 | response.print( "

The time is #{Time.now}

" ); 632 | 633 | else 634 | 635 | response.print( "

Oops...

#{request.path}

" ); 636 | response.status_code = 404; 637 | 638 | end 639 | 640 | response.print( "

Back

" ); 641 | end 642 | 643 | puts( "Listening on http://127.0.0.1:8080" ); 644 | 645 | server.listen( "127.0.0.1", 8080, reuse_port: true ) 646 | end 647 | -------------------------------------------------------------------------------- /TEST/CB/test.cb: -------------------------------------------------------------------------------- 1 | // -- IMPORTS 2 | 3 | require "ecr" 4 | require "http/server"; 5 | 6 | // -- MODULES 7 | 8 | module TEST 9 | { 10 | // -- TYPES 11 | 12 | abstract struct ABSTRACT 13 | { 14 | } 15 | 16 | // ~~ 17 | 18 | struct POSITION 19 | { 20 | // -- ATTRIBUTES 21 | 22 | protected property 23 | X : FLOAT64, 24 | Y : FLOAT64, 25 | Z : FLOAT64; 26 | class_property 27 | Zero = POSITION.New( 0.0, 0.0, 0.0 ); 28 | 29 | // -- CONSTRUCTORS 30 | 31 | def Initialize( 32 | @X, 33 | @Y, 34 | @Z 35 | ) : VOID 36 | { 37 | } 38 | 39 | // -- INQUIRIES 40 | 41 | def IsZero( 42 | ) : BOOL 43 | { 44 | return 45 | X == $Zero.X 46 | && Y == $Zero.Y 47 | && Z == $Zero.Z; 48 | } 49 | } 50 | 51 | // ~~ 52 | 53 | enum COLOR 54 | { 55 | // -- CONSTANTS 56 | 57 | #Red 58 | #Green 59 | #Blue 60 | 61 | // -- INQUIRIES 62 | 63 | def IsRed?( 64 | ) : BOOL 65 | { 66 | return self == #Red; 67 | } 68 | } 69 | 70 | // ~~ 71 | 72 | struct POINT 73 | { 74 | // -- CONSTRUCTORS 75 | 76 | def Initialize( 77 | @Name : STRING, 78 | @Position : POSITION, 79 | @Color : COLOR 80 | ) : VOID 81 | { 82 | } 83 | 84 | // -- INQUIRIES 85 | 86 | def IsBlue( 87 | ) : BOOL 88 | { 89 | return @Color == COLOR::#Blue; 90 | } 91 | } 92 | 93 | // ~~ 94 | 95 | struct PERSON 96 | { 97 | // -- ATTRIBUTES 98 | 99 | property 100 | Name : STRING, 101 | Age : INT32, 102 | Color : COLOR; 103 | class_property 104 | MinimumAge : INT32 = 25, 105 | MaximumAge : INT32 = 70; 106 | 107 | // -- CONSTRUCTORS 108 | 109 | def Initialize( 110 | @Name, 111 | @Age, 112 | @Color 113 | ) : VOID 114 | { 115 | if ( @Age < $MinimumAge ) 116 | { 117 | Puts( "Studying" ); 118 | } 119 | elsif ( @Age >= $MinimumAge 120 | && @Age < $MaximumAge ) 121 | { 122 | Puts( "Working" ); 123 | } 124 | else 125 | { 126 | Puts( "Retreated" ); 127 | } 128 | } 129 | 130 | // -- INQUIRIES 131 | 132 | def IsGreen?( 133 | ) : BOOL 134 | { 135 | return Color == COLOR::#Green; 136 | } 137 | 138 | // -- OPERATIONS 139 | 140 | protected def Print( 141 | ) : VOID 142 | { 143 | Puts( "#{age} - #{name}" ); 144 | } 145 | } 146 | 147 | // ~~ 148 | 149 | class TEST 150 | { 151 | // -- CONSTRUCTORS 152 | 153 | def Initialize( 154 | @Hello : STRING, 155 | @World : STRING 156 | ) : VOID 157 | { 158 | } 159 | 160 | // -- OPERATIONS 161 | 162 | def TestComment( 163 | count : INT32 164 | ) : INT32 165 | { 166 | //**************** 167 | // This is 168 | // a single-line 169 | // comment. 170 | //**************** 171 | /* This is a single-line comment. */ 172 | /* This is 173 | 174 | a multi-line 175 | 176 | comment. */ 177 | /* 178 | This is 179 | 180 | a multi-line 181 | 182 | comment. 183 | */ 184 | /* This is 185 | 186 | a multi-line 187 | 188 | comment. */ 189 | /* This is 190 | 191 | a multi-line 192 | 193 | comment. */ 194 | /* This 195 | 196 | is 197 | 198 | a multi-line 199 | 200 | comment. */ 201 | /* This is 202 | 203 | a multi-line 204 | 205 | comment. */ 206 | 207 | if ( count <= 1 ) // This is a comment. 208 | { 209 | return 10; // This is a comment. 210 | } 211 | else 212 | { 213 | return 20; // This is a comment. 214 | } 215 | } 216 | 217 | // ~~ 218 | 219 | def TestIf( 220 | count : INT32 221 | ) : INT32 222 | { 223 | if ( count <= 1 ) 224 | { 225 | return 10; 226 | } 227 | 228 | if ( count <= 1 ) 229 | { 230 | return 10; 231 | } 232 | else 233 | { 234 | return 20; 235 | } 236 | 237 | if ( count <= 1 ) 238 | { 239 | return 10; 240 | } 241 | elsif ( count <= 2 ) 242 | { 243 | return 20; 244 | } 245 | elsif ( count <= 3 246 | && count != 1 247 | && count != 2 ) 248 | { 249 | return 30; 250 | } 251 | else 252 | { 253 | return 40; 254 | } 255 | 256 | if ( count >= 1 257 | && count * 2 258 | < count * 3 - 5 ) 259 | { 260 | count 261 | += TestUnless( 262 | count * 3 - 5 263 | - count * 2 264 | ); 265 | } 266 | } 267 | 268 | // ~~ 269 | 270 | def TestUnless( 271 | count : INT32 272 | ) : INT32 273 | { 274 | unless ( count > 1 ) 275 | { 276 | return 10; 277 | } 278 | 279 | unless ( count > 1 ) 280 | { 281 | return 10; 282 | } 283 | else 284 | { 285 | return 20; 286 | } 287 | } 288 | 289 | // ~~ 290 | 291 | def TestWhile( 292 | count : INT32 293 | ) : INT32 294 | { 295 | index = 0; 296 | 297 | while ( index < count ) 298 | { 299 | index = index + 1; 300 | } 301 | 302 | return index; 303 | } 304 | 305 | // ~~ 306 | 307 | def TestUntil( 308 | count : INT32 309 | ) : INT32 310 | { 311 | index = 0; 312 | 313 | until ( index >= count ) 314 | { 315 | index = index + 1; 316 | } 317 | 318 | return index; 319 | } 320 | 321 | // ~~ 322 | 323 | def TestCase( 324 | count : INT32 325 | ) : INT32 326 | { 327 | case ( count ) 328 | { 329 | when 1 330 | { 331 | return 10; 332 | } 333 | } 334 | 335 | case ( count ) 336 | { 337 | when 1 338 | { 339 | return 10; 340 | } 341 | when 2 342 | { 343 | return 20; 344 | } 345 | } 346 | 347 | case ( count ) 348 | { 349 | when 1 350 | { 351 | return 10; 352 | } 353 | when 2 354 | { 355 | return 20; 356 | } 357 | else 358 | { 359 | return 30; 360 | } 361 | } 362 | } 363 | 364 | // ~~ 365 | 366 | def TestBegin( 367 | ) : INT32 368 | { 369 | begin 370 | { 371 | result = 10; 372 | } 373 | rescue 374 | { 375 | result = 20; 376 | } 377 | else 378 | { 379 | result = 30; 380 | } 381 | ensure 382 | { 383 | result = 40; 384 | } 385 | } 386 | 387 | // ~~ 388 | 389 | def TestRescue( 390 | ) : INT32 391 | { 392 | result = 10; 393 | } 394 | rescue 395 | { 396 | result = 20; 397 | } 398 | else 399 | { 400 | result = 30; 401 | } 402 | ensure 403 | { 404 | result = 40; 405 | } 406 | 407 | // ~~ 408 | 409 | def TestEach( 410 | ) : BOOL 411 | { 412 | "0123456789".EachChar 413 | do | character | 414 | { 415 | Print( character ); 416 | } 417 | 418 | Print( '\n' ); 419 | 420 | [ 421 | { 1, "A" }, 422 | { 2, "B" } 423 | ].Each 424 | do | key, value | 425 | { 426 | Puts( "#{key} : #{value}" ); 427 | } 428 | 429 | return true; 430 | } 431 | 432 | // ~~ 433 | 434 | def TestType( 435 | ) : BOOL 436 | { 437 | data = ARRAY( NAMED_TUPLE( Id: INT32, Name: STRING ) ).New(); 438 | data.Push( { Id: 1, Name: "Toto" } ); 439 | data.Push( { Id: 2, Name: "Tutu" } ); 440 | data.Push( { Id: 3, Name: "Tata" } ); 441 | data.Push( { Id: 4, Name: "Titi" } ); 442 | 443 | Puts( data ); 444 | 445 | return true; 446 | } 447 | 448 | // ~~ 449 | 450 | def TestCharacter( 451 | ) : BOOL 452 | { 453 | Puts( '\'' ); 454 | Puts( '\\' ); 455 | Puts( '\u0041' ); 456 | Puts( '\u{41}' ); 457 | Puts( 'a' ); 458 | Puts( 'あ' ); 459 | 460 | return true; 461 | } 462 | 463 | // ~~ 464 | 465 | def TestString( 466 | ) : BOOL 467 | { 468 | Puts( "Test #{@Hello + " Test #{@Hello} #{@World} Test " + @World} Test" ); 469 | Puts( %(Test #{@Hello + %( Test #{@Hello} #{@World} Test ) + @World} Test) ); 470 | Puts( %[Test #{@Hello + %[ Test #{@Hello} #{@World} Test ] + @World} Test] ); 471 | Puts( %{Test #{@Hello + %{ Test #{@Hello} #{@World} Test } + @World} Test} ); 472 | Puts( % + @World} Test> ); 473 | Puts( %|Test #{@Hello + %| Test #{@Hello} #{@World} Test | + @World} Test| ); 474 | Puts( %(Test #{@Hello + %[ Test #{@Hello} #{@World} Test ] + @World} Test) ); 475 | Puts( %Q(Test #{@Hello + %Q( Test #{@Hello} #{@World} Test ) + @World} Test) ); 476 | Puts( %Q[Test #{@Hello + %Q[ Test #{@Hello} #{@World} Test ] + @World} Test] ); 477 | Puts( %Q{Test #{@Hello + %Q{ Test #{@Hello} #{@World} Test } + @World} Test} ); 478 | Puts( %Q + @World} Test> ); 479 | Puts( %Q|Test #{@Hello + %Q| Test #{@Hello} #{@World} Test | + @World} Test| ); 480 | Puts( %Q(Test #{@Hello + %Q[ Test #{@Hello} #{@World} Test ] + @World} Test) ); 481 | 482 | Puts( "Test \#{@Hello + \" Test \#{@Hello} \#{@World} Test \" + @World} Test" ); 483 | Puts( %q(Test #{@Hello + %q( Test #{@Hello} #{@World} Test ) + @World} Test) ); 484 | Puts( %q[Test #{@Hello + %q[ Test #{@Hello} #{@World} Test ] + @World} Test] ); 485 | Puts( %q{Test #{@Hello + %q{ Test #{@Hello} #{@World} Test } + @World} Test} ); 486 | Puts( %q + @World} Test> ); 487 | Puts( %q(Test #{@Hello + %q[ Test #{@Hello} #{@World} Test ] + @World} Test) ); 488 | 489 | [ "", " ", "x", "x x", " Hello World ! " ].Each 490 | do | old_text | 491 | { 492 | part_array = old_text.Split( ' ' ); 493 | new_text = part_array.Join( ' ' ); 494 | Puts( "'#{old_text}' => #{part_array} => '#{new_text}'" ); 495 | } 496 | 497 | return true; 498 | } 499 | 500 | // ~~ 501 | 502 | def TestLetterCase( 503 | ) : BOOL 504 | { 505 | # \snake_case \PascalCase \UPPER_CASE 506 | # SnakeCase PASCAL_CASE \UPPER_CASE 507 | # snake_case #pascal_case #UpperCase 508 | # \// \\ \$SnakeCase \#SnakeCase \UINT32 UINT32 509 | 510 | return true; 511 | } 512 | 513 | // ~~ 514 | 515 | def TestServer( 516 | server_is_run 517 | ) : BOOL 518 | { 519 | if ( server_is_run ) 520 | { 521 | server = HTTP::SERVER.New 522 | do | context | 523 | { 524 | context.Response.ContentType = "text/plain"; 525 | context.Response.Print( "Hello world! The time is #{TIME.Now}" ); 526 | } 527 | 528 | address = server.BindTcp( 8080 ); 529 | Puts( "Listening on http://#{address}" ); 530 | server.Listen(); 531 | } 532 | 533 | return true; 534 | } 535 | 536 | // ~~ 537 | 538 | def Run( 539 | ) : VOID 540 | { 541 | Puts( TestComment( 1 ) ); 542 | Puts( TestIf( 1 ) ); 543 | Puts( TestUnless( 1 ) ); 544 | Puts( TestWhile( 10 ) ); 545 | Puts( TestUntil( 10 ) ); 546 | Puts( TestCase( 1 ) ); 547 | Puts( TestBegin() ); 548 | Puts( TestRescue() ); 549 | Puts( TestEach() ); 550 | Puts( TestType() ); 551 | Puts( TestCharacter() ); 552 | Puts( TestString() ); 553 | Puts( TestLetterCase() ); 554 | Puts( TestServer( false ) ); 555 | } 556 | } 557 | 558 | // -- STATEMENTS 559 | 560 | test = TEST.New( "Hello", "World" ); 561 | test.Run(); 562 | 563 | // ~~ 564 | 565 | point 566 | = POINT.New( 567 | "point", 568 | POSITION.New( 1.0, 2.0, 3.0 ), 569 | COLOR::#Blue 570 | ); 571 | 572 | Puts( 573 | point.@Position.X, 574 | point.@Position.Y, 575 | point.@Position.Z, 576 | PERSON.MinimumAge, 577 | PERSON.MaximumAge 578 | ); 579 | 580 | // ~~ 581 | 582 | person_array = ARRAY( PERSON ).New(); 583 | person_array.Push( PERSON.New( "Red", 15, COLOR::#Red ) ); 584 | person_array.Push( PERSON.New( "Green", 35, COLOR::#Green ) ); 585 | person_array.Push( PERSON.New( "Blue", 75, COLOR::#Blue ) ); 586 | 587 | // ~~ 588 | 589 | server = HTTP::SERVER.New 590 | do | context | 591 | { 592 | request = context.Request; 593 | 594 | response = context.Response; 595 | response.Headers[ "Server" ] = "Crystal"; 596 | response.Headers[ "Date" ] = HTTP.FormatTime( TIME.Now ); 597 | response.Headers[ "Content-Type" ] = "text/html; charset=UTF-8"; 598 | response.StatusCode = 200; 599 | 600 | case ( request.Path ) 601 | { 602 | when "/" 603 | { 604 | ECR.Embed "test.ecr", response 605 | } 606 | when "/get" 607 | { 608 | response.Print( "

#{request.Path}

" ); 609 | request.QueryParams.Each 610 | do | name, value | 611 | { 612 | response.Print( "

#{name} : #{value}

" ); 613 | } 614 | } 615 | when "/post" 616 | { 617 | response.Print( "

#{request.Path}

" ); 618 | request_body = request.Body; 619 | 620 | if ( request_body ) 621 | { 622 | HTTP::PARAMS.Parse( request_body.GetsToEnd ).Each 623 | do | name, value | 624 | { 625 | response.Print( "

#{name} : #{value}

" ); 626 | } 627 | } 628 | } 629 | when "/time" 630 | { 631 | response.Print( "

The time is #{TIME.Now}

" ); 632 | } 633 | else 634 | { 635 | response.Print( "

Oops...

#{request.Path}

" ); 636 | response.StatusCode = 404; 637 | } 638 | } 639 | 640 | response.Print( "

Back

" ); 641 | } 642 | 643 | Puts( "Listening on http://127.0.0.1:8080" ); 644 | 645 | server.Listen( "127.0.0.1", 8080, reuse_port: true ) 646 | } 647 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/blog_data.sql: -------------------------------------------------------------------------------- 1 | replace into `BLOG`.`SECTION` 2 | ( 3 | `Id`, `Number`, `Name`, `Text`, `Image` 4 | ) 5 | values 6 | ( 7 | "1", 8 | "524", 9 | "Varia", 10 | "Rolled from outer darkness groping blindly but better know how dull oblivion's depths, loaded the pangs of hawk or yasodhara entered on tiptoe poised, boast of whitest ivory or deer is life. Giving light and merchantmen from clearest and rescue found, hand ascend nirvana's sacred caste and calmly took a mountain snows. Wreathing in years the cliffs framed in fresh as venice used to cure, sent trembling shadows gather fast as children pointed out those troubled thoughts profound complete. Home his praise an outer form is tender thought to stone wheels by one, made a feeble snowy white scarlet yellow robe.", 11 | "faremiwo.jpg" 12 | ); 13 | 14 | replace into `BLOG`.`SECTION` 15 | ( 16 | `Id`, `Number`, `Name`, `Text`, `Image` 17 | ) 18 | values 19 | ( 20 | "2", 21 | "31", 22 | "Vella", 23 | "Gently rising from sin works of ebony with sweet expression of simple wants supplied. Like flowers of many more shall we brahmans turn to palsied age, clapping her bosom took their celestial light were sent, gliding from distant plain a dream might give or my mother's task. Shall live the shore to steal not herself cast off a savage denizens, stood aside to womanhood but many distant joy filled a glance. This belt of cruelty and bring unbidden tears of ages fades out by thibet's marshy lakes, 'mid clouds obscure the half transparent mists the child she moved the unseen unheard jests.", 24 | "colucklu.png" 25 | ); 26 | 27 | replace into `BLOG`.`SECTION` 28 | ( 29 | `Id`, `Number`, `Name`, `Text`, `Image` 30 | ) 31 | values 32 | ( 33 | "3", 34 | "172", 35 | "Bonnar", 36 | "Fasted and welcome to old believed religion but undying love in widening circles wide open stood. Her young and trumpets mingle with grapes and lost, cold spot sweet spot where my latest breath bewailing others' wants required. Prostrate people cries of lust taste human frailty known, checkered with other darker side he starts from anger envy hate.", 37 | "ivcedmiw.gif" 38 | ); 39 | 40 | replace into `BLOG`.`SECTION` 41 | ( 42 | `Id`, `Number`, `Name`, `Text`, `Image` 43 | ) 44 | values 45 | ( 46 | "4", 47 | "54", 48 | "Tihanyi", 49 | "Bidding her youthful folly seeks those weaker than life, distributing her brows were lost in subtle alchemist. Sent him in sleep may blow away but living truth, tinges with kings have no bitter words describe, slave to sorrow were laid aside with closely shaven head. You cramp the procession issues forth their guides, saluting him down his mountain loving people still and fearful storm tossed sailor on himalaya's chain, pass along their fickle forms of faces looking down where all manly grace that silent grave.", 50 | "weinumpy.jpg" 51 | ); 52 | 53 | replace into `BLOG`.`SECTION` 54 | ( 55 | `Id`, `Number`, `Name`, `Text`, `Image` 56 | ) 57 | values 58 | ( 59 | "5", 60 | "134", 61 | "Walford", 62 | "Leopards with grinning skeletons at play clinch close shut out. Blacker than spring all sheep with head close to blow. Attending one will scorn the open blinded dazzled eyes upon its parts the heart whole, father in subtle creeds are never seeks repose. Increasing as victors came upon cyclopean columns vast expanse.", 63 | "badaheXu.gif" 64 | ); 65 | 66 | replace into `BLOG`.`USER` 67 | ( 68 | `Id`, `Email`, `Pseudonym`, `Password`, `IsAdministrator` 69 | ) 70 | values 71 | ( 72 | "1", 73 | "bonnie.telecom@live.com", 74 | "bonnietelecom", 75 | "1ew-abP", 76 | "1" 77 | ); 78 | 79 | replace into `BLOG`.`USER` 80 | ( 81 | `Id`, `Email`, `Pseudonym`, `Password`, `IsAdministrator` 82 | ) 83 | values 84 | ( 85 | "2", 86 | "jennilee.scheffler@outlook.com", 87 | "jennileescheffler", 88 | "C7ar?ipQ", 89 | "0" 90 | ); 91 | 92 | replace into `BLOG`.`USER` 93 | ( 94 | `Id`, `Email`, `Pseudonym`, `Password`, `IsAdministrator` 95 | ) 96 | values 97 | ( 98 | "3", 99 | "charlot.hatz@live.com", 100 | "charlothatz", 101 | "Be8a#rmadi", 102 | "0" 103 | ); 104 | 105 | replace into `BLOG`.`USER` 106 | ( 107 | `Id`, `Email`, `Pseudonym`, `Password`, `IsAdministrator` 108 | ) 109 | values 110 | ( 111 | "4", 112 | "zorina.relations@yahoo.com", 113 | "zorinarelations", 114 | "8iel@lMoj", 115 | "1" 116 | ); 117 | 118 | replace into `BLOG`.`USER` 119 | ( 120 | `Id`, `Email`, `Pseudonym`, `Password`, `IsAdministrator` 121 | ) 122 | values 123 | ( 124 | "5", 125 | "loree.dutt@live.com", 126 | "loreedutt", 127 | "o-wsyB0", 128 | "0" 129 | ); 130 | 131 | replace into `BLOG`.`ARTICLE` 132 | ( 133 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 134 | ) 135 | values 136 | ( 137 | "1", 138 | "3", 139 | "1", 140 | "His flowing robes of kindness given.", 141 | "Calling to teach all meet the lagging hours, foursquare and east west and ocean's waves of terrors there. Childhood returned eager gazers at peace hail prince become the fruitful soil, better world where no good for its mother's task. Peak beyond this rishi is gained timour draw water given to some cherub smile. Ten days he sought deliverance from land is love was left.", 142 | "effagaDo.gif", 143 | "2009-12-09" 144 | ); 145 | 146 | replace into `BLOG`.`ARTICLE` 147 | ( 148 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 149 | ) 150 | values 151 | ( 152 | "2", 153 | "3", 154 | "3", 155 | "Enter that in social life.", 156 | "Ready champ their northern jargon calmed its life to ocean's swelling sails. One arm grown filthy rags and here stately new quick as ocean's hidden mine. Delights of toil and bald and silvery light, fills every haunt that dance in egypt's tombs. Oceans of jungle of god the shouts from head that speak of caste is heard, 'the veil that supremest moment white elephants came his petty griefs oppressed and bare. Labors of power from rajagriha backward rolled his well performed, beneath whose outer gates and drivers' cries of age brilliant bloom to rescue found.", 157 | "Wingkisy.jpg", 158 | "2007-02-26" 159 | ); 160 | 161 | replace into `BLOG`.`ARTICLE` 162 | ( 163 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 164 | ) 165 | values 166 | ( 167 | "3", 168 | "5", 169 | "2", 170 | "Though my maya sleeping babe.", 171 | "Adorned by older and she was gone out with sacred banks were woven thick set aflame, glittered with tender love for in spotless wool. Stood aside with sudras for as i know no prowling beasts of guards, their matins chanted their followers sought his fixed ecstatic gaze. Gathered about this ancient seed had sunk in dainty fare, seen in speed whose silken garments of messengers to nirvana's sacred wood.", 172 | "ubipasau.jpg", 173 | "2012-05-10" 174 | ); 175 | 176 | replace into `BLOG`.`ARTICLE` 177 | ( 178 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 179 | ) 180 | values 181 | ( 182 | "4", 183 | "1", 184 | "4", 185 | "Sweep our strength and calmly said.", 186 | "Channa seemed the autumn with rage and die, cut a sunless depths within changes that hence should one thing of duties done, still she climbs the starless night whose stern command. Returning good evil thoughts have a heavenly rest. Bade me as brahma's boundless and prostrate they should such worlds unseen.", 187 | "rewobbiq.gif", 188 | "2004-05-07" 189 | ); 190 | 191 | replace into `BLOG`.`ARTICLE` 192 | ( 193 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 194 | ) 195 | values 196 | ( 197 | "5", 198 | "3", 199 | "1", 200 | "Bodies clothed in stories often watched.", 201 | "Gladly take your country fair yasodhara who late a crown, enwrapt the many more northern nests by thibet's marshy lakes. Shrouded the hand unseen yet in yon shining by inner eye. Reveals the flag his pallid cheek blending of eternal love so he on blind and speed, trouble enough the mirror of elephants and friends who late appeared. Displaying lights the night from good seed time only purified.", 202 | "Aurelono.png", 203 | "2014-10-04" 204 | ); 205 | 206 | replace into `BLOG`.`ARTICLE` 207 | ( 208 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 209 | ) 210 | values 211 | ( 212 | "6", 213 | "4", 214 | "3", 215 | "Kasyapa full rounded perfect day.", 216 | "Combined endurance beauty he seemed dark despair they soon it come then gently said, send warnings to womanhood but roused from sight, wishing no mourners gather round gained timour a greater gifts an age brilliant sky and up. Living prophecy of death shall bring nirvana's heights, checkered with cities gardens through wide open blinded by six meeting past. Warmed his blinded eyes are cleansed who stay and arms in ages kept and eye. Fanned by six troubled dream she soon a priest before his wakened soul that late appeared. Up the lagging hours know a different way, rolling pastures spread his flowing robes benares maid.", 217 | "urnekosa.jpg", 218 | "2003-03-23" 219 | ); 220 | 221 | replace into `BLOG`.`ARTICLE` 222 | ( 223 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 224 | ) 225 | values 226 | ( 227 | "7", 228 | "2", 229 | "5", 230 | "Profoundly learned in contemplation fills every step.", 231 | "Distributing her tears but living souls at home, you great destiny so often in persian tunics clad trees with light. Planted in humble home stretch soon his sad for love illumined truth, gasping for light my home of nature's every kind. Driving away those hands had spent his reins the drone of saving men, calm and moved along this twilight of flowers dance on slender graceful columns raised to all. Breathed forth their vital part souls of daily food as in healthful flow, darts the charioteers in view the flames each dank cold lips the tartar steppes. Fed many blossoms blended odors fill with tender ties and cast without its dregs, performs the feeblest limbs may toss that very face as victors came.", 232 | "ettearih.jpg", 233 | "2015-03-04" 234 | ); 235 | 236 | replace into `BLOG`.`ARTICLE` 237 | ( 238 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 239 | ) 240 | values 241 | ( 242 | "8", 243 | "4", 244 | "3", 245 | "Ah poor sudras to eye.", 246 | "True forms compact and master have me stirs to buy the valleys and plain they start, wreathing in balanced scale heaven than mortal brush could tempt the snow capped peaks. Whom god made the prince eagerly to go teach them his son is richly spread. Wreathing in two laughing innocence to live in fresh soil, praying lifted up and kissed and bowl and who could pierce. Teaching the cares of more is vain unless it flies.", 247 | "issitkoj.jpg", 248 | "2015-03-19" 249 | ); 250 | 251 | replace into `BLOG`.`ARTICLE` 252 | ( 253 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 254 | ) 255 | values 256 | ( 257 | "9", 258 | "1", 259 | "3", 260 | "Joined with calm with themselves.", 261 | "Hoping that throne were laid to sink in light, weary way is cast upon his daily duties well nigh spent. Doubtless in despair they scale the coldest heart, having one bright mansions of snow by countless funeral rites had filled a home with gods, writhing victim die renowned a peepul tree for his aids with joy. Whose tendrils round this twilight of themselves in doubt was all fled amazed nor drank, fables old and here that sows by gently laid him place for righteousness and coarse thoughts. Shall dare not master their lives to pour some seeming youth prematurely old age, wishing no thought glide round of wonder and world below the surging angry stern command. Has entered his hair imprisoned sunlight fill the crested wave.", 262 | "ralermaf.gif", 263 | "2003-07-11" 264 | ); 265 | 266 | replace into `BLOG`.`ARTICLE` 267 | ( 268 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 269 | ) 270 | values 271 | ( 272 | "10", 273 | "4", 274 | "5", 275 | "Scoff not given him low.", 276 | "Yoked to part exact no dreams starting him speculations fables and genial glow, fair women and sea of love is richly spread. Clothed with one strong oxen drawn by autumn's winds may take. What in grace and thought glide smoothly on, teaching the ferryman the charioteers more may fall athwart their long in houses rich tyrian silk. Waved into brighter glow each inmost life from death's door to repeat.", 277 | "ilkonnop.png", 278 | "2004-06-04" 279 | ); 280 | 281 | replace into `BLOG`.`ARTICLE` 282 | ( 283 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 284 | ) 285 | values 286 | ( 287 | "11", 288 | "1", 289 | "2", 290 | "Whom the cold spot on as dead.", 291 | "Dreamed that sad for aid instruct and armed with sinking sun, sword players keeping many words he who asked their matins chanted hymn. Unconscious that passed again they beckon me from door the vulture peak a faithless hollow truce, gently laid upon this sorrow birth to foes assailed on tiptoe poised. Distant mountain goat to spare what visions overwhelmed, breathed from those ever knew so roams the dews and woof. Help protector lost when brahma god made all aglow with joy succeeding palsied limb, men have do not your brother's guide to look to boy he reaches them.", 292 | "vilaulaq.png", 293 | "2015-03-28" 294 | ); 295 | 296 | replace into `BLOG`.`ARTICLE` 297 | ( 298 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 299 | ) 300 | values 301 | ( 302 | "12", 303 | "5", 304 | "3", 305 | "Channa seemed full complete.", 306 | "Wondering said sweet as clean and perfect and sweetest cup with winged dragons fly, weaving with gracious king in channels through groves with eager souls from heaven than mortal round, shoots up toward every caste is living with lines of roses breathed their own. Fixed intently at once dedicate to foes assailed on kantaka some are clean, pure and fragrant golden age brilliant but to quiet nook. Pause not discouraged still he reached that ocean sounds of pain or yasodhara, he swept away but only guard the city's myriads of hissing flames. Kapilavastu's king so strong hand that the cudgel and sweetly sang, weeping world if you calling the deadly work begun was gone and frail.", 307 | "macatihy.jpg", 308 | "2002-04-07" 309 | ); 310 | 311 | replace into `BLOG`.`ARTICLE` 312 | ( 313 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 314 | ) 315 | values 316 | ( 317 | "13", 318 | "2", 319 | "1", 320 | "Hail great banks of prey.", 321 | "Delights of their self chained and blooming youth manhood rich, infants impaled before the love clearer to small grain of chasing wealth and cut. Built by rains had borne by hoary age too deep musing on every tongue, dispels the garden's cooling cup with diminished band in vain. Ruling than incense mingled with dappled fawn bound him round about his trembling world, pause not master not discouraged still lingering shadows gather fast as at each coming guest, free and then sunk as my son return beseech you and highest bliss for her. Take your rude plowman casts on through unfrequented streets. Rode forth and stroked his mission ceased to wallow in words.", 322 | "renuskeu.png", 323 | "2000-06-19" 324 | ); 325 | 326 | replace into `BLOG`.`ARTICLE` 327 | ( 328 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 329 | ) 330 | values 331 | ( 332 | "14", 333 | "1", 334 | "4", 335 | "Nostrils distended fleet gazelle.", 336 | "Guided by five strangers from benares daily life, age o hear great will and watching for here these musings sad, sunset and mind of innocence of her youthful blood run the trumpet's sound through vacant place. Performs the eye checked them as with shaded drives him burst of iron fly, faster flew to giddy whirl them is reached his presence all divine. Trapusha one cried in health nor solemn music shed, cut down took a single blow his pile neither lack of saving men.", 337 | "olkigheu.gif", 338 | "2001-05-28" 339 | ); 340 | 341 | replace into `BLOG`.`ARTICLE` 342 | ( 343 | `Id`, `SectionId`, `UserId`, `Title`, `Text`, `Image`, `Date` 344 | ) 345 | values 346 | ( 347 | "15", 348 | "2", 349 | "2", 350 | "Suspended on wave on either side.", 351 | "They bade the fittest time in stillest night's most royal scepter bore yasodhara, drunk by roots it hastens on rubbish heaps, do whate'er the narrow path our sins from light were opened and gayest plumes. Night whose high bred lust and fields his clumsy loom, groping world and my inmost soul loosed from tender kiss not so. Do not bodies made them joyful news the earth.", 352 | "riebapra.jpg", 353 | "2011-05-04" 354 | ); 355 | 356 | replace into `BLOG`.`COMMENT` 357 | ( 358 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 359 | ) 360 | values 361 | ( 362 | "1", 363 | "12", 364 | "1", 365 | "Bathed in youthful folly seeks, driving away with sharp pain, itself a sight the maddening bowl.", 366 | "2010-12-05 09:42:50" 367 | ); 368 | 369 | replace into `BLOG`.`COMMENT` 370 | ( 371 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 372 | ) 373 | values 374 | ( 375 | "2", 376 | "10", 377 | "5", 378 | "By skillful needles deftly wrought, tune not your thoughts profound and prince. Dash forth his furrowed cheeks.", 379 | "2009-10-03 02:18:11" 380 | ); 381 | 382 | replace into `BLOG`.`COMMENT` 383 | ( 384 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 385 | ) 386 | values 387 | ( 388 | "3", 389 | "13", 390 | "3", 391 | "Descending talk with labored steps, none staying him place and free. Shaded drives him across the heavens, watering its great city for rahula lay.", 392 | "2010-04-10 04:04:32" 393 | ); 394 | 395 | replace into `BLOG`.`COMMENT` 396 | ( 397 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 398 | ) 399 | values 400 | ( 401 | "4", 402 | "7", 403 | "4", 404 | "Busy haunts of delight in the well, chandalas clothed as fire or better world. Nirvana's sun sink to rock.", 405 | "2007-04-26 20:00:25" 406 | ); 407 | 408 | replace into `BLOG`.`COMMENT` 409 | ( 410 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 411 | ) 412 | values 413 | ( 414 | "5", 415 | "12", 416 | "1", 417 | "Thorns no troubled sea had dwelt, well trained hunters mark to tree.", 418 | "2005-09-02 20:29:02" 419 | ); 420 | 421 | replace into `BLOG`.`COMMENT` 422 | ( 423 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 424 | ) 425 | values 426 | ( 427 | "6", 428 | "9", 429 | "3", 430 | "Do him pause not nor drank. Gazing with their powers above.", 431 | "2013-12-23 02:48:30" 432 | ); 433 | 434 | replace into `BLOG`.`COMMENT` 435 | ( 436 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 437 | ) 438 | values 439 | ( 440 | "7", 441 | "12", 442 | "5", 443 | "So on through buddha's bowl, securely wrapped in blood chilled. Begging bowl filled her little silver streams, humanity to wander through a shrine.", 444 | "2001-05-09 07:34:36" 445 | ); 446 | 447 | replace into `BLOG`.`COMMENT` 448 | ( 449 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 450 | ) 451 | values 452 | ( 453 | "8", 454 | "12", 455 | "4", 456 | "Even from ever done are fierce, passed the heir to hate. Doing reverence for food met his, again in grace of age.", 457 | "2006-07-22 23:57:36" 458 | ); 459 | 460 | replace into `BLOG`.`COMMENT` 461 | ( 462 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 463 | ) 464 | values 465 | ( 466 | "9", 467 | "10", 468 | "4", 469 | "Sprang to escape his own, rolling thunders cease to playmates he pray. Home returned now alone a nation's law.", 470 | "2004-06-10 20:35:58" 471 | ); 472 | 473 | replace into `BLOG`.`COMMENT` 474 | ( 475 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 476 | ) 477 | values 478 | ( 479 | "10", 480 | "14", 481 | "3", 482 | "Up in his tempters fled, through nirvana's blissful heights and depths. Loose reined and those blissful heights. Forgetting now direct your gold to trees.", 483 | "2012-12-19 05:24:08" 484 | ); 485 | 486 | replace into `BLOG`.`COMMENT` 487 | ( 488 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 489 | ) 490 | values 491 | ( 492 | "11", 493 | "7", 494 | "3", 495 | "Refreshed is purified from heaven. Foursquare and blinded dazzled eyes shall last, enraptured raphael ne'er by passing breeze. Thought some climbed clinging to pass.", 496 | "2002-08-12 20:03:13" 497 | ); 498 | 499 | replace into `BLOG`.`COMMENT` 500 | ( 501 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 502 | ) 503 | values 504 | ( 505 | "12", 506 | "15", 507 | "4", 508 | "Thorns and all external pomp, born another's slave when trees that stood.", 509 | "2001-12-06 10:02:16" 510 | ); 511 | 512 | replace into `BLOG`.`COMMENT` 513 | ( 514 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 515 | ) 516 | values 517 | ( 518 | "13", 519 | "1", 520 | "2", 521 | "'who ever grew on power, enticing men have seen these prophecies.", 522 | "2000-11-09 05:41:18" 523 | ); 524 | 525 | replace into `BLOG`.`COMMENT` 526 | ( 527 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 528 | ) 529 | values 530 | ( 531 | "14", 532 | "5", 533 | "2", 534 | "Welcome and how selfishness would hide, gazing intently at guard the fires below. Gentle answers with gladness heard forgot. Soul breathed from trees festooned with eagerness.", 535 | "2012-08-28 07:00:37" 536 | ); 537 | 538 | replace into `BLOG`.`COMMENT` 539 | ( 540 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 541 | ) 542 | values 543 | ( 544 | "15", 545 | "2", 546 | "3", 547 | "Calling each had brushed their worshipers, sinks to change their galling chains.", 548 | "2013-11-05 08:52:31" 549 | ); 550 | 551 | replace into `BLOG`.`COMMENT` 552 | ( 553 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 554 | ) 555 | values 556 | ( 557 | "16", 558 | "5", 559 | "3", 560 | "Birds burst in life's sole to cross. Even mingle with growing band, do such giving is soft cashmere wool, nanda my kind heart and pine.", 561 | "2015-03-05 13:42:19" 562 | ); 563 | 564 | replace into `BLOG`.`COMMENT` 565 | ( 566 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 567 | ) 568 | values 569 | ( 570 | "17", 571 | "10", 572 | "1", 573 | "Might yet ever changing light. Sparkling dew from phalgu's vale.", 574 | "2003-05-28 10:32:53" 575 | ); 576 | 577 | replace into `BLOG`.`COMMENT` 578 | ( 579 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 580 | ) 581 | values 582 | ( 583 | "18", 584 | "4", 585 | "5", 586 | "Rode mounted on its vital part, arriving home and greed had faded mild. Even a channel through crowded streets.", 587 | "2007-10-16 06:02:18" 588 | ); 589 | 590 | replace into `BLOG`.`COMMENT` 591 | ( 592 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 593 | ) 594 | values 595 | ( 596 | "19", 597 | "9", 598 | "2", 599 | "Startled him tremble quiver with dazzling light, perennial from brahma dwells the powers above. Best were woven into night.", 600 | "2007-01-02 11:27:44" 601 | ); 602 | 603 | replace into `BLOG`.`COMMENT` 604 | ( 605 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 606 | ) 607 | values 608 | ( 609 | "20", 610 | "13", 611 | "5", 612 | "Frail haggard palsied leaning on kantaka, kiss not feel its brow. Instant flew to active consciousness, fear did fiercely bound him round.", 613 | "2012-02-11 17:10:23" 614 | ); 615 | 616 | replace into `BLOG`.`COMMENT` 617 | ( 618 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 619 | ) 620 | values 621 | ( 622 | "21", 623 | "14", 624 | "4", 625 | "O bring the deadly swoon. Aiding his lisping childlike past.", 626 | "2008-07-27 17:35:44" 627 | ); 628 | 629 | replace into `BLOG`.`COMMENT` 630 | ( 631 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 632 | ) 633 | values 634 | ( 635 | "22", 636 | "3", 637 | "1", 638 | "Inspiring every thought to my fathers came. Disturb the chariot and lofty prophecies.", 639 | "2000-05-13 04:14:16" 640 | ); 641 | 642 | replace into `BLOG`.`COMMENT` 643 | ( 644 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 645 | ) 646 | values 647 | ( 648 | "23", 649 | "11", 650 | "4", 651 | "Smoothing life's duties end the man, proud teachers sports dyspeptic preachers hear. Morning found friends a screen their track, I've heard the outer gate.", 652 | "2015-09-03 01:53:11" 653 | ); 654 | 655 | replace into `BLOG`.`COMMENT` 656 | ( 657 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 658 | ) 659 | values 660 | ( 661 | "24", 662 | "9", 663 | "2", 664 | "Cinctures to many caravans or finest silk, clothed instead breathed away and men.", 665 | "2014-01-18 15:01:59" 666 | ); 667 | 668 | replace into `BLOG`.`COMMENT` 669 | ( 670 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 671 | ) 672 | values 673 | ( 674 | "25", 675 | "1", 676 | "4", 677 | "Rolled his last swan left his gates, vile as those sacred robes. Saw not to hear this ancient times, accompanied by likening it for words.", 678 | "2001-05-08 10:49:47" 679 | ); 680 | 681 | replace into `BLOG`.`COMMENT` 682 | ( 683 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 684 | ) 685 | values 686 | ( 687 | "26", 688 | "6", 689 | "5", 690 | "Fitter for more he made his side, up my very joy succeeding grief, why leave to care come the stream. Until but brave watchful heart would kill.", 691 | "2006-11-09 17:29:31" 692 | ); 693 | 694 | replace into `BLOG`.`COMMENT` 695 | ( 696 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 697 | ) 698 | values 699 | ( 700 | "27", 701 | "14", 702 | "3", 703 | "Strangely in that last returns, shrinks from earthly stain the crackling thorns.", 704 | "2006-07-01 08:43:48" 705 | ); 706 | 707 | replace into `BLOG`.`COMMENT` 708 | ( 709 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 710 | ) 711 | values 712 | ( 713 | "28", 714 | "12", 715 | "3", 716 | "Saluted in kindness filled his earnestness replied. Begging bowls held the maidens stole away.", 717 | "2011-09-09 12:45:47" 718 | ); 719 | 720 | replace into `BLOG`.`COMMENT` 721 | ( 722 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 723 | ) 724 | values 725 | ( 726 | "29", 727 | "5", 728 | "3", 729 | "Do not o precious stones, followed him playing and snaps in air. Grows while heaven's gate it with his. Profoundly learned to joyful spring.", 730 | "2010-08-17 18:02:15" 731 | ); 732 | 733 | replace into `BLOG`.`COMMENT` 734 | ( 735 | `Id`, `ArticleId`, `UserId`, `Text`, `DateTime` 736 | ) 737 | values 738 | ( 739 | "30", 740 | "9", 741 | "3", 742 | "Pause not for his brother's path, they did through folly's devious ways, adorned by self but searched out. Be still kind expression of shades.", 743 | "2012-06-04 17:29:45" 744 | ); 745 | 746 | replace into `BLOG`.`SUBSCRIBER` 747 | ( 748 | `Id`, `Email` 749 | ) 750 | values 751 | ( 752 | "1", 753 | "aaren.munsey@gmail.com" 754 | ); 755 | 756 | replace into `BLOG`.`SUBSCRIBER` 757 | ( 758 | `Id`, `Email` 759 | ) 760 | values 761 | ( 762 | "2", 763 | "ediva.strudwick@hotmail.com" 764 | ); 765 | 766 | replace into `BLOG`.`SUBSCRIBER` 767 | ( 768 | `Id`, `Email` 769 | ) 770 | values 771 | ( 772 | "3", 773 | "hynek.diener@hotmail.com" 774 | ); 775 | 776 | replace into `BLOG`.`SUBSCRIBER` 777 | ( 778 | `Id`, `Email` 779 | ) 780 | values 781 | ( 782 | "4", 783 | "orelia.genet@gmail.com" 784 | ); 785 | 786 | replace into `BLOG`.`SUBSCRIBER` 787 | ( 788 | `Id`, `Email` 789 | ) 790 | values 791 | ( 792 | "5", 793 | "khanh.mccaw@mail.com" 794 | ); 795 | 796 | -------------------------------------------------------------------------------- /SAMPLE/BLOG/SQL/blog.txt: -------------------------------------------------------------------------------- 1 | +--------------------+ 2 | | Database | 3 | +--------------------+ 4 | | information_schema | 5 | | BLOG | 6 | | mysql | 7 | | performance_schema | 8 | | sys | 9 | +--------------------+ 10 | +----------------+ 11 | | Tables_in_BLOG | 12 | +----------------+ 13 | | ARTICLE | 14 | | COMMENT | 15 | | SECTION | 16 | | SUBSCRIBER | 17 | | USER | 18 | +----------------+ 19 | +---------+ 20 | | | 21 | +---------+ 22 | | ARTICLE | 23 | +---------+ 24 | +-----------+-------------+------+-----+---------+----------------+ 25 | | Field | Type | Null | Key | Default | Extra | 26 | +-----------+-------------+------+-----+---------+----------------+ 27 | | Id | int(11) | NO | PRI | NULL | auto_increment | 28 | | SectionId | int(11) | YES | MUL | NULL | | 29 | | UserId | int(11) | YES | MUL | NULL | | 30 | | Title | text | YES | | NULL | | 31 | | Text | text | YES | | NULL | | 32 | | Image | varchar(45) | YES | | NULL | | 33 | | Date | date | YES | | NULL | | 34 | +-----------+-------------+------+-----+---------+----------------+ 35 | +----+-----------+--------+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+------------+ 36 | | Id | SectionId | UserId | Title | Text | Image | Date | 37 | +----+-----------+--------+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+------------+ 38 | | 1 | 3 | 1 | His flowing robes of kindness given. | Calling to teach all meet the lagging hours, foursquare and east west and ocean's waves of terrors there. Childhood returned eager gazers at peace hail prince become the fruitful soil, better world where no good for its mother's task. Peak beyond this rishi is gained timour draw water given to some cherub smile. Ten days he sought deliverance from land is love was left. | effagaDo.gif | 2009-12-09 | 39 | | 2 | 3 | 3 | Enter that in social life. | Ready champ their northern jargon calmed its life to ocean's swelling sails. One arm grown filthy rags and here stately new quick as ocean's hidden mine. Delights of toil and bald and silvery light, fills every haunt that dance in egypt's tombs. Oceans of jungle of god the shouts from head that speak of caste is heard, 'the veil that supremest moment white elephants came his petty griefs oppressed and bare. Labors of power from rajagriha backward rolled his well performed, beneath whose outer gates and drivers' cries of age brilliant bloom to rescue found. | Wingkisy.jpg | 2007-02-26 | 40 | | 3 | 5 | 2 | Though my maya sleeping babe. | Adorned by older and she was gone out with sacred banks were woven thick set aflame, glittered with tender love for in spotless wool. Stood aside with sudras for as i know no prowling beasts of guards, their matins chanted their followers sought his fixed ecstatic gaze. Gathered about this ancient seed had sunk in dainty fare, seen in speed whose silken garments of messengers to nirvana's sacred wood. | ubipasau.jpg | 2012-05-10 | 41 | | 4 | 1 | 4 | Sweep our strength and calmly said. | Channa seemed the autumn with rage and die, cut a sunless depths within changes that hence should one thing of duties done, still she climbs the starless night whose stern command. Returning good evil thoughts have a heavenly rest. Bade me as brahma's boundless and prostrate they should such worlds unseen. | rewobbiq.gif | 2004-05-07 | 42 | | 5 | 3 | 1 | Bodies clothed in stories often watched. | Gladly take your country fair yasodhara who late a crown, enwrapt the many more northern nests by thibet's marshy lakes. Shrouded the hand unseen yet in yon shining by inner eye. Reveals the flag his pallid cheek blending of eternal love so he on blind and speed, trouble enough the mirror of elephants and friends who late appeared. Displaying lights the night from good seed time only purified. | Aurelono.png | 2014-10-04 | 43 | | 6 | 4 | 3 | Kasyapa full rounded perfect day. | Combined endurance beauty he seemed dark despair they soon it come then gently said, send warnings to womanhood but roused from sight, wishing no mourners gather round gained timour a greater gifts an age brilliant sky and up. Living prophecy of death shall bring nirvana's heights, checkered with cities gardens through wide open blinded by six meeting past. Warmed his blinded eyes are cleansed who stay and arms in ages kept and eye. Fanned by six troubled dream she soon a priest before his wakened soul that late appeared. Up the lagging hours know a different way, rolling pastures spread his flowing robes benares maid. | urnekosa.jpg | 2003-03-23 | 44 | | 7 | 2 | 5 | Profoundly learned in contemplation fills every step. | Distributing her tears but living souls at home, you great destiny so often in persian tunics clad trees with light. Planted in humble home stretch soon his sad for love illumined truth, gasping for light my home of nature's every kind. Driving away those hands had spent his reins the drone of saving men, calm and moved along this twilight of flowers dance on slender graceful columns raised to all. Breathed forth their vital part souls of daily food as in healthful flow, darts the charioteers in view the flames each dank cold lips the tartar steppes. Fed many blossoms blended odors fill with tender ties and cast without its dregs, performs the feeblest limbs may toss that very face as victors came. | ettearih.jpg | 2015-03-04 | 45 | | 8 | 4 | 3 | Ah poor sudras to eye. | True forms compact and master have me stirs to buy the valleys and plain they start, wreathing in balanced scale heaven than mortal brush could tempt the snow capped peaks. Whom god made the prince eagerly to go teach them his son is richly spread. Wreathing in two laughing innocence to live in fresh soil, praying lifted up and kissed and bowl and who could pierce. Teaching the cares of more is vain unless it flies. | issitkoj.jpg | 2015-03-19 | 46 | | 9 | 1 | 3 | Joined with calm with themselves. | Hoping that throne were laid to sink in light, weary way is cast upon his daily duties well nigh spent. Doubtless in despair they scale the coldest heart, having one bright mansions of snow by countless funeral rites had filled a home with gods, writhing victim die renowned a peepul tree for his aids with joy. Whose tendrils round this twilight of themselves in doubt was all fled amazed nor drank, fables old and here that sows by gently laid him place for righteousness and coarse thoughts. Shall dare not master their lives to pour some seeming youth prematurely old age, wishing no thought glide round of wonder and world below the surging angry stern command. Has entered his hair imprisoned sunlight fill the crested wave. | ralermaf.gif | 2003-07-11 | 47 | | 10 | 4 | 5 | Scoff not given him low. | Yoked to part exact no dreams starting him speculations fables and genial glow, fair women and sea of love is richly spread. Clothed with one strong oxen drawn by autumn's winds may take. What in grace and thought glide smoothly on, teaching the ferryman the charioteers more may fall athwart their long in houses rich tyrian silk. Waved into brighter glow each inmost life from death's door to repeat. | ilkonnop.png | 2004-06-04 | 48 | | 11 | 1 | 2 | Whom the cold spot on as dead. | Dreamed that sad for aid instruct and armed with sinking sun, sword players keeping many words he who asked their matins chanted hymn. Unconscious that passed again they beckon me from door the vulture peak a faithless hollow truce, gently laid upon this sorrow birth to foes assailed on tiptoe poised. Distant mountain goat to spare what visions overwhelmed, breathed from those ever knew so roams the dews and woof. Help protector lost when brahma god made all aglow with joy succeeding palsied limb, men have do not your brother's guide to look to boy he reaches them. | vilaulaq.png | 2015-03-28 | 49 | | 12 | 5 | 3 | Channa seemed full complete. | Wondering said sweet as clean and perfect and sweetest cup with winged dragons fly, weaving with gracious king in channels through groves with eager souls from heaven than mortal round, shoots up toward every caste is living with lines of roses breathed their own. Fixed intently at once dedicate to foes assailed on kantaka some are clean, pure and fragrant golden age brilliant but to quiet nook. Pause not discouraged still he reached that ocean sounds of pain or yasodhara, he swept away but only guard the city's myriads of hissing flames. Kapilavastu's king so strong hand that the cudgel and sweetly sang, weeping world if you calling the deadly work begun was gone and frail. | macatihy.jpg | 2002-04-07 | 50 | | 13 | 2 | 1 | Hail great banks of prey. | Delights of their self chained and blooming youth manhood rich, infants impaled before the love clearer to small grain of chasing wealth and cut. Built by rains had borne by hoary age too deep musing on every tongue, dispels the garden's cooling cup with diminished band in vain. Ruling than incense mingled with dappled fawn bound him round about his trembling world, pause not master not discouraged still lingering shadows gather fast as at each coming guest, free and then sunk as my son return beseech you and highest bliss for her. Take your rude plowman casts on through unfrequented streets. Rode forth and stroked his mission ceased to wallow in words. | renuskeu.png | 2000-06-19 | 51 | | 14 | 1 | 4 | Nostrils distended fleet gazelle. | Guided by five strangers from benares daily life, age o hear great will and watching for here these musings sad, sunset and mind of innocence of her youthful blood run the trumpet's sound through vacant place. Performs the eye checked them as with shaded drives him burst of iron fly, faster flew to giddy whirl them is reached his presence all divine. Trapusha one cried in health nor solemn music shed, cut down took a single blow his pile neither lack of saving men. | olkigheu.gif | 2001-05-28 | 52 | | 15 | 2 | 2 | Suspended on wave on either side. | They bade the fittest time in stillest night's most royal scepter bore yasodhara, drunk by roots it hastens on rubbish heaps, do whate'er the narrow path our sins from light were opened and gayest plumes. Night whose high bred lust and fields his clumsy loom, groping world and my inmost soul loosed from tender kiss not so. Do not bodies made them joyful news the earth. | riebapra.jpg | 2011-05-04 | 53 | +----+-----------+--------+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+------------+ 54 | +---------+ 55 | | | 56 | +---------+ 57 | | COMMENT | 58 | +---------+ 59 | +-----------+----------+------+-----+---------+----------------+ 60 | | Field | Type | Null | Key | Default | Extra | 61 | +-----------+----------+------+-----+---------+----------------+ 62 | | Id | int(11) | NO | PRI | NULL | auto_increment | 63 | | ArticleId | int(11) | YES | MUL | NULL | | 64 | | UserId | int(11) | YES | MUL | NULL | | 65 | | Text | text | YES | | NULL | | 66 | | DateTime | datetime | YES | | NULL | | 67 | +-----------+----------+------+-----+---------+----------------+ 68 | +----+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+ 69 | | Id | ArticleId | UserId | Text | DateTime | 70 | +----+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+ 71 | | 1 | 12 | 1 | Bathed in youthful folly seeks, driving away with sharp pain, itself a sight the maddening bowl. | 2010-12-05 09:42:50 | 72 | | 2 | 10 | 5 | By skillful needles deftly wrought, tune not your thoughts profound and prince. Dash forth his furrowed cheeks. | 2009-10-03 02:18:11 | 73 | | 3 | 13 | 3 | Descending talk with labored steps, none staying him place and free. Shaded drives him across the heavens, watering its great city for rahula lay. | 2010-04-10 04:04:32 | 74 | | 4 | 7 | 4 | Busy haunts of delight in the well, chandalas clothed as fire or better world. Nirvana's sun sink to rock. | 2007-04-26 20:00:25 | 75 | | 5 | 12 | 1 | Thorns no troubled sea had dwelt, well trained hunters mark to tree. | 2005-09-02 20:29:02 | 76 | | 6 | 9 | 3 | Do him pause not nor drank. Gazing with their powers above. | 2013-12-23 02:48:30 | 77 | | 7 | 12 | 5 | So on through buddha's bowl, securely wrapped in blood chilled. Begging bowl filled her little silver streams, humanity to wander through a shrine. | 2001-05-09 07:34:36 | 78 | | 8 | 12 | 4 | Even from ever done are fierce, passed the heir to hate. Doing reverence for food met his, again in grace of age. | 2006-07-22 23:57:36 | 79 | | 9 | 10 | 4 | Sprang to escape his own, rolling thunders cease to playmates he pray. Home returned now alone a nation's law. | 2004-06-10 20:35:58 | 80 | | 10 | 14 | 3 | Up in his tempters fled, through nirvana's blissful heights and depths. Loose reined and those blissful heights. Forgetting now direct your gold to trees. | 2012-12-19 05:24:08 | 81 | | 11 | 7 | 3 | Refreshed is purified from heaven. Foursquare and blinded dazzled eyes shall last, enraptured raphael ne'er by passing breeze. Thought some climbed clinging to pass. | 2002-08-12 20:03:13 | 82 | | 12 | 15 | 4 | Thorns and all external pomp, born another's slave when trees that stood. | 2001-12-06 10:02:16 | 83 | | 13 | 1 | 2 | 'who ever grew on power, enticing men have seen these prophecies. | 2000-11-09 05:41:18 | 84 | | 14 | 5 | 2 | Welcome and how selfishness would hide, gazing intently at guard the fires below. Gentle answers with gladness heard forgot. Soul breathed from trees festooned with eagerness. | 2012-08-28 07:00:37 | 85 | | 15 | 2 | 3 | Calling each had brushed their worshipers, sinks to change their galling chains. | 2013-11-05 08:52:31 | 86 | | 16 | 5 | 3 | Birds burst in life's sole to cross. Even mingle with growing band, do such giving is soft cashmere wool, nanda my kind heart and pine. | 2015-03-05 13:42:19 | 87 | | 17 | 10 | 1 | Might yet ever changing light. Sparkling dew from phalgu's vale. | 2003-05-28 10:32:53 | 88 | | 18 | 4 | 5 | Rode mounted on its vital part, arriving home and greed had faded mild. Even a channel through crowded streets. | 2007-10-16 06:02:18 | 89 | | 19 | 9 | 2 | Startled him tremble quiver with dazzling light, perennial from brahma dwells the powers above. Best were woven into night. | 2007-01-02 11:27:44 | 90 | | 20 | 13 | 5 | Frail haggard palsied leaning on kantaka, kiss not feel its brow. Instant flew to active consciousness, fear did fiercely bound him round. | 2012-02-11 17:10:23 | 91 | | 21 | 14 | 4 | O bring the deadly swoon. Aiding his lisping childlike past. | 2008-07-27 17:35:44 | 92 | | 22 | 3 | 1 | Inspiring every thought to my fathers came. Disturb the chariot and lofty prophecies. | 2000-05-13 04:14:16 | 93 | | 23 | 11 | 4 | Smoothing life's duties end the man, proud teachers sports dyspeptic preachers hear. Morning found friends a screen their track, I've heard the outer gate. | 2015-09-03 01:53:11 | 94 | | 24 | 9 | 2 | Cinctures to many caravans or finest silk, clothed instead breathed away and men. | 2014-01-18 15:01:59 | 95 | | 25 | 1 | 4 | Rolled his last swan left his gates, vile as those sacred robes. Saw not to hear this ancient times, accompanied by likening it for words. | 2001-05-08 10:49:47 | 96 | | 26 | 6 | 5 | Fitter for more he made his side, up my very joy succeeding grief, why leave to care come the stream. Until but brave watchful heart would kill. | 2006-11-09 17:29:31 | 97 | | 27 | 14 | 3 | Strangely in that last returns, shrinks from earthly stain the crackling thorns. | 2006-07-01 08:43:48 | 98 | | 28 | 12 | 3 | Saluted in kindness filled his earnestness replied. Begging bowls held the maidens stole away. | 2011-09-09 12:45:47 | 99 | | 29 | 5 | 3 | Do not o precious stones, followed him playing and snaps in air. Grows while heaven's gate it with his. Profoundly learned to joyful spring. | 2010-08-17 18:02:15 | 100 | | 30 | 9 | 3 | Pause not for his brother's path, they did through folly's devious ways, adorned by self but searched out. Be still kind expression of shades. | 2012-06-04 17:29:45 | 101 | +----+-----------+--------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+ 102 | +---------+ 103 | | | 104 | +---------+ 105 | | SECTION | 106 | +---------+ 107 | +--------+------------------+------+-----+---------+----------------+ 108 | | Field | Type | Null | Key | Default | Extra | 109 | +--------+------------------+------+-----+---------+----------------+ 110 | | Id | int(11) | NO | PRI | NULL | auto_increment | 111 | | Number | int(10) unsigned | YES | | NULL | | 112 | | Name | varchar(45) | YES | | NULL | | 113 | | Text | text | YES | | NULL | | 114 | | Image | varchar(45) | YES | | NULL | | 115 | +--------+------------------+------+-----+---------+----------------+ 116 | +----+--------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ 117 | | Id | Number | Name | Text | Image | 118 | +----+--------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ 119 | | 1 | 524 | Varia | Rolled from outer darkness groping blindly but better know how dull oblivion's depths, loaded the pangs of hawk or yasodhara entered on tiptoe poised, boast of whitest ivory or deer is life. Giving light and merchantmen from clearest and rescue found, hand ascend nirvana's sacred caste and calmly took a mountain snows. Wreathing in years the cliffs framed in fresh as venice used to cure, sent trembling shadows gather fast as children pointed out those troubled thoughts profound complete. Home his praise an outer form is tender thought to stone wheels by one, made a feeble snowy white scarlet yellow robe. | faremiwo.jpg | 120 | | 2 | 31 | Vella | Gently rising from sin works of ebony with sweet expression of simple wants supplied. Like flowers of many more shall we brahmans turn to palsied age, clapping her bosom took their celestial light were sent, gliding from distant plain a dream might give or my mother's task. Shall live the shore to steal not herself cast off a savage denizens, stood aside to womanhood but many distant joy filled a glance. This belt of cruelty and bring unbidden tears of ages fades out by thibet's marshy lakes, 'mid clouds obscure the half transparent mists the child she moved the unseen unheard jests. | colucklu.png | 121 | | 3 | 172 | Bonnar | Fasted and welcome to old believed religion but undying love in widening circles wide open stood. Her young and trumpets mingle with grapes and lost, cold spot sweet spot where my latest breath bewailing others' wants required. Prostrate people cries of lust taste human frailty known, checkered with other darker side he starts from anger envy hate. | ivcedmiw.gif | 122 | | 4 | 54 | Tihanyi | Bidding her youthful folly seeks those weaker than life, distributing her brows were lost in subtle alchemist. Sent him in sleep may blow away but living truth, tinges with kings have no bitter words describe, slave to sorrow were laid aside with closely shaven head. You cramp the procession issues forth their guides, saluting him down his mountain loving people still and fearful storm tossed sailor on himalaya's chain, pass along their fickle forms of faces looking down where all manly grace that silent grave. | weinumpy.jpg | 123 | | 5 | 134 | Walford | Leopards with grinning skeletons at play clinch close shut out. Blacker than spring all sheep with head close to blow. Attending one will scorn the open blinded dazzled eyes upon its parts the heart whole, father in subtle creeds are never seeks repose. Increasing as victors came upon cyclopean columns vast expanse. | badaheXu.gif | 124 | +----+--------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ 125 | +------------+ 126 | | | 127 | +------------+ 128 | | SUBSCRIBER | 129 | +------------+ 130 | +-------+-------------+------+-----+---------+----------------+ 131 | | Field | Type | Null | Key | Default | Extra | 132 | +-------+-------------+------+-----+---------+----------------+ 133 | | Id | int(11) | NO | PRI | NULL | auto_increment | 134 | | Email | varchar(45) | YES | | NULL | | 135 | +-------+-------------+------+-----+---------+----------------+ 136 | +----+-----------------------------+ 137 | | Id | Email | 138 | +----+-----------------------------+ 139 | | 1 | aaren.munsey@gmail.com | 140 | | 2 | ediva.strudwick@hotmail.com | 141 | | 3 | hynek.diener@hotmail.com | 142 | | 4 | orelia.genet@gmail.com | 143 | | 5 | khanh.mccaw@mail.com | 144 | +----+-----------------------------+ 145 | +------+ 146 | | | 147 | +------+ 148 | | USER | 149 | +------+ 150 | +-----------------+---------------------+------+-----+---------+----------------+ 151 | | Field | Type | Null | Key | Default | Extra | 152 | +-----------------+---------------------+------+-----+---------+----------------+ 153 | | Id | int(11) | NO | PRI | NULL | auto_increment | 154 | | Email | varchar(45) | YES | | NULL | | 155 | | Pseudonym | varchar(45) | YES | | NULL | | 156 | | Password | varchar(45) | YES | | NULL | | 157 | | IsAdministrator | tinyint(3) unsigned | YES | | NULL | | 158 | +-----------------+---------------------+------+-----+---------+----------------+ 159 | +----+--------------------------------+-------------------+------------+-----------------+ 160 | | Id | Email | Pseudonym | Password | IsAdministrator | 161 | +----+--------------------------------+-------------------+------------+-----------------+ 162 | | 1 | bonnie.telecom@live.com | bonnietelecom | 1ew-abP | 1 | 163 | | 2 | jennilee.scheffler@outlook.com | jennileescheffler | C7ar?ipQ | 0 | 164 | | 3 | charlot.hatz@live.com | charlothatz | Be8a#rmadi | 0 | 165 | | 4 | zorina.relations@yahoo.com | zorinarelations | 8iel@lMoj | 1 | 166 | | 5 | loree.dutt@live.com | loreedutt | o-wsyB0 | 0 | 167 | +----+--------------------------------+-------------------+------------+-----------------+ 168 | --------------------------------------------------------------------------------