Categories > TinyButStrong general >

database & TBS: use built-in capability or ezSQL?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: michael
Date: 2004-07-28
Time: 14:40

database & TBS: use built-in capability or ezSQL?

Hi

I am new to TBS - I notice there is built-in database access functionality in TBS, and also I noticed some suggestion elsewhere on this site & in the forum about using ezSQL. I wonder what is the criteria for using the built-in function or ezSQL? It seems like if you are just querying (reading data) from a database, either is acceptable - is that true? If so, which is preferrable & why?

I see from another post here that TBS doesn't insert/update data to a db, so that is perhaps one definite reason for using something like ezSQL.

Also if I use ezSQL, I just want to confirm that it is necessary to include the following functions to make it work:

function tbsdb_db_open(&$db,&$query) {
  $db->get_results($query) ;
  return $db ;
}
function tbsdb_db_fetch(&$db,$num) {
  if ($num<=$db->num_rows) {
    return $db->get_row(null,ARRAY_A,$num-1) ;
  } else {
    return False ;
  }
}
function tbsdb_db_close(&$db) {
  // not needed
}

I assume for using the native TBS database functionality the above or similar is not required.

Basically I am trying to understand why I would bother (or what is the strong merit) to use ezSQL instead of the built-in TBS database reading function. Is there a performance benefit?

Thanks.

Regards

Michael.
By: Skrol29
Date: 2004-07-28
Time: 15:35

Re: database & TBS: use built-in capability or ezSQL?

Hi Michael,

TBS is only able to directly open a query and ready it forward to merge data. It is not a real "built-in database access functionality ", but it enables you to code quickly.

If you usually use ezSQL or if you'd like to use ezSQL in your web application for updating data or executing other statments, it's easy for TBS to connect with it. but you can do the same with the PHP database functions, or you own funtions set.

It's not better or worse to choose ezSQL when using TBS, it's just a developper choice or usage.