owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.35k stars 2.06k forks source link

owncloud 5 beta2 pgsql database #1983

Closed hellweiss closed 11 years ago

hellweiss commented 11 years ago

if i enable user_ldap module, i get the following error log, and a blank owncloud page in the browser.

{"app":"PHP","message":"SQLSTATE[42883]: Undefined function: 7 FEHLER: Operator existiert nicht: text = integer\nLINE 5: AND \"configvalue\" = 1\n ^\nHINT: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen \u00fcberein. Sie m\u00fcssen m\u00f6glicherweise ausdr\u00fcckliche Typumwandlungen hinzuf\u00fcgen. at \/var\/www\/owncloud\/lib\/db.php#855","level":4,"time":1361965662}

BernhardPosselt commented 11 years ago

@blizzz maybe the error is in user_ldap/lib/helper.php

blizzz commented 11 years ago

@hellweiss could you change line 57 in apps/user_ldap/lib/helper.php to $query .= ' ANDconfigvalue= "1"'; (adding " around 1)? Does it help?

hellweiss commented 11 years ago

sorry, now i got this. I'm not a developer, but shouldn't the configvalue be "yes" because the value is stored yes in the database ?

{"app":"PHP","message":"SQLSTATE[42703]: Undefined column: 7 FEHLER: Spalte \u00bb1\u00ab existiert nicht\nLINE 5: AND \"configvalue\" = \"1\"\n ^ at \/var\/www\/owncloud\/lib\/db.php#855","level":4,"time":1362045947} {"app":"PHP","message":"SQLSTATE[42703]: Undefined column: 7 FEHLER: Spalte \u00bb1\u00ab existiert nicht\nLINE 5: AND \"configvalue\" = \"1\"\n ^ at \/var\/www\/owncloud\/lib\/db.php#855","level":4,"time":1362045952}

hellweiss commented 11 years ago

does not work with yes either

blizzz commented 11 years ago

No, it needs to be 1. It is about the configvalue for configkey ending with ldap_configuration_active..

There is something wrong with the query now, because it is looking for column named 1 which is not there of course. Lines 48 to 58 should look like this, is it the case?

    static public function getServerConfigurationPrefixes($activeConfigurations = false) {
        $referenceConfigkey = 'ldap_configuration_active';

        $query = '
            SELECT DISTINCT `configkey`
            FROM `*PREFIX*appconfig`
            WHERE `configkey` LIKE ?
        ';
        if($activeConfigurations) {
            $query .= ' AND `configvalue` = "1"';
        }
        $query = \OCP\DB::prepare($query);
hellweiss commented 11 years ago

![Uploading oc_pgsql.png . . .]() that's exactly how it looks like.

hellweiss commented 11 years ago

Somehow cant' upload Screenshots. error remains: undefined column.

blizzz commented 11 years ago

Okay, one more try. Otherwise i need to undust my PG installation.

Please change the code so it looks like:

    static public function getServerConfigurationPrefixes($activeConfigurations = false) {
        $referenceConfigkey = 'ldap_configuration_active';

        $query = '
            SELECT DISTINCT `configkey`
            FROM `*PREFIX*appconfig`
            WHERE `configkey` LIKE ?
        ';
        $param = array('%'.$referenceConfigkey);
        if($activeConfigurations) {
            $query .= ' AND `configvalue` = ?';
            $param [] = '1';
        }
        $query = \OCP\DB::prepare($query);

        $serverConfigs = $query->execute($param)->fetchAll();
        $prefixes = array();

Hope it will work like this.

hellweiss commented 11 years ago

This are the entries in the oc_appconfig table regarding user_ldap:

appid, configkey, configvalue user_ldap, enabled, yes user_ldap, installed_version, 0.3.9.4 user_ldap, types, authentication

hellweiss commented 11 years ago

sorry, now i got this:

{"app":"PHP","message":"SQLSTATE[08P01]: <>: 7 FEHLER: Binden-Nachricht enth\u00e4lt 1 Parameter, aber vorbereitete Anweisung \u00bbpdo_stmt_00000009\u00ab erfordert 2 at \/var\/www\/owncloud\/lib\/db.php#855","level":4,"time":1362049559} {"app":"PHP","message":"SQLSTATE[08P01]: <>: 7 FEHLER: Binden-Nachricht enth\u00e4lt 1 Parameter, aber vorbereitete Anweisung \u00bbpdo_stmt_00000009\u00ab erfordert 2 at \/var\/www\/owncloud\/lib\/db.php#855","level":4,"time":1362049563}

eMerzh commented 11 years ago

guys it seems to me that it's a problem of quotes :

brol = "1"  -- means the column brol = the column 1

but

brol = '1'  -- means the column brol = the value 1 (as a string)
hellweiss commented 11 years ago

you're right, changed it like so:

           if($activeConfigurations) {
                    $query .= ' AND `configvalue` = \'1\'';

now i got the logon screen, lets see ....

hellweiss commented 11 years ago

It works. Thank you very much. I took the original helper.php from beta2 an changed line Numer 57 to:

$query .= ' AND configvalue = \'1\'';

Thanks again and best regards.

BernhardPosselt commented 11 years ago

BTW, I've looked through the ldap source and there are multiple parts where parameters are enclosed in double quotes. I think you should convert them to single quotes, just in case @blizzz

eMerzh commented 11 years ago

As it's now merged, could you please test that it work? thanks

hellweiss commented 11 years ago

Sure, but i can only test if ldap works with pgsql Database. Okay, testing with Sqlite shouldn't be a Problem though. I'll get back with some results tomorrow.

hellweiss commented 11 years ago

No Errors regarding user_ldap in owncloud.log, tested with pgsql and sqlite. Thank you, works for me. Can be closed.

eMerzh commented 11 years ago

Awesome! Thanks a lot for the test!

blizzz commented 11 years ago

thanks @eMerzh