ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:activerecord:active_record_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:activerecord:active_record_tutorial [2016/01/13 02:15] – ↷ Links adapted because of a move operation mnewnhamv5:activerecord:active_record_tutorial [2022/06/09 18:37] (current) – ↷ Links adapted because of a move operation 3.83.52.90
Line 132: Line 132:
   $person = new person();   $person = new person();
  
-===== Using $ADODB_ASSOC_CASE ==== +===== Using ADODB_ASSOC_CASE ==== 
-You can use [[reference:$ADODB_ASSOC_CASE]] to control the field names+ 
 +You can define the [[v5:reference:adodb_assoc_case]] constant to control the field names' case
  
 <code php> <code php>
-$ADODB_ASSOC_CASE = 0;+define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_LOWER); 
 +require "adodb.inc.php";
 $person = new person('People'); $person = new person('People');
 $person->name = 'Lily'; $person->name = 'Lily';
-$ADODB_ASSOC_CASE = 2;+ 
 +define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_UPPER); 
 +require "adodb.inc.php";
 $person2 = new person('People'); $person2 = new person('People');
 $person2->NAME = 'Lily'; $person2->NAME = 'Lily';
Line 162: Line 166:
 <WRAP right box 200px> <WRAP right box 200px>
 == More Information == == More Information ==
-For more information on bind variables, see [[reference:execute()]]+For more information on bind variables, see [[v5:reference:connection:execute]]
 </WRAP> </WRAP>
 ===== Loading Individual Records ===== ===== Loading Individual Records =====
Line 200: Line 204:
 </code> </code>
  
-The ADOConnection::Debug property is obeyed. So if [[reference:debug|$db->debug]] is enabled, then ADOdb_Active_Record errors are also outputted to standard output and written to the browser.+The ADOConnection::Debug property is obeyed. So if [[v5:userguide:debug|$db->debug]] is enabled, then ADOdb_Active_Record errors are also outputted to standard output and written to the browser.
  
 ===== Converting a recordset to an Active Record object ===== ===== Converting a recordset to an Active Record object =====
Line 250: Line 254:
 ===== Retrieval of Auto-incrementing ID ===== ===== Retrieval of Auto-incrementing ID =====
  
-When creating a new record, the retrieval of the last auto-incrementing ID is not reliable for databases that do not support the [[reference:insert_id()]] function call (check ''$connection->hasInsertID''). In this case we perform a +When creating a new record, the retrieval of the last auto-incrementing ID is not reliable for databases that do not support the [[v5:reference:connection:insert_id]] function call (check ''$connection->hasInsertID''). In this case we perform a 
  
   SELECT MAX($primarykey) FROM $table   SELECT MAX($primarykey) FROM $table
Line 280: Line 284:
   $rec = new ADOdb_Active_Record("table1",array("id"),$db2);   $rec = new ADOdb_Active_Record("table1",array("id"),$db2);
  
-You can now give a named label in [[v5:activerecord:setdatabaseadaptor]], allowing to determine in your class definition which database to load, using var [[v5:activerecord:dbat]].+You can now give a named label in [[v5:activerecord:setdatabaseadapter]], allowing to determine in your class definition which database to load, using var [[v5:activerecord:dbat]].
  
 <code php> <code php>
Line 318: Line 322:
 ===== Transactions ===== ===== Transactions =====
 <WRAP right box 200px> <WRAP right box 200px>
-More about [[v5:reference:index#transaction_scoping|Transaction Handling]]+More about [[v5:reference:reference_index#transaction_scoping|Transaction Handling]]
 </WRAP> </WRAP>
 The default transaction mode in ADOdb is autocommit. So that is the default with active record too. The general rules for managing transactions still apply. Active Record to the database is a set of insert/update/delete statements, and the db has no knowledge of active records. The default transaction mode in ADOdb is autocommit. So that is the default with active record too. The general rules for managing transactions still apply. Active Record to the database is a set of insert/update/delete statements, and the db has no knowledge of active records.
v5/activerecord/active_record_tutorial.1452647753.txt.gz · Last modified: 2017/04/21 11:22 (external edit)