Beauty Salon α-BET (alphabet)

space001
Blender3d Collada dae modeling Use Papervision3d on Progression3 and 4 http://a-bet.secret.jp/#/access
more whaison works.
whaison space
space002
http://whaison.jugem.jp/ https://jp.pinterest.com/whaison/ https://www.instagram.com/whaison/ https://whaison.amebaownd.com/
https://suzuri.jp/whaison
http://whaison.blogspot.com/
http://whaison.tumblr.com/ http://qiita.com/users/whaison http://www.behance.net/whaison https://github.com/whaison/ https://bitbucket.org/whaison http://serato.com/user/whaison http://whaison.hatenablog.jp/

typo memo
http://d.hatena.ne.jp/whaison/


dayNote
http://www.myspace.com/whaison http://ameblo.jp/whaison/ http://blog.crooz.jp/whaison/ http://blog.crooz.jp/whaisoncafe/ http://nenpyo.org/whaison

fulldisk
http://full.shin-gen.jp/
http://whaison.client.jp/
http://www.dclog.jp/whaison/
featured forums.
space004
forum.unity3d.com/

forums.unrealengine.com.

Progression Forum.

FlashDevelop Forum.

Papervision3D Forum.

FlexUserGroup Forum.

SparkProjectForum.





Twitter







Mobile
qrcode
Calendar
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
31      
<< March 2024 >>
New Entries
Archives
Categories
Recent comment
  • FlashDevelopでフォント埋め込み
    感謝!! (12/24)
  • cocos2d-x-3.0rc0 ,c++ ,cpp でTexturePacker で 吐き出した、plist と png でパラパラアニメーションのコード例
    whaison (04/17)
  • Blender2.67にbvh(web上に2500個以上ころがってる)入れてそのBoneオブジェクトをUnity4.0のmecanimで使う
    whaison (08/19)
  • Apple Dev Center 「Certificates, Identifiers & Profiles」で Adhoc をつくってXCode4.6.1でArchiveしてipaを書き出し
    whaison (04/30)
  • Flash CS6でプロパティーパネルで物理演算のジャンプの高さを設定できるCitrus Engine
    whaison (03/01)
  • 「Flash以外、例えばKinectとか」ON TOKYO (会場:高田馬場4-11-8 Floor 6階 ) 短縮URL http://bit.ly/dI0Bfx
    uka (03/02)
  • App Store Review Guidelines アップル社のアプリ審査基準ガイドライン和訳 Apple が 開発者を悩ませ ユーザーをハッピーにしたいガイドライン。w
    whaison (01/25)
  • Unity3d では ADOBE JAPAN OSAKIで行われたFITC 2010 TOKYOでは、 「iOS用にパブリッシュするためには、フリー版ではなくて、有料版を買ってください。さらに追加のパッケージである、"iOS Package (for Development)"を買ってください」とのことだった。
    whaison (01/25)
  • enjoy Adidas-Futsal-Park
    whaison (01/16)
  • MacBookAir にFlashPlayer入れたらなった。Mac Flash Player 10.1/10.2でUstream などでカメラが認識されないバグそんなときはUstreamProducer!でもなくiPhoneだと直ぐにライブ配信できた
    whaison (01/14)
simple sintax high lighter2.0
space003
SyntaxHighlighter2.0用 の貼り付けコード作成する!
ブログパーツ-BLOG PARTS.
Profile
Links
Recommend
Sponsored Links
Admin
無料ブログ作成サービス JUGEM
Seach this site
            
2022.03.28 Monday
スポンサーサイト

一定期間更新がないため広告を表示しています

| スポンサードリンク | - | | - | - | pookmark |
            
2014.11.18 Tuesday
php Laravelフレームワークごにょごにょやるうえで勉強したことをつらつらと001
php Laravelフレームワークごにょごにょやるうえでしらべたことをつらつらと

ーーーーーーーーhttp://www.ospn.jp/press/20140605no40-useit-oss.htmlーーーーーーーーーーーーーー
6.モデルについて
モデルには
1、エロクアント(Eloquent)、
2、クエリービルダーと
3、ベーシックなクエリーの
3種類あって

ベーシックなクエリーは下記の様な発行方法です。

■SELECT
DB::select('select * from users where id = ?', array(1));

■INSERT
DB::insert('insert into users (id, name) values (?, ?)', array(1, 'Dayle'));

■UPDATE
DB::update('update users set votes = 100 where name = ?', array('John'));

■DELETE
DB::delete('delete from users');

いずれもプリペアドステートメントを使用して
各クエリーを発行する形式になっています。
プリペアドステートメントとは? 実行したい SQL をコンパイルした 一種のテンプレートのようなものです。
解析/コンパイル/最適化 の繰り返しを避けるので高速に動作するということです。
(http://php.net/manual/ja/pdo.prepared-statements.php)

クエリービルダーでは以下の様になります。

■SELECT
DB::table('users')->where('id', 1)->first();

■INSERT
DB::table('users')->insertGetId(['id' => 1, 'name' => 'Dayle']);

■UPDATE
DB::table('users')->where('name' => 'John')->update(['votes' => 100]);

■DELETE
DB::table('users')->where('name' => 'John')->delete();

複数の検索条件が必要な場合はwhereを複数記述することで、
内部でANDへと変換されます。

エロクアントは、より洗練されたORMを提供します。

 ■SELECT
User::all();
User::find(1);

 ■INSERT
$user = User::create(array('name' => 'John'));

 ■UPDATE
$user = User::find(1);
$user->email = 'john@foo.com';
$user->save();

■DELETE
$user = User::find(1);
$user->delete();

エロクアントの場合は、デフォルトでは
クラス名を小文字の複数形にしたものが、テーブル名として使用されます。
初期状態の場合はapp/modelsにUserクラスが設置されています。
複数形ではない別のテーブルを使用する場合は、

protected $table = 'table_name';

と定義し
同様にfindで使われるものはprimaryKeyとなりますので、

protected $primaryKey = "table_id";

と定義します。
検索条件の追加等はクエリービルダーを組み合わせて実装していきます。

エロクアント、クエリービルダー、ベーシックの3種とも、
データベースのマスター、スレーブ、複数のデータベースを使用する場合等は、

// ベーシック
DB::connection('master')->select($sql, $params);

// クエリービルダー
DB::connection('master')->table('table')->get();

// エロクアント
User::on('slave)->find(1);

等の様に接続先を変更します。
これらの接続先は、app/config/database.php内のconnections配列のキーを
指定することで変更可能です。
デフォルトはsqlite, mysql, pgsql(PostgreSQL), sqlsrv(SQL Server)になっていますので、
masterやslaveなどへ変更して、接続先を指定してください。


ーーーーーーーーhttp://www.ospn.jp/press/20140605no40-useit-oss.htmlーーーーーーーーーーーーーー

DB::connection(切り替えるテーブルの変数名)->beginTransaction();

トランザクションという処理の詰め合わせのようなものをはじめて
DB::connection(切り替えるテーブルの変数名)->commit();
でデータベースに反映する

$a = App::make('MyManager')->getConnection();
Laravel はApp::makeでクラス名を指定すれば、それをnewと同様にインスタンス化してくれます。
http://kore1server.com/186
<?php
// key comes from app/config/app.php.
// this will output a big long random string
echo Config::get('app.key');

// timezone comes from app/config/local/app.php
// this will output "America/Los_Angeles"
echo Config::get('app.timezone');
?>
http://laravel-recipes.com/recipes/27/environment-specific-configurations


——————————http://laravel4.kore1server.com/docs/database-----------

ちなみにPlayerCardManager.phpの
$con = App::make('PlayerManager')->getPlayerConnection($playerId);
PlayerManager.phpのPlayerManagerクラスのインスタンスの
関数getPlayerConnectionに引数(playerId=19800422など)を渡して

DB::connection($con)->beginTransaction();は

場合により、自分でトランザクションを始める必要があることもあるでしょう。

DB::beginTransaction();
トランザクションをロールバックするには、rollbackメソッドを使用します。

DB::rollback();
最後に、トランザクションのコミットは、commitメソッドです。

DB::commit();


トランザクションとは    http://gihyo.jp/dev/serial/01/db-academy/000201 より
データベースは,トランザクションという単位で「ユーザが実行した一連のながながとした処理」を管理します。


コネクションとの接続
複数のコネクションを使用するときはDB::connectionメソッドが使用できます。
$users = DB::connection('foo')->select(...);




———————http://laravel4.kore1server.com/docs/database--------------------

 
| whaison | php Laravel | 19:00 | comments(0) | - | pookmark |