チェンジセット 2442

差分発生行の前後
無視リスト:
コミット日時:
2009/04/11 16:56:29 (3 年前)
コミッタ:
Seacolor
ログメッセージ:

ライセンス条文とASDocの追加

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • air/AirDao/src/com/seacolorswind/dbi/AbstractStatementThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import org.libspark.thread.Thread; 
     
    532         
    633        /** 
    7          * ... 
     34         * テーブルに対するクエリを実行するスレッドの抽象クラスです。 
    835         * @author Kazushi Tominaga (Seacolor) 
    936         */ 
    1037        internal class AbstractStatementThread extends Thread 
    1138        { 
     39                /** 
     40                 * データベースとの通信を格納するリソースです。 
     41                 */ 
    1242                protected var _resource:Resource; 
     43                /** 
     44                 * エンティティクラスもしくはエンティティクラスのインスタンスす。 
     45                 */ 
    1346                protected var _entity:Object; 
     47                /** 
     48                 * 実行が正常に完了した場合に呼び出される関数です。 
     49                 */ 
    1450                protected var _callback:Function; 
     51                /** 
     52                 * 実行が失敗した場合に呼び出される関数です。 
     53                 */ 
    1554                protected var _errorHandler:Function; 
    1655                 
    17                  
     56                /** 
     57                 * @inheritDoc 
     58                 */ 
    1859                override protected function run():void 
    1960                { 
    2061                        error(Error, catchEerror, false); 
    2162                } 
    22                  
     63                /** 
     64                 * エラーハンドラです。 
     65                 * @param       e 発生したエラーです。 
     66                 * @param       t エラーが発生したスレッドです。 
     67                 */ 
    2368                protected function catchEerror(e:Error, t:Thread):void { 
    2469                        _isError = true; 
     
    2974                        } 
    3075                } 
    31                  
     76                /** 
     77                 * @private 
     78                 */ 
    3279                protected var _isError:Boolean = false; 
    33                  
     80                /** 
     81                 * @private 
     82                 */ 
    3483                protected var _describe:XML; 
    35  
     84                /** 
     85                 * エンティティに関連付いたテーブル名を取得します。 
     86                 */ 
    3687                protected function get tableName():String { 
    3788                        if (!_tableName) { 
     
    51102                        return _tableName; 
    52103                } 
    53                  
     104                /** 
     105                 * @private 
     106                 */ 
    54107                protected var _tableName:String; 
    55  
     108                /** 
     109                 * プロパティの一覧情報です。 
     110                 */ 
    56111                protected function get variables():XMLList { 
    57112                        if (!_variables) { 
     
    69124                        return _variables; 
    70125                } 
    71                  
     126                /** 
     127                 * @private 
     128                 */ 
    72129                protected var _variables:XMLList; 
    73  
     130                /** 
     131                 * プロパティが主キーに指定されているかどうかを判定します。 
     132                 * @param       variable プロパティ情報です。 
     133                 * @return プロパティが主キーとして指定されている場合、trueを返却します。 それ以外の場合、falseを返却します。 
     134                 */ 
    74135                protected function isPrimary(variable:XML):Boolean { 
    75136                        if (variable.metadata.(@name == "Primary") != undefined) { 
     
    78139                        return false; 
    79140                } 
    80                  
     141                /** 
     142                 * プロパティが自動採番に指定されているかどうかを判定します。 
     143                 * @param       variable プロパティ情報です。 
     144                 * @return      プロパティが自動採番として指定されている場合、trueを返却します。 それ以外の場合、falseを返却します。 
     145                 */ 
    81146                protected function isAutoincrement(variable:XML):Boolean { 
    82147                        if (variable.metadata.(@name == "Autoincrement") != undefined) { 
     
    86151                } 
    87152                 
     153                /** 
     154                 * プロパティがテーブルの列として見なさない指定になっているかどうかを判定します。 
     155                 * @param       variable プロパティ情報です。 
     156                 * @return      プロパティがテーブルの列ではない場合、trueを返却します。 それ以外の場合、falseを返却します。 
     157                 */ 
    88158                protected function isIgnore(variable:XML):Boolean { 
    89159                        if (variable.metadata.(@name == "Ignore") != undefined) { 
  • air/AirDao/src/com/seacolorswind/dbi/AirDao.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLConnection; 
     
    1441         
    1542        /** 
    16          * ... 
     43         * AirDao クラスは AirDao の全てのインターフェイスを提供します。 
     44         * AirDaoを用いたレコードの操作は、全てこのクラスのメソッドを呼び出して行います。 
    1745         * @author Kazushi Tominaga (Seacolor) 
    1846         */ 
    1947        public class AirDao  
    2048        { 
     49                /** 
     50                 * @private 
     51                 */ 
    2152                protected const logger:ILogger = Log.getLogger("AirDao"); 
     53                /** 
     54                 * データベースとの通信を格納するリソースです。 
     55                 * このクラスにおける接続およびレコードの取得や更新はこのリソースを通して共有されます。 
     56                 */ 
    2257                protected var resource:Resource = new Resource(); 
    2358                 
     59                /** 
     60                 * コンストラクタです。 
     61                 * @param       db      データベースとして読み込みもしくは書き込みするファイルです。 この引数にnullを指定した場合、データベースはメモリに作成されます。 
     62                 * @param       threadExecutor  利用される IThreadExecutor です。 
     63                 */ 
    2464                public function AirDao(db:File = null, threadExecutor:IThreadExecutor = null)  
    2565                { 
     
    3777                } 
    3878                 
     79                /** 
     80                 * このデータベースの活動状態です。 
     81                 * クエリが実行中の場合、このプロパティはtrueを返却します。 
     82                 * それ以外の状態の場合、このプロパティはfalseを返却します。 
     83                 */ 
    3984                public function get executing():Boolean { 
    4085                        logger.debug("numSeriarizeThreads: {0}", ThreadQueue.numSeriarizeThreads); 
    4186                        return ThreadQueue.numSeriarizeThreads > 0 ? true : false; 
    4287                } 
    43                  
     88                /** 
     89                 * レコードを取得します。 
     90                 * @param       entity  テーブル情報と対応したエンティティクラスです。 
     91                 * @param       callback        レコードの取得が成功した場合に呼び出される関数です。 関数は下記の例の通り取得レコードの配列を引数として呼び出されます。 
     92                 * <code> 
     93                 *                                              function callback(records:Array):void 
     94                 * </code> 
     95                 * @param       param   レコードの取得条件です。 下記の例の通り、連想配列で指定します。 
     96                 * <code> 
     97                 *                                      {first_name: "foo", last_name: "bar"} 
     98                 * </code> 
     99                 * @param       order   レコードの整列条件です。 下記の例の通り、連想配列で指定します。 
     100                 * <code> 
     101                 *                                      {first_name: "ASC", last_name: "DESC"} 
     102                 * </code> 
     103                 * @param       errorHandler    レコードの取得がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     104                 */ 
    44105                public function read(entity:Class, callback:Function, param:Object = null, order:Object = null, errorHandler:Function = null):void { 
    45106                        new ReadThread(resource, entity, callback, param, order, errorHandler).start(); 
    46107                } 
    47                  
     108                /** 
     109                 * レコードを作成します。 このメソッド経由でレコードの作成を実行した場合、レコードの作成・削除・更新は同期化されます。 
     110                 * @param       entity  作成レコードの情報を格納したエンティティです。 
     111                 * @param       callback        レコードの作成が成功した場合に呼び出される関数です。 
     112                 * @param       errorHandler    レコードの作成がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     113                 */ 
    48114                public function create(entity:Object, callback:Function = null, errorHandler:Function = null):void { 
    49115                        if (entity is Array) { 
     
    53119                        } 
    54120                } 
    55                  
     121                /** 
     122                 * レコードを削除します。 このメソッド経由でレコードの削除を実行した場合、レコードの作成・削除・更新は同期化されます。 
     123                 * @param       entity  削除レコードの情報を格納したエンティティです。 
     124                 * @param       callback        レコードの削除が成功した場合に呼び出される関数です。 
     125                 * @param       errorHandler    レコードの削除がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     126                 */ 
    56127                public function remove(entity:Object, callback:Function = null, errorHandler:Function = null):void { 
    57128                        ThreadQueue.addThread(resource, new RemoveThread(resource, entity, callback, errorHandler)) 
    58129                } 
    59                  
     130                /** 
     131                 * レコードを更新します。 このメソッド経由でレコードの更新を実行した場合、レコードの作成・削除・更新は同期化されます。 
     132                 * @param       entity  更新レコードの情報を格納したエンティティです。 レコードは主キーに基づき、全ての列情報がプロパティに設定された値で上書きされます。 
     133                 * @param       callback        レコードの更新が成功した場合に呼び出される関数です。 
     134                 * @param       errorHandler    レコードの更新がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     135                 */ 
    60136                public function update(entity:Object, callback:Function = null, errorHandler:Function = null):void { 
    61137                        ThreadQueue.addThread(resource, new UpdateThread(resource, entity, callback, errorHandler)) 
  • air/AirDao/src/com/seacolorswind/dbi/BatchCreateThread.as

    r2386 r2442  
    1010         
    1111        /** 
    12          * ... 
     12         * テーブルのレコードを複数件作成するスレッドです。 
    1313         * @author Kazushi Tominaga (Seacolor) 
    1414         */ 
    1515        internal class BatchCreateThread extends AbstractStatementThread 
    1616        { 
     17                /** 
     18                 * @private 
     19                 */ 
    1720                protected const logger:ILogger = Log.getLogger(className); 
    1821 
     22                /** 
     23                 * コンストラクタです。 
     24                 * @param       resource 共有リソースです。 
     25                 * @param       entity エンティティクラスもしくはエンティティクラスのインスタンスの配列です。 
     26                 * @param       callback テーブルの作成が成功した場合に呼び出される関数です。 
     27                 * @param       errorHandler テーブルの作成がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     28                 */ 
    1929                public function BatchCreateThread(resource:Resource, entity:Array, callback:Function = null, errorHandler:Function = null)  
    2030                { 
     
    2434                        _errorHandler = errorHandler; 
    2535                } 
    26                  
     36                /** 
     37                 * @inheritDoc 
     38                 */ 
    2739                override protected function run():void 
    2840                { 
     
    4052                        next(execute); 
    4153                } 
    42                  
     54                /** 
     55                 * クエリを実行します。 
     56                 */ 
    4357                protected function execute():void { 
    4458                        logger.debug("start execute()"); 
     
    6074                        logger.debug("end execute()"); 
    6175                } 
    62                  
     76                /** 
     77                 * @private 
     78                 */ 
    6379                protected function finish():void { 
    6480                        logger.debug("start finish()"); 
     
    7187                        logger.debug("end finish()"); 
    7288                } 
    73                  
     89                /** 
     90                 * SQLErrorイベントハンドラです。 
     91                 * @param       event SQLErrorイベント 
     92                 */ 
    7493                protected function errorHandler(error:Error):void { 
    7594                        _resource.connector.rollback(); 
  • air/AirDao/src/com/seacolorswind/dbi/ConnectionThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLConnection; 
     
    1037         
    1138        /** 
    12          * ... 
     39         * テーブルとの接続を開始するスレッドです。 
    1340         * @author Kazushi Tominaga (Seacolor) 
    1441         */ 
    1542        internal class ConnectionThread extends Thread 
    1643        { 
     44                /** 
     45                 * @private 
     46                 */ 
    1747                protected const logger:ILogger = Log.getLogger(className); 
    1848                 
     49                /** 
     50                 * データベースとの通信を格納するリソースです。 
     51                 */ 
    1952                protected var _resource:Resource; 
    2053                 
     54                /** 
     55                 * コンストラクタです。 
     56                 * @param       resource 共有リソースです。 
     57                 */ 
    2158                public function ConnectionThread(resource:Resource)  
    2259                { 
     
    2663                        } 
    2764                } 
    28                  
     65                /** 
     66                 * @inheritDoc 
     67                 */ 
    2968                override protected function run():void 
    3069                { 
    3170                        event(_resource.connector, SQLEvent.OPEN, openHandler); 
    3271                        event(_resource.connector, SQLErrorEvent.ERROR, errorHandler); 
     72                        // 非同期モードでデータベースファイルを開きます。 
    3373                        _resource.connector.openAsync(_resource.db); 
    3474                } 
    35                  
     75                /** 
     76                 * @private 
     77                 */ 
    3678                protected function openHandler(event:SQLEvent):void { 
    3779                        logger.debug("connection successfull."); 
    3880                } 
    39                  
     81                /** 
     82                 * SQLErrorイベントハンドラです。 
     83                 * @param       event SQLErrorイベント 
     84                 */ 
    4085                protected function errorHandler(event:SQLErrorEvent):void { 
    4186                        logger.debug("connection failed."); 
  • air/AirDao/src/com/seacolorswind/dbi/CreateTableThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLStatement; 
     
    835         
    936        /** 
    10          * ... 
     37         * テーブルを作成するスレッドです。 
     38         *  データベースに該当のテーブルが存在しない場合、エンティティの情報に基づいてテーブルを作成します。 
     39         *  該当のテーブルが既に存在する場合、このスレッドは何もせずに終了します。 
    1140         * @author Kazushi Tominaga (Seacolor) 
    1241         */ 
    1342        internal class CreateTableThread extends AbstractStatementThread 
    1443        { 
     44                /** 
     45                 * @private 
     46                 */ 
    1547                protected const logger:ILogger = Log.getLogger(className); 
    1648                 
     49                /** 
     50                 * コンストラクタです。 
     51                 * @param       resource 共有リソースです。 
     52                 * @param       entity エンティティクラスもしくはエンティティクラスのインスタンスです。 
     53                 * @param       callback テーブルの作成が成功した場合に呼び出される関数です。 
     54                 * @param       errorHandler テーブルの作成がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     55                 */ 
    1756                public function CreateTableThread(resource:Resource, entity:Object, callback:Function = null, errorHandler:Function = null)  
    1857                { 
     
    2261                        _errorHandler = errorHandler; 
    2362                } 
    24                  
     63                /** 
     64                 * @inheritDoc 
     65                 */ 
    2566                override protected function run():void 
    2667                { 
    2768                        super.run(); 
    28                          
     69                        // テーブルが作成済みの場合、スレッドを終了 
    2970                        if (_resource.created[tableName] || _entity.created_on) { 
    3071                                return; 
     
    3273                        next(execute); 
    3374                } 
    34                  
     75                /** 
     76                 * クエリを実行します。 
     77                 */ 
    3578                protected function execute():void { 
    3679                        if (_isError) { 
     
    64107                        stmt.execute(); 
    65108                } 
    66                  
     109                /** 
     110                 * プロパティのデータ型に対応した列親和型を返します。 
     111                 * @param       type プロパティのデータ型です。 
     112                 * @return プロパティのデータ型に対応した列親和型です。 
     113                 */ 
    67114                protected function mapping(type:String):String { 
    68115                        switch (type) { 
     
    86133                        } 
    87134                } 
    88                  
     135                /** 
     136                 * @private 
     137                 */ 
    89138                protected function create(event:SQLEvent):void { 
    90139                        logger.debug("statement successfull."); 
     
    96145                        if (_callback != null) _callback.apply(this, []); 
    97146                } 
    98                  
     147                /** 
     148                 * SQLErrorイベントハンドラです。 
     149                 * @param       event SQLErrorイベント 
     150                 */ 
    99151                protected function errorHandler(event:SQLErrorEvent):void { 
    100152                        logger.debug("statement failed."); 
  • air/AirDao/src/com/seacolorswind/dbi/CreateThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLStatement; 
     
    1037         
    1138        /** 
    12          * ... 
     39         * レコードを作成するスレッドです。 
    1340         * @author Kazushi Tominaga (Seacolor) 
    1441         */ 
    1542        internal class CreateThread extends AbstractStatementThread 
    1643        { 
     44                /** 
     45                 * @private 
     46                 */ 
    1747                protected const logger:ILogger = Log.getLogger(className); 
    1848 
     49                /** 
     50                 * コンストラクタです。 
     51                 * @param       resource 共有リソースです。 
     52                 * @param       entity エンティティです。 
     53                 * @param       callback テーブルの作成が成功した場合に呼び出される関数です。 
     54                 * @param       errorHandler テーブルの作成がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     55                 */ 
    1956                public function CreateThread(resource:Resource, entity:Object, callback:Function = null, errorHandler:Function = null)  
    2057                { 
     
    2562                        _errorHandler = errorHandler; 
    2663                } 
    27                  
     64                /** 
     65                 * @inheritDoc 
     66                 */ 
    2867                override protected function run():void 
    2968                { 
     
    3776                        next(execute); 
    3877                } 
    39                  
     78                /** 
     79                 * クエリを実行します。 
     80                 */ 
    4081                protected function execute():void { 
    4182                        logger.debug("execute({0})", arguments); 
     
    94135                        stmt.execute(); 
    95136                } 
    96                  
     137                /** 
     138                 * @private 
     139                 */ 
    97140                protected var _is_created_on:Boolean; 
     141                /** 
     142                 * @private 
     143                 */ 
    98144                protected var _is_updated_on:Boolean; 
     145                /** 
     146                 * @private 
     147                 */ 
    99148                protected var _created_on:Date; 
    100                  
     149                /** 
     150                 * @private 
     151                 */ 
    101152                protected function create(event:SQLEvent):void { 
    102153                        logger.debug("statement successfull."); 
     
    112163                } 
    113164                 
     165                /** 
     166                 * SQLErrorイベントハンドラです。 
     167                 * @param       event SQLErrorイベント 
     168                 */ 
    114169                protected function errorHandler(event:SQLErrorEvent):void { 
    115170                        logger.debug("statement failed."); 
  • air/AirDao/src/com/seacolorswind/dbi/PagingThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLResult; 
     
    1037         
    1138        /** 
    12          * ... 
     39         * @private 
    1340         * @author Kazushi Tominaga (Seacolor) 
    1441         */ 
  • air/AirDao/src/com/seacolorswind/dbi/Queue.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.events.Event; 
     
    1037         
    1138        /** 
    12          * ... 
    13          * @author ... 
     39         * スレッドのキューです。 
     40         * ThreadQueueのaddThreadメソッドでスレッドを登録する事で、スレッドはキューに登録され、登録した順番に実行されます。 
     41         * @see com.seacolorswind.dbi.ThreadQueue 
     42         * @author Kazushi Tominaga (Seacolor) 
    1443         */ 
    1544        public class Queue extends Thread 
    1645        { 
     46                /** 
     47                 * @private 
     48                 */ 
    1749                protected const logger:ILogger = Log.getLogger(className); 
    1850                 
     51                /** 
     52                 * コンストラクタです。 
     53                 * @param       resource 共有リソースです。 
     54                 */ 
    1955                public function Queue(resource:Resource)  
    2056                { 
     
    2258                        _resource = resource; 
    2359                } 
    24                  
     60                /** 
     61                 * @private 
     62                 */ 
    2563                protected var _resource:Resource; 
    26                  
     64                /** 
     65                 * スレッドをキューに登録します。 
     66                 * @param       queue キューに登録されるスレッドです。 
     67                 */ 
    2768                public function addQueue(queue:Thread):void { 
    2869                        logger.debug("addQueue({0})", arguments); 
    2970                        _waitingQueues.push(queue); 
    3071                } 
    31                  
     72                /** 
     73                 * 待機中のキューの数です。 
     74                 */ 
    3275                public function get numQueues():int { 
    3376                        logger.debug("queues: {0}, state: {1}", _waitingQueues.length, state); 
    3477                        return _waitingQueues.length + (state == ThreadState.TERMINATED ? 0 : 1); 
    3578                } 
    36                  
     79                /** 
     80                 * キューの永続性です。 
     81                 */ 
    3782                public function get seriarizable():Boolean { 
    3883                        logger.debug("seriarizable: {0}", _resource.db != null); 
    3984                        return _resource.db != null; 
    4085                } 
    41                  
     86                /** 
     87                 * @private 
     88                 */ 
    4289                protected var _waitingQueues:Vector.<Thread> = new Vector.<Thread>(); 
    43                  
     90                /** 
     91                 * @inheritDoc 
     92                 */ 
    4493                override protected function run():void  
    4594                { 
     
    5099                        _resource.connector.begin(); 
    51100                } 
    52                  
     101                /** 
     102                 * キューを順番に実行します。 
     103                 */ 
    53104                protected function runQueue(e:Event = null):void { 
    54105                        logger.debug("runQueue({0})", arguments); 
     
    66117                        } 
    67118                } 
    68                  
     119                /** 
     120                 * 全てのキューを実行した後に呼び出されるメソッドです。 
     121                 */ 
    69122                protected function destory(e:Event = null):void { 
    70123                        if (_waitingQueues.length > 0) 
    71124                                next(run); 
    72125                } 
    73                  
     126                /** 
     127                 * SQLErrorイベントハンドラです。 
     128                 * @param       event SQLErrorイベント 
     129                 */ 
    74130                protected function sqlErrorHandler(e:SQLErrorEvent):void { 
    75131                        logger.debug("sqlErrorHandler()", arguments); 
     
    77133                } 
    78134                 
     135                /** 
     136                 * エラーハンドラです。 
     137                 * @param       e 発生したエラーです。 
     138                 * @param       t エラーが発生したスレッドです。 
     139                 */ 
    79140                protected function errorHandler(e:Error, t:Thread):void { 
    80141                        logger.debug("errorHandler({0})", arguments); 
  • air/AirDao/src/com/seacolorswind/dbi/ReadThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLResult; 
     
    1138         
    1239        /** 
    13          * ... 
     40         * レコードを取得するスレッドです。 
    1441         * @author Kazushi Tominaga (Seacolor) 
    1542         */ 
    1643        public class ReadThread extends AbstractStatementThread 
    1744        { 
     45                /** 
     46                 * @private 
     47                 */ 
    1848                protected const logger:ILogger = Log.getLogger(className); 
    19                  
     49                /** 
     50                 * @private 
     51                 */ 
    2052                protected var _query:String; 
     53                /** 
     54                 * @private 
     55                 */ 
    2156                protected var _param:Object; 
     57                /** 
     58                 * @private 
     59                 */ 
    2260                protected var _order:Object; 
    2361                 
     62                /** 
     63                 * コンストラクタです。 
     64                 * @param       resource 共有リソースです。 
     65                 * @param       entity  テーブル情報と対応したエンティティクラスです。 
     66                 * @param       callback        レコードの取得が成功した場合に呼び出される関数です。 関数は下記の例の通り取得レコードの配列を引数として呼び出されます。 
     67                 * <code> 
     68                 *                                              function callback(records:Array):void 
     69                 * </code> 
     70                 * @param       param   レコードの取得条件です。 下記の例の通り、連想配列で指定します。 
     71                 * <code> 
     72                 *                                      {first_name: "foo", last_name: "bar"} 
     73                 * </code> 
     74                 * @param       order   レコードの整列条件です。 下記の例の通り、連想配列で指定します。 
     75                 * <code> 
     76                 *                                      {first_name: "ASC", last_name: "DESC"} 
     77                 * </code> 
     78                 * @param       errorHandler    レコードの取得がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     79                 */ 
    2480                public function ReadThread(resource:Resource, entity:Class, callback:Function, param:Object = null, order:Object = null, errorHandler:Function = null)  
    2581                { 
     
    3288                        _errorHandler = errorHandler; 
    3389                } 
    34                  
     90                /** 
     91                 * @inheritDoc 
     92                 */ 
    3593                override protected function run():void 
    3694                { 
     
    44102                        next(execute); 
    45103                } 
    46                  
     104                /** 
     105                 * クエリを実行します。 
     106                 */ 
    47107                protected function execute():void { 
    48108                        logger.debug("execute({0})", arguments); 
     
    89149                        stmt.execute(); 
    90150                } 
    91                  
     151                /** 
     152                 * @private 
     153                 */ 
    92154                protected var stmt:SQLStatement; 
    93                  
     155                /** 
     156                 * @private 
     157                 */ 
    94158                protected function read(event:SQLEvent):void { 
    95159                        logger.debug("read({0})", arguments); 
     
    129193                        } 
    130194                         
    131 /*                      var data:ResultEntityArray = new ResultEntityArray(result); 
    132                         var bitmapColumns:Array = []; 
    133                         for each (var variable:XML in variables) { 
    134                                 if (variable.@type == "*") { 
    135                                         bitmapColumns.push(variable.@name); 
    136                                 } 
    137                         } 
    138                         data.forEach(function(item:*, index:int, columns:Array):void { 
    139                                 for each (var column:String in bitmapColumns) { 
    140                                         if (item[column]) { 
    141                                                 var dec:Base64Decoder = new Base64Decoder(); 
    142                                                 dec.decode(item[column]); 
    143                                                 item[column] = dec.toByteArray(); 
    144                                         } 
    145                                 } 
    146                         }); 
    147 */                       
    148195                        data.resource = _resource; 
    149196                        data.sqlStatement = stmt; 
     
    152199                        _callback.apply(this, [data]); 
    153200                } 
    154                  
     201                /** 
     202                 * SQLErrorイベントハンドラです。 
     203                 * @param       event SQLErrorイベント 
     204                 */ 
    155205                protected function errorHandler(event:SQLErrorEvent):void { 
    156206                        logger.debug("statement failed."); 
  • air/AirDao/src/com/seacolorswind/dbi/RemoveThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi 
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi 
    229{ 
    330        import flash.data.SQLResult; 
     
    936         
    1037        /** 
    11          * ... 
     38         * レコードを削除するスレッドです。 
    1239         * @author Kazushi Tominaga (Seacolor) 
    1340         */ 
    1441        internal class RemoveThread extends AbstractStatementThread 
    1542        { 
     43                /** 
     44                 * @private 
     45                 */ 
    1646                protected const logger:ILogger = Log.getLogger(className); 
    1747 
     48                /** 
     49                 * コンストラクタです。 
     50                 * @param       resource 共有リソースです。 
     51                 * @param       entity エンティティです。 
     52                 * @param       callback テーブルの作成が成功した場合に呼び出される関数です。 
     53                 * @param       errorHandler テーブルの作成がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     54                 */ 
    1855                public function RemoveThread(resource:Resource, entity:Object, callback:Function = null, errorHandler:Function = null)  
    1956                { 
     
    2360                        _errorHandler = errorHandler; 
    2461                } 
    25                  
     62                /** 
     63                 * @inheritDoc 
     64                 */ 
    2665                override protected function run():void 
    2766                { 
     
    3473                        next(execute); 
    3574                } 
    36                  
     75                /** 
     76                 * クエリを実行します。 
     77                 */ 
    3778                protected function execute():void { 
    3879                        if (_isError) { 
     
    63104                        stmt.execute(); 
    64105                } 
    65                  
     106                /** 
     107                 * @private 
     108                 */ 
    66109                protected function remove(event:SQLEvent):void { 
    67110                        if (_isError) { 
     
    72115                } 
    73116                 
     117                /** 
     118                 * SQLErrorイベントハンドラです。 
     119                 * @param       event SQLErrorイベント 
     120                 */ 
    74121                protected function errorHandler(event:SQLErrorEvent):void { 
    75122                        throw event.error; 
  • air/AirDao/src/com/seacolorswind/dbi/Resource.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLConnection; 
     
    734         
    835        /** 
    9          * ... 
     36         * Resource クラスはデータベースとの通信に用いられる全ての情報を保持します。 
    1037         * @author Kazushi Tominaga (Seacolor) 
    1138         */ 
    1239        public class Resource 
    1340        { 
     41                /** 
     42                 * データベースとして読み込みもしくは書き込みするファイルです。 
     43                 */ 
    1444                public var db:File; 
     45                /** 
     46                 * データベースの接続情報です。 
     47                 * このプロパティはデータベースへの全ての操作に使われます。 
     48                 */ 
    1549                public var connector:SQLConnection = new SQLConnection(); 
     50                /** 
     51                 * データベースのクエリ情報です。 
     52                 * このプロパティはレコードの作成・更新・削除で利用され、レコードの取得時は使われません。 
     53                 */ 
    1654                public var statement:SQLStatement = new SQLStatement(); 
     55                /** 
     56                 * テーブルの作成情報です。 
     57                 * テーブル名をキーとして、テーブルが作成されていればtrueが設定されます。 
     58                 */ 
    1759                public var created:Dictionary = new Dictionary(); 
    1860        } 
  • air/AirDao/src/com/seacolorswind/dbi/ResultEntityArray.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLResult; 
    431        import flash.data.SQLStatement; 
     32        import flash.errors.IllegalOperationError; 
    533         
    634        /** 
    7          * ... 
     35         * レコードの取得結果の配列です。 
    836         * @author Kazushi Tominaga (Seacolor) 
    937         */ 
    1038        public dynamic class ResultEntityArray extends Array 
    1139        { 
     40                /** 
     41                 * @private 
     42                 */ 
    1243                protected var _resource:Resource; 
     44                /** 
     45                 * @private 
     46                 */ 
    1347                protected var _sqlStatement:SQLStatement; 
    14                  
     48                /** 
     49                 * @private 
     50                 */ 
    1551                protected var _complete:Boolean = true; 
    16                  
     52                /** 
     53                 * @inheritDoc 
     54                 */ 
    1755                public function ResultEntityArray(...args)  
    1856                { 
     
    4482                        } 
    4583                } 
    46                  
     84                /** 
     85                 * @private 
     86                 */ 
    4787                public function next(callback:Function):void { 
    48                         if (!_complete && _sqlStatement != null && _resource != null) { 
     88                        throw new IllegalOperationError("this method is not supported."); 
     89/*                      if (!_complete && _sqlStatement != null && _resource != null) { 
    4990                                new PagingThread(_resource, _sqlStatement, function(result:ResultEntityArray):void { 
    50                                         //_complete = result.complete; 
    51                                         //_resource = result.resource; 
    52                                         //_sqlStatement = sqlStatement; 
    5391                                        callback.apply(this, [result]); 
    54                                         //concat(result); 
    5592                                }).start(); 
    5693                        } 
    57               } 
     94*/            } 
    5895                 
    5996                public function remove(callback:Function = null):void { 
     97                        throw new IllegalOperationError("this method is not supported."); 
    6098/*                      forEach(function(item:*, index:int, array:Array):void { 
    6199                                new QueueThread(_resource, new RemoveThread(resource, item)).start(); 
    62100                        }); 
    63101*/              } 
    64                  
     102                /** 
     103                 * このレコードセットと関連する共有リソースです。 
     104                 */ 
    65105                public function get resource():Resource { 
    66106                        return resource; 
    67107                } 
     108                /** 
     109                 * @private 
     110                 */ 
    68111                public function set resource(value:Resource):void { 
    69112                        _resource = value; 
    70113                } 
    71                  
     114                /** 
     115                 * このレコードセットと関連するSQLStatementです。 
     116                 */ 
    72117                public function get sqlStatement():SQLStatement { 
    73118                        return _sqlStatement; 
    74119                } 
     120                /** 
     121                 * @private 
     122                 */ 
    75123                public function set sqlStatement(value:SQLStatement):void { 
    76124                        _sqlStatement = value; 
    77125                } 
    78                  
     126                /** 
     127                 * このレコードセットの取得完了状態です。 
     128                 */ 
    79129                public function set complete(value:Boolean):void { 
    80130                        _complete = value; 
    81131                } 
     132                /** 
     133                 * @private 
     134                 */ 
    82135                public function get complete():Boolean { 
    83136                        return _complete; 
  • air/AirDao/src/com/seacolorswind/dbi/ThreadQueue.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.utils.Dictionary; 
     
    835         
    936        /** 
    10          * ... 
    11          * @author ... 
     37         * スレッドのキューを管理するクラスです。 
     38         * キューは共有リソース毎に作成され、管理されます。 共有リソースの異なるスレッドは異なるキューと見なされます。 
     39         * @see com.seacolorswind.dbi.Queue 
     40         * @author Kazushi Tominaga (Seacolor) 
    1241         */ 
    1342        public class ThreadQueue  
    1443        { 
     44                /** 
     45                 * 全てのキューの待機中のスレッドの数です。 
     46                 */ 
    1547                public static function get numThreads():int { 
    1648                        var rtnNum:int = 0; 
     
    2153                } 
    2254                 
     55                /** 
     56                 * 永続キューの待機中のスレッドの数です。 
     57                 */ 
    2358                public static function get numSeriarizeThreads():int { 
    2459                        var rtnNum:int = 0; 
     
    2964                        return rtnNum; 
    3065                } 
    31                  
     66                /** 
     67                 * キューを作成し、キューにスレッドを登録します。 
     68                 * キューが作成済みの場合、キューは作成されずスレッドの登録のみが行われます。 
     69                 * @param       resource 共有リソースです。 
     70                 * @param       thread キューに登録されるスレッドです。 
     71                 * @param       threadExecutor  利用される IThreadExecutor です。 
     72                 */ 
    3273                public static function addThread(resource:Resource, thread:Thread, threadExecutor:IThreadExecutor = null):void { 
    3374                        if (!Thread.isReady) { 
     
    5293                        _queueThreads[resource] = _queueThread; 
    5394                } 
    54                  
     95                /** 
     96                 * @private 
     97                 */ 
    5598                protected static var _queueThreads:Dictionary = new Dictionary(); 
    56                  
     99                /** 
     100                 * @private 
     101                 */ 
    57102                protected static var _queueThread:Queue; 
    58103        } 
  • air/AirDao/src/com/seacolorswind/dbi/UpdateThread.as

    r2386 r2442  
    1 package com.seacolorswind.dbi  
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2009 Kazushi tominaga 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package com.seacolorswind.dbi  
    229{ 
    330        import flash.data.SQLStatement; 
     
    1037         
    1138        /** 
    12          * ... 
     39         * レコードを更新するスレッドです。 
    1340         * @author Kazushi Tominaga (Seacolor) 
    1441         */ 
    1542        internal class UpdateThread extends AbstractStatementThread 
    1643        { 
     44                /** 
     45                 * @private 
     46                 */ 
    1747                protected const logger:ILogger = Log.getLogger(className); 
    18  
     48                /** 
     49                 * コンストラクタです。 
     50                 * @param       resource 共有リソースです。 
     51                 * @param       entity エンティティです。 
     52                 * @param       callback テーブルの作成が成功した場合に呼び出される関数です。 
     53                 * @param       errorHandler テーブルの作成がエラーにより失敗した場合に呼び出される関数です。 関数は発生したエラーのインスタンスを引数として呼び出されます。 
     54                 */ 
    1955                public function UpdateThread(resource:Resource, entity:Object, callback:Function = null, errorHandler:Function = null)  
    2056                { 
     
    2460                        _errorHandler = errorHandler; 
    2561                } 
    26                  
     62                /** 
     63                 * @inheritDoc 
     64                 */ 
    2765                override protected function run():void 
    2866                { 
     
    3674                        next(execute); 
    3775                } 
    38                  
     76                /** 
     77                 * クエリを実行します。 
     78                 */ 
    3979                protected function execute():void { 
    4080                        logger.debug("execute()"); 
     
    91131                        stmt.execute(); 
    92132                } 
    93                  
     133                /** 
     134                 * @private 
     135                 */ 
    94136                protected var _is_updated_on:Boolean; 
     137                /** 
     138                 * @private 
     139                 */ 
    95140                protected var _updated_on:Date; 
    96                  
     141                /** 
     142                 * @private 
     143                 */ 
    97144                protected function complete(event:SQLEvent):void { 
    98145                        logger.debug("complete({0})", arguments[0]); 
     
    106153                } 
    107154                 
     155                /** 
     156                 * SQLErrorイベントハンドラです。 
     157                 * @param       event SQLErrorイベント 
     158                 */ 
    108159                protected function errorHandler(event:SQLErrorEvent):void { 
    109160                        logger.debug("errorHandler({0})", arguments[0]);