1  //!-- UTF8
     2  /*
     3   Oregano Multiuser Server - Version 1.2.0 - January 4th, 2005
     4   
     5  	Web:  www.oregano-server.org
     6  	Mail: info@oregano-server.org
     7   
     8  	Copyright 2003 - 2004 - 2004 Jens Halm / Cologne, Germany
     9   
    10   This library is free software; you can redistribute it and/or
    11   modify it under the terms of the GNU Lesser General Public
    12   License as published by the Free Software Foundation; either
    13   version 2.1 of the License, or (at your option) any later version.
    14   
    15   This library is distributed in the hope that it will be useful,
    16   but WITHOUT ANY WARRANTY; without even the implied warranty of
    17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    18   Lesser General Public License for more details.
    19   
    20   You should have received a copy of the GNU Lesser General Public
    21   License along with this library; if not, write to the Free Software
    22   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23  */
    24  
    25  /*
    26   -------------------------------------------
    27  	Classe DbTransactionPart
    28   
    29  	@description :
    30  	Résultat d'une requête SQL.
    31   
    32   
    33  	@author Jens Halm copyright http://www.spicefactory.org/
    34  	@author erixtekila copyleft http://www.v-i-a.net  
    35   -------------------------------------------
    36  	version history :
    37  	1.2.0 : 04/02/05
    38  			- Portage en actionscript 2 pour le
    39  			compile time type checking
    40   -------------------------------------------
    41   */
    42  
    43  import org.omus.data.Table;
    44  
    45  /**
    46   *	Cette classe gère les résultats d'une requête SQL.
    47   *
    48   *	@author Jens Halm copyright http://www.spicefactory.org/
    49   *	@author erixtekila copyleft http://www.v-i-a.net 
    50   *	@version 1.2.0
    51   */
    52  class org.omus.db.DbResult
    53  {
    54  	//--------------------
    55  	// PROPRIETES
    56  	//--------------------
    57  	/**
    58  	 *	Tableau associatif des listes d'enregistrements.
    59  	 */
    60  	private var tables:Object;
    61  	
    62  	/**
    63  	 *	TODO
    64  	 */
    65  	private var fields:Object;
    66  	
    67  	/**
    68  	 *	Nombre d'enregistrements modifiés.
    69  	 */
    70  	private var affRows:Number;
    71  	
    72  	//--------------------
    73  	// CONSTRUCTEUR
    74  	//--------------------
    75  	/**
    76  	 *	L'objet DbResult est soumis par l'événement onResult.
    77  	 *	
    78  	 *	@param tables			Référence au tableau des résuktats.
    79  	 *	@param fields			TODO
    80  	 *	@param affRows			Nombre d'enregistrements.
    81  	 */
    82  	public function DbResult (tables:Table, fields:Object, affRows:Number)
    83  	{
    84  		// Propriétés
    85  		this.tables = tables;
    86  		this.fields = fields;
    87  		this.affRows = affRows;
    88  		
    89  		// trace(this+ " installé.");
    90  	}
    91  	
    92  	
    93  	//--------------------
    94  	// METHODES PUBLIQUES
    95  	//--------------------
    96  	/**
    97  	 *	Utilisé dans un contexte littéral
    98  	 *	@return	Une chaine définissant l'objet
    99  	 */
   100  	public function toString():String
   101  	{
   102  		var s = "[Objet DbTransaction]";
   103  		s += "\norg.omus.DbResult:";
   104  		s += "\ntables = " + org.omus.util.Log.formatObject(tables, 1);
   105  		s += "\naffected rows = " + org.omus.util.Log.formatObject(affRows, 1);
   106  		return s;
   107  	}
   108  	
   109  	/**
   110  	 *	Renvoie le tableau des résultats.
   111  	 *
   112  	 *	@param resultID		Identifiant envoyé par DbReader.
   113  	 *	@return				Tous les enregistrements.
   114  	 */
   115  	public function getTable (resultID:String):Table
   116  	{
   117  		return tables[resultID];
   118  	}
   119  	
   120  	/**
   121  	 *	Renvoie le nombre d'enregistrements.
   122  	 *
   123  	 *	@param resultID		Identifiant envoyé par DbReader.
   124  	 *	@return				Le nombre de résultats.
   125  	 */
   126  	public function getAffectedRows (resultID:String):Number
   127  	{
   128  		return affRows[resultID];
   129  	}
   130  	
   131  	//--------------------
   132  	// METHODES PRIVEES
   133  	//--------------------
   134  	
   135  	
   136  	//--------------------
   137  	// METHODES STATIQUES
   138  	//--------------------
   139  	/**
   140  	 *	Utilisé dans un contexte littéral
   141  	 *
   142  	 *	@return Une chaine définissant l'objet.
   143  	 */
   144  	public static function toLog():String
   145  	{
   146  		return "[Objet DbResult]";
   147  	}
   148  }
   149