• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to load DB_froge class inside my own driver?

#1
Hello there. I've my own driver called data_driver.php and using this drriver, I want to create some database tables. Whenever I'm going to load db_forge class into my driver there is an error saying:

Invalid driver requested: Data_driver_dbforge

I think the load request treating db_forge as a child driver. So what to do now? Looking forword to your answer.
Thanks in advance.
"Who thinks in code"
Perfectly describes who I am
mbparvez.me
Reply

#2
I'm assuming data_driver is a database driver. In most cases, when building a new database driver I would recommend looking at the MySQLi driver as a reference. Each driver is structured as a directory with the base driver name, followed by a series of files to support the various portions of the database library/libraries, so the file/directory structure looks something like this:
/system/database/drivers/{driver_name}/
{driver_name}_driver.php
{driver_name}_forge.php
{driver_name}_result.php
{driver_name}_utility.php

It gets a little more complicated for drivers like PDO, which have their own subdrivers.

When you load DB_forge, it gets the driver information from the database library, then loads a file from /system/database/drivers/{driver_name}/{driver_name}_forge.php to tell it how DB_forge is going to interact with the underlying database. If this file doesn't exist, you can't use DB_forge for the current driver.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.