Location: PHPKode > projects > Pindorama > pindorama/active/components/xmlrpc/modules/odbc.php
<?php
/************************************************************
 *                                                          *
 *      Pindorama Core Configuration v. 0.11                *
 *      Guilherme Capilé <hide@address.com>           *
 *                                                          *
 ************************************************************/

global $c, $arg, $param;

function remote_query ( $sql, $dsn = "", $user = "", $password = "" )
{
    global $xmlrpc_r, $base_export, $c, $arg, $param;
    $dsn        = ($dsn == "")?($c["sql_dsn"]):($dsn);
    $user       = ($user == "")?($c["sql_user"]):($user);
    $password   = ($password == "")?($c["sql_password"]):($password);
    $names = "";
    $db  = odbc_connect ($dsn, $user, $password);
    if (odbc_error()) {
        $xmlrpc_r = odbc_errormsg();
        return false;
    }
    
    if ($db > 0) {
        if (is_array($sql)) {
            foreach ($sql as $sqls) {
                $rs = odbc_exec($db, $sqls);
            }
        } else {
            $rs = odbc_exec($db, $sql);
        }
        if (!$rs || odbc_error()) {
            $xmlrpc_r = odbc_errormsg($db);
            return false;
        }
        // gets the collumn names - lowercase
        $i = 0;
        $cols = odbc_num_fields($rs);
        while ($i < $cols) {
            $i++;
            $name[] = strtolower(odbc_field_name($rs, $i));
        }
    
        for ($i = 1; @odbc_fetch_into($rs,$temp, $i); $i++) {
            $j = 0;
            $unrow = "";
            foreach ($temp as $tmp) {
                $unrow[$name[$j++]] = $tmp;
            }
            $resultado[$i -1] = $unrow;
        }
        odbc_close($db);
    }
    //@error_log ("\n".print_r($sql, true)."\nres: ".print_r($resultado, true).$xmlrpc_r, 3, "c:/services/log/sql.log"); 
    if (!is_array($resultado)) {
        //exit ("A consulta não retornou nenhum resultado");
        $xmlrpc_r = true;
    } else {
        $xmlrpc_r = $resultado;
    }
    return true;


/*
        if ($xdbc["conn"][$conn] < 1) {
            $xdbc["conn"][$conn] = odbc_connect ( $db, $user, $password, SQL_CUR_USE_ODBC);
        }
        if (odbc_error()) {
            $err = odbc_errormsg($xdbc["conn"][$conn]);
            echo $err;
            return false;
        }
        if ($xdbc["conn"][$conn] > 0) {
            if (is_array($sql)) {
                foreach($sql as $sqls) {
                    $rs = @odbc_exec($xdbc["conn"][$conn], $sqls);
                }
            } else {
                $rs = @odbc_exec($xdbc["conn"][$conn], $sql);
            }
            $result = @odbc_num_rows ($rs);
            if (!$rs || odbc_error()) {
                $err = odbc_errormsg($xdbc["conn"][$conn]);
                return false;
            }
            $i = 0;
            $cols = odbc_num_fields($rs);
            while ($i < $cols) {
                $i++;
                $name[] = strtolower(odbc_field_name($rs, $i));
            }
            for ($i = $start; @odbc_fetch_into($rs,$temp, $i+1); $i++) {
                if ($end > 0 && $i >= $end) {
                    break;
                }
                $j = 0;
                foreach ($temp as $tmp) {
                    $unrow[$name[$j++]] = $tmp;
                }
                $res[$i] = $unrow;
            }
            @odbc_free_result($xdbc["conn"][$conn]);
            //odbc_close($xdbc["conn"]);
            if ($xdbc["log-level"] > 0 && $xdbc["logfile"] != "") {
                @error_log ("$db: $sql", 3, $xdbc["logfile"]); 
            }
            return true;
    	} else {
    	    return false;
    	}
*/
}
?>
Return current item: Pindorama