Detailed instructions for use are in the User's Guide.
[. . . ] Add authorization or any logical checks for secure access to your data ---> <cfset var qItem=""> <cfquery name="qItem" datasource="employees"> SELECT * FROM employees WHERE emp_no = <CFQUERYPARAM CFSQLTYPE="CF_SQL_INTEGER" VALUE="#ARGUMENTS. com/go/cf9_usersecurity ---> <cffunction name="getAllemployees" output="false" access="remote" returntype="any" > <!Add authorization or any logical checks for secure access to your data ---> <cfquery name="createItem" datasource="employees" result="result"> INSERT INTO employees (birth_date, first_name, last_name, gender, hire_date) VALUES (<CFQUERYPARAM cfsqltype="CF_SQL_DATE" VALUE="#item. --- The GENERATED_KEY is valid for mysql database only, you can modify it for your database ---> <cfreturn result. [. . . ] * * 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. "); $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); }
/** * 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. $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD); mysql_select_db( DATABASE_NAME ); // Quote variable to make safe function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (! [. . . ] EchoInt; //do something } public function faultHandler(event:FaultEvent):void { //deal with event. Element; // You could use E4X to traverse the raw fault element returned in the SOAP envelope. NET webservice is // automatically converted to an object with a "Tables" property, // which contains a map of one or more dataTables. Customers; //displayTable(namedTable); } } private function displayTable(tbl:Object):void { var dg:DataGrid = new DataGrid(); dataPanel. [. . . ]