Categories > TinyButStrong general >

TBS 3.3.0 and TbsSQL

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Alex
Date: 2008-06-01
Time: 22:57

TBS 3.3.0 and TbsSQL

Hello, please help to resolve the next problem. On the plug-ins page is no download for TbsSQL and there is a note that this class is native for TBS since 3.2.0. I've got TBS 3.3.0 and there is no class 'clsTbsSQL' and browser says: Fatal error: Class 'clsTbsSQL' not found in ... So, here is the question: where can I get TbsSQL include file or, how can I use it in TBS 3.3.0 . Thank you.
By: TomH
Date: 2008-06-01
Time: 23:19

Re: TBS 3.3.0 and TbsSQL

Alex,

Hmmm, I couldn't find it at the main site either, so I uploaded a  copy of the tbssql_v2.0.zip file to the tbs_next group 'files' area - you  can get it there temporarily till Skrol29 catches it up.

http://groups.google.com/group/tbs-next/files?hl=en

HTH,
TomH
By: TomH
Date: 2008-06-01
Time: 23:27

Re: TBS 3.3.0 and TbsSQL

FWIW - you might compare the ezSQL db class.

Once I discovered ezSQL compatibility with TBS there was no going back.

Besides the features listed here...
http://www.woyano.com/view/213/Download-ezSQL-Database-Class-204

it also has the feature to escape the sql statements to protect against sql injection.

I like the query caching and the integration with TBS.
By: Alex
Date: 2008-06-01
Time: 23:36

Re: TBS 3.3.0 and TbsSQL

Thank you for additional info, I've found it on the site, it somehow is located in Other tools tab, but... Trying to use tbssql_mysqli gives the next: Fatal error: Call to a member function query() on a non-object in tbssql_mysqli.php on line 262. Any idea?
By: TomH
Date: 2008-06-02
Time: 01:10

Re: TBS 3.3.0 and TbsSQL

I dunno if this will help, but this setup works for me...
/* --------  Normally we would do this in the auto_prepend file ---------- */
    include_Once("tbssql_mysql.php");
     $Db = new clsTbsSQL($srv='',$uid='',$pwd='',$db='',$drv=''); //make the connection
    $srv="localhost";
    $uid="xxxx";
    $pwd="zzzz";
    $db="tbs_yyyy";
    $drv='';
    $table="mycontacts";
     $Db->Connect($srv,$uid,$pwd,$db,$drv=''); // $drv for only some db's
/* ----------------------------------------------------------------------- */

/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */

$cloak = 1; // yes, we want to cloak the email address

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate(basename($_SERVER['SCRIPT_NAME'], ".php").".html") ;

// Sooo...  we do the basic query first...
$sql = "SELECT id,lname,fname,email,ph_home FROM mycontacts ORDER BY lname";

// The tbssql db class returns the data in an object
//$dbobj =    $Db->GetRows($sql);
//$TBS->MergeBlock('blk', $dbobj); //$Db->GetRows($sql)
// --or--
$TBS->MergeBlock('blk', $Db->GetRows($sql));

//$TBS->MergeBlock('blk','tbssql',$sql);
$TBS->Show() ;

Keep in mind the above is for MySQL db. but it may help get started

HTH,TomH
By: Skrol29
Date: 2008-06-02
Time: 01:13

Re: TBS 3.3.0 and TbsSQL

Hi Alex,

The notes says that TbsSQL is "compatible" not "native".
By "compatible" it means that since you have created the first TbsSQL instance, you can use it for TBS MergeBlock just with the keyword 'tbssql'. Example:
$TBS->MergeBlock('blk','tbssql','SELECT * FROM table1');

About the error you've got with MySQLi, with the MySQLi database plug-in or with the ezSQL database plug-in ? Can you give more information about your PHP version ?
By: Alex
Date: 2008-06-04
Time: 00:22

Re: TBS 3.3.0 and TbsSQL

Sorry, didn't write earlier. Actually, the note about TBSSql on plug-ins page says:  in native since 3.2.0  and there is also no link for TBSSql plug-in download. About tbssql_mysqli: PHP Version 5.2.4

System  Windows NT DELL 5.1 build 2600 
Build Date  Aug 30 2007 07:05:48 
Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" 
Server API  Apache 2.0 Handler 
Virtual Directory Support  enabled 
Configuration File (php.ini) Path  C:\XP 
Loaded Configuration File  Z:\usr\local\php5\php.ini 
PHP API  20041225 
PHP Extension  20060613 
Zend Extension  220060519 
Debug Build  no 
Thread Safety  enabled 
Zend Memory Manager  enabled 
IPv6 Support  enabled 
Registered PHP Streams  php, file, data, http, ftp, compress.zlib 
Registered Stream Socket Transports  tcp, udp 
Registered Stream Filters  convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.* 


Hope it help to make tbssql_mysqli work properly.
By: Alex
Date: 2008-06-04
Time: 00:36

Re: TBS 3.3.0 and TbsSQL

I'd like to add that in my mind using mysqli_extension is preferred way to interact with the mysql database and mysql extension is a kind of old-fashion programming. I've made such an opinion in process of PHP studying so could be very nice to hear your thoughts about it and about the difference between tbssql_mysql and tbssql_mysqli extensions.
Thank you
By: Skrol29
Date: 2008-06-04
Time: 11:14

Re: TBS 3.3.0 and TbsSQL

Hi Alex,

> Trying to use tbssql_mysqli gives the next: Fatal error: Call to a member
> function query() on a non-object in tbssql_mysqli.php on line 262.
> Any idea?

It seems that your have instantiated TbsSQL but without any connection.

> nice to hear your thoughts about it and about the difference
> between tbssql_mysql and tbssql_mysqli extensions.

MySQLi is a bit slower that mysql_*, but the enhancement is on the object approach. I don't have any preference, and if I use an abstraction database tool such as TbsSQL I really don't care. The CMS Joomla supports both in native. It shows that others developers failed to make a choice :)




http://www.johnjawed.com/benchmarks/
By: Alex
Date: 2008-06-05
Time: 01:21

Re: TBS 3.3.0 and TbsSQL

Thank you Skrol29 for the explanation about tbssql_mysqli, it helped because I did class workability check without any connection. Also thanks for ypur opinion and for that URL with mysqli vs. mysql comparison.