Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

SQLite: deleteRepository error #779

Closed
mincowski opened this issue Dec 13, 2014 · 1 comment
Closed

SQLite: deleteRepository error #779

mincowski opened this issue Dec 13, 2014 · 1 comment

Comments

@mincowski
Copy link

Hello,

some time ago, I reported a problem related to deleting a sharing link when using SQLite. This problem still exists in 6.0.

After some testing, it seems that the following section in class.sqlConfDriver.php causes this.

switch ($this->sqlDriver["driver"]) {
    case "sqlite":
    case "sqlite3":
    case "postgre":
        dibi::nativeQuery("SET bytea_output=escape");
        $children_results = dibi::query('SELECT * FROM [ajxp_roles] WHERE [searchable_repositories] LIKE %~like~ GROUP BY [role_id]', '"'.$repositoryId.'";s:');
        break;
    case "mysql":
        $children_results = dibi::query('SELECT * FROM [ajxp_roles] WHERE [serial_role] LIKE %~like~ GROUP BY [role_id]', '"'.$repositoryId.'";s:');
    break;

Calling dibi::nativeQuery("SET bytea_output=escape"); on an SQLite database throws an error and (I am no db-expert) seems to be required only for Postgre.

Adjusting the case structure solved the problem for me.

switch ($this->sqlDriver["driver"]) {
    case "postgre":
        dibi::nativeQuery("SET bytea_output=escape");
    case "sqlite":
    case "sqlite3":
        $children_results = dibi::query('SELECT * FROM [ajxp_roles] WHERE [searchable_repositories] LIKE %~like~ GROUP BY [role_id]', '"'.$repositoryId.'";s:');
        break;
    case "mysql":
        $children_results = dibi::query('SELECT * FROM [ajxp_roles] WHERE [serial_role] LIKE %~like~ GROUP BY [role_id]', '"'.$repositoryId.'";s:');
    break;

My question now is if the way it is is the intended behaviour or if these changes could be expected to cause other problems?

@cdujeu
Copy link
Member

cdujeu commented Dec 22, 2014

very probably a bug, will reproduce and fix it following your suggestion.
thx

@cdujeu cdujeu closed this as completed in bf3c0a5 Dec 30, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants