[Tiki-devel] Calling MySQL functions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Tiki-devel] Calling MySQL functions

Dr. Sassafras
Ive got a question about database calls.

I set a lot of places where tikilib is called to perform mysql queries etc.

Is this the current best practise?

I see that there is TikiDB and Tiki_Bridge.

Currently all the database calls go through Tiki_Bridge if called from tikilib. Is this a remnant of when tiki use to be multi-database oriented? Can calls safely be made from TikiDB now?

It just seems a shame to load tikilib for a single database call when something with a much smaller footprint is available, but I also dont see TikiDB or Tiki_Bridge being able to called from TikiLib::lib

I also see that sometimes TikiDB->get() is called. eg. $db = TikiDB->get() or TikiDB->get()->query($query) (which is kinda like a TikiLib::lib call)

This would seem a more sensible way of making db calls, as it bypasses tiki_bridge and also tikilib.

Is there some difference in function between calling Tiki_Bride and TikiDb? 

Brendan




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] Calling MySQL functions

Jonny Bradley-4
Hi Brendan

A good question, or indeed series of questions :)

TikiLib extends TikiDb_Bridge which is an implementation of TikiDb (the abstract class covering all database access).

We still have the option of PDO or Adodb so we still need to use these classes so it will work in all cases, and you never know, we might get something like Postgres support back, or might need a MariaDb interface at some point.

I use TikiDb::get() to get an instance of whichever TikiDb is in use, and wherever possible use  a TikiDb::get()->table('tiki_tablename') TikiDb_Table object to manipulate the data (if you don;'t need joins etc)

Hope that helps, most of it should be on https://dev.tiki.org/Database+Access but maybe we need another page about what's going on underneath?

jb



> On 3 Apr 2017, at 01:16, Brendan Ferguson <[hidden email]> wrote:
>
> Ive got a question about database calls.
>
> I set a lot of places where tikilib is called to perform mysql queries etc.
>
> Is this the current best practise?
>
> I see that there is TikiDB and Tiki_Bridge.
>
> Currently all the database calls go through Tiki_Bridge if called from tikilib. Is this a remnant of when tiki use to be multi-database oriented? Can calls safely be made from TikiDB now?
>
> It just seems a shame to load tikilib for a single database call when something with a much smaller footprint is available, but I also dont see TikiDB or Tiki_Bridge being able to called from TikiLib::lib
>
> I also see that sometimes TikiDB->get() is called. eg. $db = TikiDB->get() or TikiDB->get()->query($query) (which is kinda like a TikiLib::lib call)
>
> This would seem a more sensible way of making db calls, as it bypasses tiki_bridge and also tikilib.
>
> Is there some difference in function between calling Tiki_Bride and TikiDb?
>
> Brendan
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
> TikiWiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] Calling MySQL functions

Dr. Sassafras
> TikiLib extends TikiDb_Bridge which is an implementation of TikiDb (the abstract class covering all database access).
>
> We still have the option of PDO or Adodb so we still need to use these classes so it will work in all cases, and you never know, we might get something like Postgres support back, or might need a MariaDb interface at some point.
>
> I use TikiDb::get() to get an instance of whichever TikiDb is in use, and wherever possible use  a TikiDb::get()->table('tiki_tablename') TikiDb_Table object to manipulate the data (if you don;'t need joins etc)

In that case, TikiDB_Bridge will be bypassed in all your commits. However even with PDO or Adobe support, they must be working as right now TikiDB_Bridge only calls TikiDB, it doesn’t make any changes. Furthermore I see that Adodb.php and Pdo.php extend TikiDB, not TikiDB_Bridge, so it looks as though they don’t even use TikiDB_Bridge at all.

TikiDb_Table seems to be set up in a smart way, in that you can initiate it from within TikiDB, again it doesn’t seem to use tikiDb_Bridge either.

> Hope that helps, most of it should be on https://dev.tiki.org/Database+Access but maybe we need another page about what's going on underneath?

Perhaps a little comment about the best way to call them. I would also much rather see efforts go into the addition of dockblocks, so its easier to know what all the database calls are doing. Right now I only use a tiny portion of what is available. The largest hurdle is figuring out what is available and when the best time to use it would be. Dockblocks would solve most of that.

Im wondering if we should phase out TikiDB_Bridge, and change the documentation to show TikiDb::get() as a preferred method of calling over TikiLib::lib(tikilib).

Thanks for your time in answering my questions. Its appreciated.

Brendan

>
>
> jb
>
>
>
>> On 3 Apr 2017, at 01:16, Brendan Ferguson <[hidden email]> wrote:
>>
>> Ive got a question about database calls.
>>
>> I set a lot of places where tikilib is called to perform mysql queries etc.
>>
>> Is this the current best practise?
>>
>> I see that there is TikiDB and Tiki_Bridge.
>>
>> Currently all the database calls go through Tiki_Bridge if called from tikilib. Is this a remnant of when tiki use to be multi-database oriented? Can calls safely be made from TikiDB now?
>>
>> It just seems a shame to load tikilib for a single database call when something with a much smaller footprint is available, but I also dont see TikiDB or Tiki_Bridge being able to called from TikiLib::lib
>>
>> I also see that sometimes TikiDB->get() is called. eg. $db = TikiDB->get() or TikiDB->get()->query($query) (which is kinda like a TikiLib::lib call)
>>
>> This would seem a more sensible way of making db calls, as it bypasses tiki_bridge and also tikilib.
>>
>> Is there some difference in function between calling Tiki_Bride and TikiDb?
>>
>> Brendan
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
>> TikiWiki-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> TikiWiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Tiki-devel] Calling MySQL functions

Jonny Bradley-4

Good point, but i'm afraid i don't know... just that TikiDb::get() seems to work :)

Maybe something to look into for tiki 18?

jb



> On 3 Apr 2017, at 16:00, Brendan Ferguson <[hidden email]> wrote:
>
>> TikiLib extends TikiDb_Bridge which is an implementation of TikiDb (the abstract class covering all database access).
>>
>> We still have the option of PDO or Adodb so we still need to use these classes so it will work in all cases, and you never know, we might get something like Postgres support back, or might need a MariaDb interface at some point.
>>
>> I use TikiDb::get() to get an instance of whichever TikiDb is in use, and wherever possible use  a TikiDb::get()->table('tiki_tablename') TikiDb_Table object to manipulate the data (if you don;'t need joins etc)
>
> In that case, TikiDB_Bridge will be bypassed in all your commits. However even with PDO or Adobe support, they must be working as right now TikiDB_Bridge only calls TikiDB, it doesn’t make any changes. Furthermore I see that Adodb.php and Pdo.php extend TikiDB, not TikiDB_Bridge, so it looks as though they don’t even use TikiDB_Bridge at all.
>
> TikiDb_Table seems to be set up in a smart way, in that you can initiate it from within TikiDB, again it doesn’t seem to use tikiDb_Bridge either.
>
>> Hope that helps, most of it should be on https://dev.tiki.org/Database+Access but maybe we need another page about what's going on underneath?
>
> Perhaps a little comment about the best way to call them. I would also much rather see efforts go into the addition of dockblocks, so its easier to know what all the database calls are doing. Right now I only use a tiny portion of what is available. The largest hurdle is figuring out what is available and when the best time to use it would be. Dockblocks would solve most of that.
>
> Im wondering if we should phase out TikiDB_Bridge, and change the documentation to show TikiDb::get() as a preferred method of calling over TikiLib::lib(tikilib).
>
> Thanks for your time in answering my questions. Its appreciated.
>
> Brendan
>>
>>
>> jb
>>
>>
>>
>>> On 3 Apr 2017, at 01:16, Brendan Ferguson <[hidden email]> wrote:
>>>
>>> Ive got a question about database calls.
>>>
>>> I set a lot of places where tikilib is called to perform mysql queries etc.
>>>
>>> Is this the current best practise?
>>>
>>> I see that there is TikiDB and Tiki_Bridge.
>>>
>>> Currently all the database calls go through Tiki_Bridge if called from tikilib. Is this a remnant of when tiki use to be multi-database oriented? Can calls safely be made from TikiDB now?
>>>
>>> It just seems a shame to load tikilib for a single database call when something with a much smaller footprint is available, but I also dont see TikiDB or Tiki_Bridge being able to called from TikiLib::lib
>>>
>>> I also see that sometimes TikiDB->get() is called. eg. $db = TikiDB->get() or TikiDB->get()->query($query) (which is kinda like a TikiLib::lib call)
>>>
>>> This would seem a more sensible way of making db calls, as it bypasses tiki_bridge and also tikilib.
>>>
>>> Is there some difference in function between calling Tiki_Bride and TikiDb?
>>>
>>> Brendan
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
>>> TikiWiki-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> TikiWiki-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> TikiWiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Loading...