v5:userguide:userguide_index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:userguide:userguide_index [2016/03/19 03:38] – [Table] mnewnham | v5:userguide:userguide_index [2020/01/13 15:50] (current) – Remove NOTOC dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <WRAP todo> | ||
- | This page is under reconstruction | ||
- | </ | ||
<WRAP right box> | <WRAP right box> | ||
[[v5: | [[v5: | ||
</ | </ | ||
- | ~~NOTOC~~ | ||
====== User Guide ====== | ====== User Guide ====== | ||
===== List Of Tutorials ===== | ===== List Of Tutorials ===== | ||
==== Basic Tasks ==== | ==== Basic Tasks ==== | ||
- | |[[v5: | + | < |
- | |[[v5: | + | <wrap left 180px>[[v5: |
- | |[[v5: | + | <wrap left 450px>Using basic ADOdb commands to read data from and write back to the database</ |
+ | </ | ||
+ | -------------------------- | ||
+ | < | ||
+ | <wrap left 180px>[[v5: | ||
+ | <wrap left 450px>How to obtain information about database fields, columns and tables</ | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px>[[v5: | ||
+ | <wrap left 450px>Understanding how to work with the most detailed level of data provided by ADOdb</ | ||
+ | </ | ||
+ | ------------------------------- | ||
==== Advanced Tasks ==== | ==== Advanced Tasks ==== | ||
- | | [[v5: | + | < |
- | | [[v5: | + | <wrap left 180px>[[v5: |
- | | [[v5: | + | <wrap left 450px>Understanding Transaction scope, and how to start, stop and roll back transactions |
- | ===== Additional Documentation ===== | + | </ |
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px>[[v5: | ||
+ | <wrap left 450px>Controlling connections and transaction | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | --------------------------- | ||
+ | < | ||
+ | <wrap left 180px>[[v5: | ||
+ | <wrap left 450px>Adding new functionality and changing the behaviour of existing drivers</ | ||
+ | </ | ||
+ | -------------------------- | ||
- | [[v5: | ||
- | [[project: | ||
- | [[v5: | ||
- | [[v5: | ||
- | [[v5: | ||
- | [[v5: | ||
- | [[v5: | ||
- | |||
- | |||
- | |||
- | ===== Example 3: Inserting ===== | ||
- | |||
- | Insert a row to the Orders table containing dates and strings that need to be quoted before they can be accepted by the database, eg: the single-quote in the word John' | ||
- | |||
- | <code php> | ||
- | include(' | ||
- | $conn = adoONewConnection(' | ||
- | $conn-> | ||
- | |||
- | /* | ||
- | * Inserting a string containing quote characters | ||
- | * may cause a statement to fail if not pre-processed | ||
- | */ | ||
- | $shipto = $conn-> | ||
- | $orderDate = $conn-> | ||
- | |||
- | $sql = " | ||
- | $sql .= " | ||
- | |||
- | if ($conn-> | ||
- | print 'error inserting: ' | ||
- | |||
- | </ | ||
- | |||
- | In this example, we see the advanced date and quote handling facilities of ADOdb. The unix timestamp (which is a long integer) is appropriately formatted for Access with [[v5: | ||
- | |||
- | The correct escape character is used for quoting the John's Old Shoppe, which is John``s Old Shoppe and not PHP's default John's Old Shoppe by using [[v5: | ||
- | |||
- | Observe the error-handling of the Execute statement. False is returned by Execute() if an error occurred. The error message for the last error that occurred is displayed in [[v5: | ||
- | |||
- | ===== Example 4: Debugging ===== | ||
- | |||
- | <code php> | ||
- | include ' | ||
- | $conn = adoNewConnection(' | ||
- | |||
- | $conn-> | ||
- | $shipto = $conn-> | ||
- | |||
- | $sql = " | ||
- | values (' | ||
- | |||
- | $conn-> | ||
- | |||
- | if ($conn-> | ||
- | </ | ||
- | |||
- | |||
- | In the above example, we have turned on debugging by setting debug = true. This will display the SQL statement before execution, and also show any error messages. There is no need to call ErrorMsg() in this case. For displaying the recordset, see the rs2html() example. | ||
- | |||
- | For more detailed information on error handling, see the section on [[v5: | ||
- | |||
- | |||
- | ===== Example 6: Connecting to 2 Databases At Once ===== | ||
- | In this example we maintain connections to 2 databases at the same time. The transactional status of each database is managed independantly, | ||
- | |||
- | <code php> | ||
- | |||
- | include ' | ||
- | |||
- | $conn1 = adoNewConnection(' | ||
- | $conn2 = adoNewConnection(' | ||
- | |||
- | $conn1-> | ||
- | $conn2-> | ||
- | |||
- | $conn1-> | ||
- | $conn2-> | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | ===== $ADODB_FORCE_TYPE ===== | ||
- | The behaviour of [[v5: | ||
- | |||
- | ===== Example 8: Implementing Scrolling with Next and Previous ==== | ||
- | |||
- | The following code creates a very simple recordset pager, where you can scroll from page to page of a recordset. | ||
- | |||
- | <code php> | ||
- | include_once(' | ||
- | |||
- | include_once(' | ||
- | |||
- | session_start(); | ||
- | $db = NewADOConnection(' | ||
- | $db-> | ||
- | $sql = " | ||
- | |||
- | $pager = new ADODB_Pager($db, | ||
- | |||
- | $pager-> | ||
- | |||
- | </ | ||
- | This will create a basic record pager that looks like this: | ||
- | |||
- | |< << | ||
- | | ||
- | ^ID^First Name^Last Name^Date Created^ | ||
- | |36|Alan|Turing|Sat 06, Oct 2001| | ||
- | |37|Serena|Williams|Sat 06, Oct 2001| | ||
- | |38|Yat Sun|Sun|Sat 06, Oct 2001| | ||
- | |39|Wai Hun|See|Sat 06, Oct 2001| | ||
- | |40|Steven|Oey|Sat 06, Oct 2001| | ||
- | |||
- | Page 8/10 | ||
- | |||
- | The number of rows to display at one time is controled by the Render($rows) method. If you do not pass any value to Render(), ADODB_Pager will default to 10 records per page. | ||
- | |||
- | You can control the column titles by modifying your SQL (supported by most databases): | ||
- | |||
- | <code php> | ||
- | $sql = ' | ||
- | | ||
- | | ||
- | | ||
- | from adoxyz'; | ||
- | </ | ||
- | |||
- | The above code can be found in the adodb/ | ||
- | |||
- | You can also allow display of html by setting $pager-> | ||
- | |||
- | Some of the code used here was contributed by Iván Oliva and Cornel G. | ||
+ | ===== Additional Documentation ===== | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px>A guide to establishing connections across the supported databases</ | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ----------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ | ||
+ | ---------------------------- | ||
+ | < | ||
+ | <wrap left 180px> | ||
+ | <wrap left 450px> | ||
+ | </ |
v5/userguide/userguide_index.txt · Last modified: 2020/01/13 15:50 by dregad