A knowledge to manage data transaction between devices or platform and understanding needs & purposes of data transaction.
Fulfilling safeness & effectiveness of data transaction.
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
Overview to Data Transaction Management
1. -Overview-
Data Transaction Management
(DTM)
Mr Hery
Dedicated to:
HIT Development Team
http://heryit.esy.es/hitworkstation
Hery Intelligent Technology® JM0670283-X
+60 17-768 1939 / +60 19-709 4691
2. What is DTM?
• A knowledge to manage data transaction between devices or
platform
• Understanding needs & purposes of data transaction
• Fulfilling safeness & effectiveness of data transaction
3. What is Data Transaction
• Transfer and receive data between devices or platform
• Commonly used transaction between Database Server and Client
Application (mobile app, desktop app, website)
MySQL
Database
Desktop
App
Mobile
App
Internet
5. Direct Port Connection Technique
• Connection between devices or platform direct to Database Server
• Commonly used in Web Application
• Example;
• Connection between PHP and MySQL Database.
• Client Application need a package installation of Database driver
• Example;
• Android (ART), Xamarin, Classic Windows etc.
• Example;
• Bluetooth, LAN Connection, InfraRed
6. How Direct Port Connection works?
• Example in PHP with MySQL Database (mysqli method)
Connect PHP to MySQL Database:
$conn = mysqli_connect(“database.host”, “db_username”, “db_password”, “db_name”);
//this method declared that $conn is a MySQL Connection
Querying SQL
$query = mysqli_query($conn, “SELECT * FROM users”);
//this method declared $query as an execution of a SQL Statement
//mysqli_query method require a MySQL Connection - $conn
Fetching Data (print out data) from SQL Query as an Array
$fetch = mysqli_fetch_array($query);
//mysqli_fetch method require a MySQL Query - $query
MySQL
Database
Apache PHP
Server
7. How Direct Port Connection works?
• Example in PHP with MySQL Database (mysqli method)
Fetching Data (print out data) from SQL Query as an Object
$fetch = mysqli_fetch_object($query);
//mysqli_fetch method require a MySQL Query - $query
Echo / Print out fetched data Array
echo $fetch[“column_name”];
//print single raw data
echo var_dump($fetch);
Echo / print out fetched data Object
echo $fetch->column_name;
//print single raw data
8. How Direct Port Connection works?
• Example in PHP with MySQL Database (mysqli method)
Generating JSON Data from fetched data Object (single data)
json_encode($fetch);
//Encoding fetch data object to JSON Data
//”echo json_encode()” can be use to print out fetched JSON Data
Generating JSON Data from fetched data Object (multiple data)
while($fetch = mysqli_fetch_object($query)){
$jsonArray[] = $fetch;
//create an Array of multiple Objects
}
json_encode($jsonArray);
//”echo json_encode($jsonArray)” can be use to print out fetched JSON Data
9. Webservice Technique
• Data Transaction between devices or platform via Webservice
• Transferring text-based data (such as JSON, XML, etc.)
• This technique does not require any installation on Client Application.
• Require HTTP Request method only.
10. Understanding Webservice
• Client Application send data (called parameter) called Request
• Client Application receive data (JSON Data) called Response
MySQL
Database
Desktop
App
Mobile
App
Internet
(Webservice)
Request
Response
11. Understanding Webservice
• Request (Header) Type
• GET
• Request GET parameter send via URL
• http://localhost.domain/index.php?user=aiman
• GET parameter is “user” and the value is “aiman”
• Multiple parameter send separate by “&” sign
(?user=aiman&age=18&address=Kluang..)
• POST
• Request POST parameter send via form-data
• This POST Request made secretly by the codes behind the web
12. Understanding Webservice
• PHP Handling GET Request
Read GET request parameter
$user = $_GET[“user”];
echo $user;
//data printed will be “aiman”
Read POST request parameter
$user = $_POST[“user”];
echo $user;
//data printed will be “aiman”
13. Understanding Webservice
• Generate JSON Data Response from Request Parameter with MySQL
Request : GET ?content=list&type=user
$type = $_GET[“type”];
$content = $_GET[“list”];
switch($content){
case “list”:
$sql = “SELECT * FROM $type”; //create SQL Statement
break;
}
$query = mysqli_query($conn, $sql); //create executed Query
while($fetch = mysqli_fetch_object($query)){ //fetching Data
$jsonArray[] = $fetch; //create Array of Objects
}
echo json_encode($jsonArray); //generate JSON Object from fetched Data