Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ci_sqlrelay adapter add & setting #1135

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

jjang9b commented Mar 6, 2012

CodeIgniter sqlrelay adapter. based on v2.0.2

[api document url]
http://jjang9b.oranc.co.kr/codeigniter/sqlrelay_api.html

[explain]

The common function of the Sqlrelay adapter which I created is processing with exclusive Sqlrelay function . And the other function of the individual DB is the first to have keys of types of DB, then run the function of adapter depending on the type of each DB.

The Sqlrelay adapter is in charge of practical Sqlrelay connection, query execution, and the result object mapping part.

Ultimately, all common actions such as the Sqlrelay connection, query execution, and receiving results will be processed on the Sqlrelay adapter while running creating functions of each DB adapter which for functioning concept of ORM

Once the new DB adapter is added, the function of corresponding adapter is running normally and it’s been created as a plug-in so that it is not related to the CI version.

Also I tried to match the types of coding with CI, but the code was also written concisely in a least work.

API documentation is attached, normal tests have been confirmed that based on official CI DB documents for oci8/mysql.

@narfbg narfbg commented on the diff Mar 6, 2012

application/config/database.php
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'mysql';
+//$db['default']['dbdriver'] = 'sqlrelay';
+//$db['default']['dbcase'] = 'mysql';
@narfbg

narfbg Mar 6, 2012

Contributor

You shouldn't put commented config vars like this.
Either introduce a default or leave it as is. In this case - you should think of a way to implement it with the currently available options as adding a global setting that would be used by just one driver (and one that's not so popular, I guess) isn't really a good idea.

@narfbg narfbg commented on an outdated diff Mar 6, 2012

system/database/drivers/sqlrelay/sqlrelay_driver.php
+
+/**
+ * sqlrelay Database Adapter Class
+ *
+ *
+ * NOTE: this uses the PHP 5 sqlrelay methods
+ *
+ * @author bbin
+ *
+ */
+
+class CI_DB_sqlrelay_driver extends CI_DB {
+
+ var $dbdriver = 'sqlrelay';
+
+ var $outputBool = FALSE;
@narfbg

narfbg Mar 6, 2012

Contributor

This doesn't match the coding style guidelines.

@timw4mail timw4mail commented on an outdated diff Mar 6, 2012

system/database/drivers/sqlrelay/sqlrelay_driver.php
+ *
+ */
+
+class CI_DB_sqlrelay_driver extends CI_DB {
+
+ var $dbdriver = 'sqlrelay';
+
+ var $outputBool = FALSE;
+ var $outputName = array();
+ var $outputResult = array();
+
+ function CI_DB_sqlrelay_driver($params)
+ {
+ parent::CI_DB_driver($params);
+
+ require_once(BASEPATH.'database/drivers/'.$this->dbcase.'/'.$this->dbcase.'_driver'.EXT);
@timw4mail

timw4mail Mar 6, 2012

Contributor

This should call parent::__construct, rather than parent::CI_DB_driver and the EXT constant has been removed.

Contributor

narfbg commented Mar 6, 2012

Apart from the already noted things - you should base this on the current development version, not 2.0.2 and make sure it's in PHP 5 style (visibility declarations, __construct(), etc.), so we don't have to add that afterwards.

Also, I'm not really familiar with how sqlrelay works, but do you really need to depend on other driver files? This shouldn't happen.

@narfbg narfbg closed this May 24, 2012

@jjang9b jjang9b referenced this pull request Apr 6, 2012

Closed

sqlrelay adapter v2.1.0 #1224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment