ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


project:submitting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

project:submitting [2019/11/26 19:32] – created mnewnhamproject:submitting [2019/11/26 23:32] (current) – [Scenarios] mnewnham
Line 20: Line 20:
 These are often the most contentious discussions because we're likely to ask you to show how the behavior is wrong **in general**, and not just in your particular use case. In addition, if there is a problem, we need to be able to ensure that users who have relied on the apparently faulty behavior (possibly for years) aren't going to have problems if they upgrade to a version of ADOdb that has corrected behavior. That might mean, in the short term, an optional, parameterized change. Remember, ADOdb isn't an obscure little side project, there are normally 100-200 downloads per week, continually over a period of nearly 20 years. These are often the most contentious discussions because we're likely to ask you to show how the behavior is wrong **in general**, and not just in your particular use case. In addition, if there is a problem, we need to be able to ensure that users who have relied on the apparently faulty behavior (possibly for years) aren't going to have problems if they upgrade to a version of ADOdb that has corrected behavior. That might mean, in the short term, an optional, parameterized change. Remember, ADOdb isn't an obscure little side project, there are normally 100-200 downloads per week, continually over a period of nearly 20 years.
 === You want to enhance the functionality of a specific function === === You want to enhance the functionality of a specific function ===
-Say, for example, you wanted to add the ability of the **mysqli** connector to use +Say, for example, you wanted to add the ability of the **mysqli** connector to use SSL connections to connect to the database.  
 +  - Start first by seeing how you can use the existing methods to provide access into your new codes. Don't, for example, modify the format of the **connect** function to require new, or modified parameters. 
 +  - You might, for example, use the **setConnectionParameter** method to inject the SSL parameters into the connection. 
 +  - If you need to add new class variables or methods, make sure the connection doesn't fail if they are not set. 
 +  - Make sure that your feature doesn't interfere with existing configurations. 
 +=== Adding A New Feature === 
 +You might decide to offer a new method //**year**//, that provides a database independent method of obtaining a 4 digit year from a date field. If you use MySQL, then you might recognize the correct syntax as
  
 +<code sql>
 +SELECT DATE_FORMAT(field,'%Y');
 +</code>
  
 +You would then add the code into the drivers/adodb-mysql.inc.php file in a function like this
 +<code php>
 +/**
 +* Formats the date into year only format YYYY
 +*
 +* @param str $field The name of the date to format
 +*
 +* @return str The SQL text
 +*/
 +public function year($fld) 
 +{
 +    $x = "DATE_FORMAT($fld,'%Y')";
 +    return $x;
 +}
 +</code>
 +
 +In order to fulfill the requirement for cross database compatibility, you should research the method of obtaining the same information from at least other Tier 1 databases. You would find that you would need to add code like this
 +
 +<code sql>
 +SELECT YEAR(field) //mssqlnative, mssql drivers
 +SELECT TO_CHAR(field,'YYYY') // oci8 drivers, postgres drivers
 +</code>
 +
 +Even if you cannot test these yourself because you have no access to the database, you can code them into your branch and put out a call on the issues page for help testing.
 +
 +You need also to create some end user documentation, that can be used as a basis for docuwiki pages.
  
  
project/submitting.1574793123.txt.gz · Last modified: 2019/11/26 19:32 by mnewnham