Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/0ea7299e105bf11a#

In-Portal has nice kDBConnection class, that we use in every day operations
that require database interaction.

Among all it has following most important methods, that you can use:

   - Query - runs sql statement and returns 2-dimensional array with a
   results
   - GetRow - runs sql statement and returns first row only as
   1-dimensional array
   - GetCol - runs sql statement and returns first field from each
   resulting row
   - GetOne - runs sql statement and returns first column from first row as
   a string

All of above functions work very well when you don't have thousands rows in
database tables you operate.

In case if you have big tables, then idea to create an array of all
selected rows inside kDBConnection::Query method (memory allocation #1) and
then returning it to calling function (memory allocation #2) isn't a good
idea since you get 2x memory allocation as you would normally get when
using code from PHP documentation:

$rs = mysql_query($sql);

while ( $row = mysql_fetch_array($rs) ) {
...

}

  • No labels