Introduction to File Processing with PHP

Introduction to File Processing with PHP Introduction to File Processing with PHP - Start

2016-09-06 98K 98 0 0

Introduction to File Processing with PHP - Description

. Review of Course . Outcomes. 1. . Implement file reading and writing programs using PHP.. 2. Identify . file access schemes, . including: . . sequential. . file access . . direct file access. ID: 461642 Download Presentation

Download Presentation

Introduction to File Processing with PHP




Download Presentation - The PPT/PDF document "Introduction to File Processing with PHP" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.



Presentations text content in Introduction to File Processing with PHP

Slide1

Introduction to File Processing with PHP

Slide2

Review of Course Outcomes

1

. Implement file reading and writing programs using PHP.

2. Identify

file access schemes,

including:

sequential

file access

direct file access

indexed

sequential file access.

3. Describe file-sorting and file-searching techniques.

4. Describe data compression and encryption techniques.

5. Design a rational database using E-R modeling techniques.

6. Build a relational database.

7. Write database queries using SQL.

8. Implement a web-based relational database using MySQL.

Slide3

File Structures

File Structures are

persistent

data structures

Files composed of records

Records composed of fields

Files can be viewed as tables

File

->

Table

Record

->

Row

Field

->

Column

Slide4

File Organization

The

data

is stored as a collection of

files

. Each file is a sequence of

records.

A record is a sequence of

fields

.

One approach:

assume record size is fixed

each file has records of one particular type only

this

case is easiest to implement;

we will

consider

it further

Slide5

Organization of Records in Files

Heap

– a record can be placed anywhere in the file where there is space

Sequential

– store records in sequential order,

perhaps based

on the value of the search key of each record

Indexing –

Keep two files, the Data File and an Index File and the data file. Index records hold file pointers of Data records

Hashing

– a hash function computed on some attribute of each record; the result specifies in which block of the file the record should be placed

Slide6

Fixed-Length Records

Simple approach:Store record i starting from byte n  (i – 1), where n is the size of each record.Record access is simple but records may cross blocksModification: do not allow records to cross block boundariesWays to delete record i: move records i + 1, . . ., n to i, . . . , n – 1move record n to ido not move records, but mark deleted record

Slide7

Variable-Length Records

Variable-length records arise in database systems in several ways:

Storage of multiple record types in a file.

Record types that allow variable lengths for one or more fields such as strings

Record types that allow repeating fields (used in some older data models).

We won’t talk about VL records

Slide8

Sequential File Organization

For sequential processing of entire file Records ordered by a search-key

Slide9

Sequential File Organization

Deletion – use pointer chainsInsertion –locate the position where the record is to be insertedif there is free space insert there if no free space, insert the record in an overflow blockIn either case, pointer chain must be updatedNeed to reorganize the file from time to time to restore sequential order

Slide10

The CRUD paradigm

Open the current version of a file

Process it using the CRUD operations

Create records

Retrieve records

Update records

Delete records

Output and close the new version of the file

Slide11

Implementing CRUD paradigm in PHP

Use PHP file functions

There a many of them

We will start with a simple subset that are similar to file functions used in C and in other C-based languages

Slide12

The PHP filesystem functions

http://us2.php.net/manual/en/ref.filesystem.php

Slide13

A C-like subset

fopen

http://us2.php.net/manual/en/function.fopen.php

fgets

http://us2.php.net/manual/en/function.fgets.php

fwrite

http://us2.php.net/manual/en/function.fwrite.php

fclose

http://us2.php.net/manual/en/function.fclose.php

Slide14

Some PHP File Tutorials

http://www.tizag.com/phpT/files.php

http://php.about.com/od/advancedphp/ss/php_read_file_5.htm

http://www.codingunit.com/php-tutorial-file-handling

Slide15

Slide16

Slide17

Slide18


About DocSlides
DocSlides allows users to easily upload and share presentations, PDF documents, and images.Share your documents with the world , watch,share and upload any time you want. How can you benefit from using DocSlides? DocSlides consists documents from individuals and organizations on topics ranging from technology and business to travel, health, and education. Find and search for what interests you, and learn from people and more. You can also download DocSlides to read or reference later.