* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Project Report
Survey
Document related concepts
Microsoft Access wikipedia , lookup
Concurrency control wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Relational algebra wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Ingres (database) wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Clusterpoint wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Relational model wikipedia , lookup
Transcript
SQL Engine API Description DB Manipulation Methods. Following is a method specification for all significant methods contained by the SQL Engine object : Name: createUpdateQuery Parameters: EngineUpdateQuery engQuery Returns: An integer signifying the number of rows updated by the procedure. Description: Executes an update query according to the fields and values specified in the engQuery parameter. The method will generate the SQL update query using the metadata stored on the server. Notice that this method can only update a single table/view and does not support multiple tables/views update. Nevertheless the conditions for this query can include several tables/views. Name: createInsertQuery Parameters: EngineInsertQuery engQuery Returns: A string representing the generated SQL insert query. Description: Executes an insert query according to the fields and values specified in the engQuery parameter. The method will generate the SQL update query using the metadata stored on the server. Notice that this method can only insert into a single table/view and does not support multiple tables/views insertion. Nevertheless the conditions for this query can include several tables/views. Name: createSelectQuery Parameters: EngineQuery engQuery Returns: An ArrayList object representing the given query results. The ArrayList is compiled of sub ArrayLists. Every sub ArrayList represents a row in the query result. Each Object within the sub ArrayList represents a column in the specific row represented by the sub ArrayList. Description: Generates and Executes a select query according to the data given in the engQuery parameter. The method uses the metadata stored on the server to generate the query. Name: getSortBy Parameters: ArrayList fields Returns: A string representing the “order by” part of the generated SQL query. Description: Generates the “order by” part of the SQL query according to the fields given as a parameter. The method uses the metadata stored on the server. Name: getWhere Parameters: ArrayList tablesNum, ArrayList conditions Returns: A string representing the “where” part of the query. Generated according to the tables and conditions indicated by the parameters. Description: Uses the given tables and conditions to generate the “where” part of the query. Uses the metadata stored on the server to generate the string. This return string will include the joins between the tables and the specified conditions associated with these tables. Name: getFieldFullName Parameters: string fieldName Returns: A string representing the full name of the field specified as a parameter. The full name includes the table name and the field name as they appear in the physical database. Description: Queries the metadata database in order to find the physical table and field name to use in subsequent queries. Name: getFieldFullName Parameters: int fieldId Returns: A string representing the full name of the field specified as a parameter. The full name includes the table name and the field name as they appear in the physical database. Description: Queries the metadata database in order to find the physical table and field name to use in subsequent queries. Name: getConStr Parameters: string fieldName Returns: A string representing the connection string that will be used to access the database which holds the field given as a parameter. Description: This method will query the metadata database in order to find the specified field’s associated physical database. Following the physical database name extraction the method will query the connection string that will be used later on the execute the queries. Name: executeMetadataQuery Parameters: string metaQuery Returns: An ArrayList representing the metadata SQL query’s results Description: This method will generate and execute a metadata query. The query is given as a standard SQL query and will not be formatted by the method. The method will execute the given query on the metadata database located on the server. Name: executeRemoteQuery Parameters: string metaQuery, string conStr Returns: An ArrayList representing the result of the given SQL query. The ArrayList is compiled of sub ArrayLists. Every sub ArrayList represents a row in the query result. Each Object within the sub ArrayList represents a column in the specific row represented by the sub ArrayList. Description: This method will generate and execute a query on the remote database. The query is given as a standard SQL query and will not be formatted by the method. The method will execute the given query on the remote database using the connection string given as a parameter. Name: executeRemoteChange Parameters: string metaQuery, string conStr Returns: An integer representing the number of rows affected by the query. Description: This method will generate and execute an insert/update query on the remote database. The query is given as a standard SQL query and will not be formatted by the method. The method will execute the given query on the remote database using the connection string given as a parameter. Name: getAllFields() Parameters: Returns: An ArrayList object containing all the fields in the system. Description: This method will query the metadata database in order to find all the field available for the user. The method will return the fields’ “friendly” name for later use. This method uses the metadata database located on the server. Name: getFieldTableName Parameters: string fieldName Returns: A string representing the physical table name that contains the field given as a parameter. Description: This method will query the metadata database and return the physical table name that contains the field given as a parameter. This method uses the metadata database located on the server. Name: getFieldTableId Parameters: string fieldName Returns: An integer representing the physical table id that contains the field given as a parameter. Description: This method will query the metadata database and return the physical table id that contains the field given as a parameter. This method uses the metadata database located on the server. Name: getFieldGivenName Parameters: int fieldId Returns: A string representing the “friendly” name of the field given as a parameter. Description: This method will query the metadata database in order to find the “friendly” name associated with the field id given as a parameter. This method uses the metadata database stored on the server. Name: getTableFullName Parameters: int tableId Returns: A string representing the name of the physical table given as a parameter. Description: This method will use the metadata database stored on the server to find the physical name of the table specified in the parameter as a table id. Name: getJoins Parameters: ArrayList tables Returns: A string representation of the “join” part in the “where” section of the query. Description: This method will query the metadata database stored on the server in order to find the necessary join conditions, which will join the tables stored in the ArrayList object given as a parameter. This method will return a string that should be combined into the “where” section of the query. Name: getInnerJoins Parameters: ArrayList tables Returns: A string representation of the “join” part in the “select” section of the query. Description: This method will query the metadata database stored on the server in order to find the necessary join conditions, which will join the tables stored in the ArrayList object given as a parameter. This method will return a string that should be combined into the “select” section of the query. Web-service user Methods. Name: public ArrayList AvilableFields() Parameters: None. Returns: an ArrayList which contains all of the Available fields. Description: this function returns all of the available fields of the Current DB, all fields are returned as an Array list which is encapsulated in a SOAP envelop. [ Name: public ArrayList ProcessQuery(string Query) Parameters: string Query, which represents the Query to the DB. Returns: an array list which contains all of the Wanted Fields. Description: this is actually a function which allows to perform "select" queries: this Method phrase the Presented Query, sends it to the DB, and returns the answer to the User encapsulated in a SOAP envelop ** Presented Query should be of following Format: " SELECT field-1 .. field-n WHERE cond-1....cond-n <ORDER value1....value-n>" where uppercase words are obligatory words in the command format lowercase words represent user values <> is optional filed Name: public int UpdateQuery(string Query) Parameters: string Query, which represents the Query to the DB. Returns: an array list which contains all of the Wanted Fields. Description: this function allows updating any Desired Field at the DB. **Presented Query should be of following Format: " VALUE val <CONDITION cond>" where uppercase words represent Obligatory words < > represent nonObligatory words lowercase words represent user strings/values [ Name: public int InsertNewQuery(string Query) Parameters: string Query, which represents the Query to the DB. Returns: an array list which contains all of the Wanted Fields. Description: this method will allow inserting a new field into the DB **Presented Query should be of following Format: "INSERT field VALUE val" where uppercase words are obligatory words in the command format lowercase words represent user values