Methods for processing large data amounts from database
Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/92d5b57e63a85133#
In-Portal nice $this->Application->Conn->Query method, that accepts SQL and returns an array of data to used right away. This proved very useful for small sets of data.
However, when you need to process 2000 or more records, then this method will eat up a lot of memory while transforming sql result into PHP array.
Attached methods contains kDBConnection::QueryRaw and kDBConnection::GetNextRow methods, that basically does the same what mysql_query and mysql_fetch_assoc methods. Also kDBConnection::Destroy method was changed to accept incoming recordset resource, that needs to be destroyed.
Here is usage example:
$rs = $this->Conn->QueryRaw($sql); while ( $row = $this->Conn->GetNextRow($rs) ) { echo $row['userid']; echo $row['fullname']; echo $row['userstatus']; } $this->Conn->Destroy($rs);
db_class_for_large_data_set_513.patch
db_class_for_large_data_set_512.patch