Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
RoutineAnalyzer::RoutineBase Class Reference

Implements the core functionality of logically representing a SQL procedure Child classes of this base implement specific logic to each code type. More...

Inheritance diagram for RoutineAnalyzer::RoutineBase:

List of all members.

Public Member Functions

abstract string GetCode ()
 Should implement creation of the defintion.
abstract string GetDeclaration ()
 Should implement creation of the declaration.
 RoutineBase (string sql)
 Constructor Parses the SQL, creating the parameter objects for this Routine.

Protected Member Functions

abstract RoutineParamBase CreateRoutineParam (string sql, int index)
 Implements generating of objects for parameters, these will be children of RoutineParamBase.

Protected Attributes

string _name
List< RoutineParamBase_params = new List<RoutineParamBase>()
string _sql

Private Member Functions

void FindAndCreateRoutineParams (string declaration, int startOfParams)
 looks within the declaration and instantiates one RoutineParamDesc per parameter
int FindName (string declaration)
 Looks within the declaration and pulls out the name.
void ParseDeclaration (string declaration)
 Handles the two part step of finding the name and creating the parameters descriptions.

Detailed Description

1) Saves the SQL for the routine declaration 2) Pulls out the SPROC name 3) Iterates over each SPROC parameter, passing them in as parameters

Definition at line 14 of file RoutineBase.cs.


Constructor & Destructor Documentation

RoutineAnalyzer::RoutineBase::RoutineBase ( string  sql) [inline]
Parameters:
sql

Definition at line 31 of file RoutineBase.cs.

References _sql, and ParseDeclaration().

        {
            _sql = sql;
            ParseDeclaration(_sql);
        }

Member Function Documentation

abstract RoutineParamBase RoutineAnalyzer::RoutineBase::CreateRoutineParam ( string  sql,
int  index 
) [protected, pure virtual]
void RoutineAnalyzer::RoutineBase::FindAndCreateRoutineParams ( string  declaration,
int  startOfParams 
) [inline, private]
Parameters:
declaration
startOfParams

Definition at line 65 of file RoutineBase.cs.

References _params, and CreateRoutineParam().

Referenced by ParseDeclaration().

        {
            //pull out the arguents and pass them off to create our param list
            int endOfParams = declaration.LastIndexOf(")");
            string args = declaration.Substring(startOfParams + 1, endOfParams - startOfParams - 1);
            string[] allArgs = args.Split(',');
            for(int i=0; i<allArgs.Length; ++ i)
            {
                RoutineParamBase param = CreateRoutineParam(allArgs[i], i);
                _params.Add(param);
            }
        }
int RoutineAnalyzer::RoutineBase::FindName ( string  declaration) [inline, private]
Parameters:
declaration
Returns:

Definition at line 53 of file RoutineBase.cs.

References _name.

Referenced by ParseDeclaration().

        {
            int startOfParams = declaration.IndexOf("(");
            _name = declaration.Substring(0, startOfParams);
            return startOfParams;
        }
abstract string RoutineAnalyzer::RoutineBase::GetCode ( ) [pure virtual]
abstract string RoutineAnalyzer::RoutineBase::GetDeclaration ( ) [pure virtual]
void RoutineAnalyzer::RoutineBase::ParseDeclaration ( string  declaration) [inline, private]
Parameters:
declaration

Definition at line 41 of file RoutineBase.cs.

References FindAndCreateRoutineParams(), and FindName().

Referenced by RoutineBase().

        {
            //pull out the name
            int startOfParams = FindName(declaration);
            FindAndCreateRoutineParams(declaration, startOfParams);
        }

Member Data Documentation

Definition at line 18 of file RoutineBase.cs.

Referenced by RoutineBase().


The documentation for this class was generated from the following file:

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net