Detailed instructions for use are in the User's Guide.
[. . . ] ---Return a page of numRows number of records as an array or query from the database for this startRow. Add authorization or any logical checks for secure access to your data ---> <!--- Auto-generated method Retrieve set of records and return them as a query or array. Add authorization or any logical checks for secure access to your data ---> <cfset var qAllItems=""> <cfquery name="qAllItems" datasource="employees"> SELECT * FROM employees </cfquery> <cfreturn qAllItems> </cffunction> <cffunction name="getemployees" output="false" access="remote" returntype="any" > <cfargument name="emp_no" type = "numeric" required="true" /> <! [. . . ] * * Add authroization or any logical checks for secure access to your data * * @return array */ public function getEmployees_paged($startIndex, $numItems) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?* * Authenticate the user prior to allowing them to call these methods. */ class EmployeeServiceDM { var var var var var var $username = "root"; $password = "root"; $server = "localhost"; $port = "3306"; $databasename = "employees"; $tablename = "employees";
var $connection; /** * The constructor initializes the connection to database. Everytime a request is * received by Zend AMF, an instance of the service class is created and then the * requested method is invoked. */ public function __construct() { $this->connection = mysqli_connect( $this->server, $this->username, $this->password, $this->databasename, $this->port ); $this->throwExceptionOnError($this->connection); } /** * Returns all the rows from the table. * * Add authroization or any logical checks for secure access to your data * * * @return stdClass */ public function getEmployeesByID($itemID) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where emp_no=?"); $this->throwExceptionOnError(); mysqli_bind_param($stmt, 'i', $itemID); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_bind_result($stmt, $row->emp_no, $row->birth_date, $row->first_name, $row->last_name, $row->gender, $row->hire_date); if(mysqli_stmt_fetch($stmt)) { return $row; } else { return null; } } /** * Returns the item corresponding to the value specified for the primary key. )"); $this->throwExceptionOnError(); mysqli_bind_param($stmt, 'isssss', $item->emp_no, $item->birth_date $item->first_name, $item->last_name, $item->gender, $item->hire_date); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); $autoid = mysqli_stmt_insert_id($stmt); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $autoid; } /** * Updates the passed item in the table. * * Add authroization or any logical checks for secure access to your data * * @param stdClass $item * @return void */ public function updateEmployees($item) { $stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET emp_no=?"); $this->throwExceptionOnError(); mysqli_bind_param($stmt, 'isssssi', $item->emp_no, $item->birth_date, $item->first_name, $item->last_name, $item->gender, $item->hire_date, $item->emp_no); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); } /** * Deletes the item corresponding to the passed primary key value from * the table. "); $this->throwExceptionOnError(); mysqli_bind_param($stmt, 'i', $itemID); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); } /** * Utitity function to throw an exception if an error occurs * while running a mysql command. * Use these functions as a starting point for creating your own service implementation. */ class EmployeeService { var var var var var var $username = "admin2"; $password = "Cosmo49"; $server = "localhost"; $port = "3306"; $databasename = "employees"; $tablename = "employees";
var $connection; /** * The constructor initializes the connection to database. Everytime a request is * received by Zend AMF, an instance of the service class is created and then the * requested method is called. * * Add authroization or any logical checks for secure access to your data * * @return array */ public function getAllDepartments() { $stmt = mysqli_prepare($this->connection, "SELECT * FROM departments"); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); $rows = array(); mysqli_stmt_bind_result($stmt, $row->dept_no, $row->dept_name); while (mysqli_stmt_fetch($stmt)) { $rows[] = $row; $row = new stdClass(); mysqli_stmt_bind_result($stmt, $row->dept_no, $row->dept_name); } mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $rows; } public function getEmployeesByDept($deptId) { $stmt = mysqli_prepare($this->connection, "select employees. * * Add authroization or any logical checks for secure access to your data * * * @return stdClass */ public function getEmployeesByID($itemID) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM employees where emp_no=?"); $this->throwExceptionOnError(); mysqli_bind_param($stmt, 'i', $itemID); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_bind_result($stmt, $row->emp_no, $row->birth_date, $row->first_name, $row->last_name, $row->gender, $row->hire_date); if(mysqli_stmt_fetch($stmt)) { return $row; } else { return null; } }
/** * Updates the passed item in the table. AddHeader(header2); // Within the addSimpleHeader method, which adds a SOAP header to all // web service requests, create SOAPHeader and QName objects. Public function onLoginResult(event:ResultEvent):void { //Extract the new service endpoint from the login result. ServerUrl; // Redirect all service operations to the URL received in the login result. Définition du schéma XML Eléments de niveau supérieur xsd:element nillable == true xsd:element fixed !Same", "qname"); var typeReg1:SchemaTypeRegistry = new SchemaTypeRegistry(); var typeReg2:SchemaTypeRegistry = new SchemaTypeRegistry(); typeReg1. [. . . ] ResultEvent; private function onResult(event:ResultEvent):void { // A DataTable or DataSet returned from a . Tables) { displayTable(table); } // Alternatively, if a table's name is known beforehand, // it can be accessed using this syntax: var namedTable:Object = event. Customers; //displayTable(namedTable); } } private function displayTable(tbl:Object):void { var dg:DataGrid = new DataGrid(); dataPanel. AddChild(dg); // Each table object from the "Tables" map contains two properties: // "Columns" and "Rows". [. . . ]