MySQL API( c ) & SQL2 강동훈.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizards Guide to PHP by David Lash.
Advertisements

PHP II Interacting with Database Data. The whole idea of a database-driven website is to enable the content of the site to reside in a database, and to.
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
COMP 5531 Introduction to MySQL. SQL SQL is a standard language for accessing and managing databases. SQL stands for Structured Query Language.
介紹 元智大學電機工程所 碩士班一年級 蕭觀華 學號 : MySQL 介紹大綱 What is MySQL ? How to install on Linux Tutorial Introduction Database Administration MySQL Perl API Q&A.
How to Use MySQL CS430 March 18, SQL: “Structured Query Language”—the most common standardized language used to access databases. SQL has several.
Objectives Connect to MySQL from PHP
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
7/8/05MySQL David Lawrence1 David Lawrence, JLab An introduction for the novice.
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
Slide 8-1 CHAPTER 8 Using Databases with PHP Scripts: Using MySQL Database with PHP.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
Python MySQL Database Access
Dbwebsites 2.1 Making Database backed Websites Session 2 The SQL… Where do we put the data?
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Ways to manage DB in MySQL cs346. Six ways to CREATE and INSERT INTO tables Modelocalremotelocalremotewindow WhereMysql console Putty; Mysql console Mysql.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Chapter 6 PHP Interacts with Mysql Database. Introduction In PHP, there is no consolidated interface. Instead, a set of library functions are provided.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
MySQL Database Connection
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
Chapter 5 MYSQL Database. Introduction to MYSQL MySQL is the world's most popular open-source database. Open source means that the source code, the programming.
Most information comes from Chapter 3, MySQL Tutorial: 1 MySQL: Part.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
Visual Programing SQL Overview Section 1.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Module Review Basic SQL commands: Create Database, Create Table, Insert and Select 2. Connect an SQL Database to PHP 3. Execute SQL Commands in.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
SQL Overview Structured Query Language. Description  When Codd first described the theory of relational databases, he asserted that there should be a.
SQL has several parts: Major ones: DDL – Data Definition Language {Defining, Deleting, Modifying relation schemas} DML – Data Manipulation Language {Inserting,
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
Chungbuk HRDI of KCCI PhD Kang,Won-Chan PHP Programming (MySQL)
There are two types of MySQL instructions (Data Definition Language) DDL: Create database, create table, alter table,,,. (Data Manipulation Language) DML.
Mysql YUN YEO JOONG. 1 Connecting to and Disconnecting from the Server 1 Connecting to and Disconnecting from the Server shell> mysql – h host -u user.
SQL. What is a database? G a collection of data G Usually consists of entities and relations G An entity is an individual “object” that exists and is.
Working with MySQL A290/A590, Fall /07/2014.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
PHP-language, database- programming Teppo Räisänen Oulu University of Applied Sciences School of Business and Information Management.
CS 3630 Database Design and Implementation
Chapter 5 Introduction to SQL.
Introduction to MySQL.
Unix System Administration
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
PHP-language, database-programming
Chapter 8 Working with Databases and MySQL
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
Web Programming Language
CS122 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS122 Using Relational Databases and SQL
JDBC II IS
Presentation transcript:

MySQL API( c ) & SQL2 강동훈

Contents Overview How to use MySQL(SQL2) How to use MySQL API (in C)

Overview SQL Structured Query Language based on the relational database. Data definition Data manipulation Query MySQL

How to use MySQL #1 Connect to MySQL Server shell> mysql -h host -u user -p password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 459 to server version: a-log Type 'help' for help. mysql>

How to use MySQL #2 Data Definition 1 mysql> SHOW DATABASES; Database mysql test tmp

How to use MySQL #3 Data Definition 2 mysql> CREATE DATABASE docmanager; mysql> USE docmanager Database changed mysql> SHOW TABLES; Empty set (0.00 sec) mysql> 형식 : CREATE DATABASE ; USE

How to use MySQL #4 Data definition 3 mysql> CREATE TABLE docmanager (title VARCHAR(40), description -> VARCHAR(40),file_name VARCHAR(20), -> enrolled DATE, updated DATE, owner VARCHAR(20)); (CF) desc 형식 : CREATE TABLE 테이블명(컬럼의 형식);

How to use MySQL #5 Data Manipulation 1 mysql> INSERT INTO docmanager -> VALUES( ‘ MySQL Seminar', ‘ MySQL?', ‘ MySQL.ppt', ‘ ‘ > 04', ’ ’, ‘ please ’ ); mysql> UPDATE docmanager SET updated= “ " WHERE title= “ MySQL Seminar"; 형식: INSERT INTO 테이블명 VALUES(컬럼의 데이터 값..); UPDATE 테이블명 SET 컬럼명 = 식,… [WHERE 조건];

How to use MySQL #5 Data manipulation 2 mysql> SELECT * FROM docmanager; mysql> SELECT * FROM docmanager WHERE owner = “ please"; mysql> SELECT owner FROM docmanager; 형식: SELECT 컬럼명 … from 테이블명 [WHERE 조건]; titledecriptionfile_nameenrolledupdatedowner MySQL Seminar MySQL?MySQL.ppt please

How to use MySQL API(in C) #1 Process 1.connect to SQL server 2.Quest Queries 3.manipulate result sets

How to use MySQL API(in C) #2 Mysql_init() Mysql_real_connect() Mysql_query()Mysql_real_query() If result set exists(only to “SELECT” Query) Mysql_store_result()Mysql_use_result() Mysql_fetch_row() Mysql_free_result() Mysql_close()

#include #include "mysql.h “ Int main() { MYSQL mysql; MYSQL_RES *myresult; MYSQL_ROW row; unsigned int num_fields; unsigned int num_rows; char * string_query; mysql_init(&mysql); mysql_real_connect(&mysql,"localhost","please", “ ********","please,0,NULL,0); string_query = "select * from docmanager\n"; mysql_query(&mysql,string_query); myresult = mysql_store_result(&mysql); while(row = mysql_fetch_row(myresult)) printf("%s\t %s\n",row[0],row[1]); mysql_free_result(myresult); mysql_close(&mysql); return 0; } Gcc –g –o mysqlapiexample mysqlapiexample.c –L/usr/lib/mysql –lmysqlclient

How to use MySQL API(in C) #4 functionprototype mysql_init() MYSQL *mysql_init(MYSQL *mysql) mysql_real_connect() MYSQL *mysql_real_connect(MYSQL *mysql,const char *host,const char *user,const char *passwd,const char *db, uint port,const char *unix_socket,uint client_flag) mysql_query() Int mysql_query(MYSQL *mysql,const char * query) mysql_real_query() Int mysql_real_query(MYSQL *mysql,const char * query, unsigned int length) mysql_store_result() MYSQL_RES *mysql_store_result(MYSQL *mysql) mysql_use_result() MYSQL_RES *musql_use_result(MYSQL *mysql) mysql_fetch_row() MYSQL_ROW mysql_fetch_row(MYSQL_RES *result) mysql_free_result() Void mysql_free_result(MYSQL_RES *result) mysql_close() Void mysql_close(MYSQL *mysql)  C API Function Description