Skip to content

2.4

Compare
Choose a tag to compare
@k00ni k00ni released this 25 Jan 14:00
· 49 commits to master since this release
e65a33d

2.4.0

After years, ARC2 got some love recently! With this release we started improving the RDF store by implementing a sufficient test coverage first and added new features afterwards, like PDO support. This way we should kept backward compatibility. If you still get errors using the RDF store, please open a new issue.

RDF Store changes and improvements

Summary:

  • high test coverage of RDF store related code
  • PDO support
  • mysqli is still available and the default (= stable API, therefore no changes required by you!)
  • added joshcam/mysqli-database-class to interact with mysqli. It provides a nice helper class which makes live easier, when working with mysqli.

High test coverage

Tests were added which focus RDF Store related code. Parts about controlling DB processes are not fully covered. Also, direct interaction with the DB backend (e.g. killing DB processes) is not recommended and support will be removed in a future release. SPARQL Endpoint code is also not tested.

There may be a change in behavior...

We had to change some internals, which may lead to a change in known behavior. If you only rely on the highest level of functions, the following changes shall not be of your concern:

  • ARC2_Class->queryDB: It will only return the result, if mysqli is used as adapter. It returns null in all other cases. The reason is, that direct interaction with the DBS is not recommended. Use ARC2_Class::getDBObjectFromARC2Class to get the current DB adapter and use its functions instead (see src/ARC2/Store/Adapter/AbstractAdapter). They provide helper functions to get exactly one row (fetchRow) or a row list (fetchList).
  • ARC2_Store->getResourceLabel: It uses the parameter $unnamed_label somehow, but it was not possible to create a case, when it will be used. We assume it is not required or only in rare cases?!
  • when using PDO as DB adapter:
    • ARC2 will not create the database, if it does not exist. In this case, you have to create the database yourself.
    • ARC2 will throw exceptions, if a query fails

How to use PDO

Add the field db_adapter with pdo to your database configuration, like:

$dbConfig = [
    // ...
    'db_adapter' => 'pdo',
    'db_pdo_protocol' => 'mysql',
];
$store = ARC2::getStore($dbConfig);

// $store uses PDO to access the database

About backward compatibility

We wanted to keep backward compatibility in the 2.x branch for as long as possible. This means, supporting PHP 5.3 and newer. Even if officially PHP 5.6+ is required, version 2.3.1 and below claims to run on PHP 5.3.

Summary:

  • increased support for PHP 5.3 (e.g. by replacing array short syntax by extend syntax) - array short syntax was introduced with PHP 5.4.
  • removed some commented out code
  • improved code readability in classes of the store folder
  • dropped MySQL 4.x support

MySQL 4.x support dropped

Code related to MySQL 4.x was removed and with that the support for MySQL 4.x. This major release is over 10 years old and receives no updates/fixes from Oracle or the community. Based on the MySQL EOL Notice, support for MySQL 4.1 ended in 2009.

Internal changes

The following changes break the internal API, but should not be of your concern, because its very likely that you don't use these classes or functions. If you do and this breaks your stuff, please create new issue here.

  • ARC2_StoreLoadQueryHandler
    • changed parameter list of autoRepairTable from $er, $con, $sql = '' to $er, $sql = ''. Parameter $con was removed due new DBS layer.
  • getting the connection ID or connection itself is only possible when using mysqli as DB adapter. If you use something else, related functions will NOT return expected data and some internal array values maybe unset (e.g. ->a). Attached to the underlying DB makes it impossible to replace the adapter, therefore further decoupling.