Presentation is loading. Please wait.

Presentation is loading. Please wait.

CF Database I Jeff Peters Why Are You Here? Data and Persistence ODBC Relational vs. Flat SQL CFQUERY, CFOUTPUT, CFLOOP Practicum.

Similar presentations


Presentation on theme: "CF Database I Jeff Peters Why Are You Here? Data and Persistence ODBC Relational vs. Flat SQL CFQUERY, CFOUTPUT, CFLOOP Practicum."— Presentation transcript:

1 CF Database I Jeff Peters jeff@grokfusebox.com

2 Why Are You Here? Data and Persistence ODBC Relational vs. Flat SQL CFQUERY, CFOUTPUT, CFLOOP Practicum

3 Data and Persistence Persistence = Turn off, turn on—data still there. Secondary storage (disk or other nonvolatile) DBMS Excel Text file

4 ODBC Open DataBase Connectivity Allows a common interface to many databases. Does not homogenize SQL Must be configured on the CF server

5 Relational vs. Flat Relational: Tables may be linked (related) to make storage more efficient. E.F. Codd Flat: Tables cannot be linked. Think of a spreadsheet.

6 CFQUERY Allows any SQL statement to be run. Returns a recordset depending on SQL. Can pass authentication attributes: USERNAME PASSWORD Can cache data for better performance.

7 CFOUTPUT Refers to a CFQUERY recordset to generate output to the browser. May be nested using the GROUP attribute. May NOT be nested without the GROUP attribute (see CFLOOP).

8 CFLOOP Refers to a CFQUERY recordset; does not produce output to the browser. CFLOOP may also be used for incremental loops, lists, and objects—not the scope of this session.

9 SQL Structured Query Language Common syntax for interacting with a database. (Beware variations) SELECT, INSERT, UPDATE, DELETE More complex commands available; related to DBA functions.

10 Caching Queries Improves performance by storing data in server memory. Implemented through CFQUERY CACHEDWITHIN attribute

11 Practicum – ODBC MS Access: CFDB101 webroot\cfun03\CFDB101.mdb MS Excel: CFDB101Excel webroot\cfun03\Members.xls Text File: CFDB101Text webroot\cfun03\TextDB\Members

12 Practicum – CFQUERY SELECT INSERT DELETE UPDATE

13 Practicum – CFQUERY SELECT SELECT memberNumber, lastName, firstName, email, phone, memberSince FROM Members

14 Practicum – CFQUERY SELECT

15 Practicum – CFQUERY INSERT INSERT INTO Members ( memberNumber, lastName, firstName, email, phone, memberSince ) VALUES ( 4, 'Adams', 'John Q.', 'jqada@grokfusebox.com', '7035554444', #CreateODBCDate(Now())# )

16 Practicum – CFQUERY INSERT

17 Practicum – CFQUERY DELETE DELETE FROM Members WHERE memberNumber = '4'

18 Practicum – CFQUERY DELETE

19 Practicum – CFQUERY UPDATE UPDATE Members SET phone = '7035551212' WHERE memberNumber = '1'

20 Practicum – CFQUERY UPDATE

21 Practicum – CFOUTPUT SELECT lastName, firstName, memberSince FROM Members ORDER BY memberSince #DateFormat(memberSince,"mm/dd/yyyy")# : #firstName# #lastName#

22 Practicum – CFOUTPUT

23 Practicum – CFLOOP SELECT lastName, firstName, memberSince FROM Members ORDER BY memberSince #firstName# #lastName# - Member for #memberYears# years.

24 Practicum – CFLOOP Thomas Jefferson - Member for 226 years. John Adams - Member for 226 years. George Washington - Member for 226 years.

25 Practicum – Caching <cfquery name="qryGetMembers" datasource="CFDB101" dbtype="ODBC" cachedwithin="#CreateTimeSpan(1, 0, 0, 0)#"> SELECT memberNumber, lastName, firstName, email, phone, memberSince FROM Members

26 Bonus – Aqua Data Studio http://www.aquafold.com Interfaces with DB2, Informix, MySQL, Oracle, PostgreSQL, SQL Server, SyBase, any JDBC source.

27 Q & A


Download ppt "CF Database I Jeff Peters Why Are You Here? Data and Persistence ODBC Relational vs. Flat SQL CFQUERY, CFOUTPUT, CFLOOP Practicum."

Similar presentations


Ads by Google