Changeset 106 for devel/units/db
- Timestamp:
- 01/12/06 08:02:45 (3 years ago)
- Files:
-
- devel/units/db/library.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/units/db/library.php
r94 r106 1 1 <?php 2 3 /*4 * TODO: This could probably do with using the $db_connection variable in the mysql functions,5 * as PHP can be a bit arbitrary in its choice of db session. Would also be required for a6 * replicated mysql system, which could be a future need for large user bases.7 * Not actually running a test copy of Elgg atm so dunno what scope $db_connection's in.8 * - Sven9 */10 2 11 3 // Database library functions … … 16 8 global $querynum; 17 9 global $querycache; 10 global $db_connection; 18 11 19 12 /*if (isset($querycache[$sql_query])) { … … 29 22 // echo "<b>" . $run_context . "</b> " . $sql_query . "<br />"; 30 23 if ($sql_query != "") { 31 // echo "<!-- $sql_query -->\n"; 32 if ($result = @mysql_query($sql_query)) { 24 if ($result = @mysql_query($sql_query, $db_connection)) { 33 25 $data = array(); 34 26 if (!is_bool($result)) { … … 42 34 } else { 43 35 if (ELGG_DEBUG) { 44 echo $sql_query . " :: " . @mysql_error( ) . "<br />\n";36 echo $sql_query . " :: " . @mysql_error($db_connection) . "<br />\n"; 45 37 } 46 38 $querycache[$sql_query] = FALSE; … … 54 46 // Rows affected by the last MySQL transaction 55 47 function db_affected_rows() { 56 return @mysql_affected_rows(); 48 global $db_connection; 49 return @mysql_affected_rows($db_connection); 57 50 } 58 51 59 52 // Returns the ID of the last MySQL transaction 60 53 function db_id() { 61 return @mysql_insert_id(); 54 global $db_connection; 55 return @mysql_insert_id($db_connection); 62 56 } 63 57
