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

global $c, $arg, $param;

function remote_query ( $sql, $db = "", $user = "", $password = "", $server = "" )
{
    global $xmlrpc_r, $base_export, $c, $arg, $param;
    $db         = ($db == "")?($c["sql_dsn"]):($db);
    $user       = ($user == "")?($c["sql_user"]):($user);
    $password   = ($password == "")?($c["sql_password"]):($password);
    $server     = ($server == "")?($c["sql_server"]):($server);
    $names = "";
    
    $conn = mssql_connect($server, $user, $password);
    if (!$conn || !mssql_select_db($db, $conn)) {
        $err = mssql_get_last_message()." <br />erro ao conectar ao servidor $server";
        $xmlrpc_r = $err;
        //@error_log ("\nxdb_exec - error conecting to database $db", 3, $xdbc["logfile"]); 
        return false;
    }
    if ($conn > 0) {
        if (is_array($sql)) {
            foreach($sql as $sqls) {
                $rs = @mssql_query($sqls, $conn);
            }
        } else {
            $rs = @mssql_query($sql, $conn);
        }
        $result = @mssql_num_rows($rs);
        if (!($rs > 0)) {
            $err = mssql_get_last_message($conn);
            $xmlrpc_r = $err;
            //@error_log ("\nxdb_exec - error at sql statement $db: $sql", 3, $xdbc["logfile"]); 
            return false;
        }
        $i = 0;
        $row = @mssql_fetch_array($rs);
        while($row) {
            if ($end > 0 && $i >= $end) {
                break;
            }
            $res[$i++] = $row;
            $row = @mssql_fetch_array($rs);
        }
        @mssql_free_result($conn);
        //odbc_close($xdbc["conn"]);
        if (!is_array($res)) {
            //exit ("A consulta não retornou nenhum resultado");
            $xmlrpc_r = true;
        } else {
            $xmlrpc_r = $res;
        }
        return true;
    } else {
        return false;
    }
}
?>
Return current item: Pindorama