updateQueries没有被调用

时间:2017-04-25 18:12:06

标签: apollo-client

为什么没有为我调用updateQueries?我认为我正在完成文档所说的内容,并将我的代码与其他类似问题进行了比较。我错过了什么?

包装版本:

$ awk '
NR==FNR{ a[$1]; next }          # hash the first file, use $1 field as key
($2 in a)                       # second file, if $2 field value is found in a, 
                                # ($2 in a) evaluates to true 
                                # which initiates implicit printing of the record
' <(zcat c.txt.gz ) <(zcat d.txt.gz)

514786698   10084625    491891820   4   12951   0.986   562 421
539535670   10026407    556933170   3   \N  \N  \N  \N

我的代码:

<?php
class connection

    {
    public $mysqli;

    function connect()
        {
        $hostname = "localhost";
        $username = "root";
        $password = "";
        $database = "demodatabase";
        $mysqli = new mysqli($hostname, $username, $password, $database);
        /* check connection */
        if (mysqli_connect_errno())
            {
            printf("Connect failed: %s\n", mysqli_connect_error());
            exit();
            }

        return true;
        }
    }

class Index extends connection

    {
    function __construct()
        {
        parent::connect();
        }

    function insertdata($a, $b)
        {

        // echo $a. ' ' .$b;
        // MySqli Insert Query

        $status = 0;
        $insert_row = $mysqli->mysqli_query("INSERT INTO tb_user (id, user, password, status) VALUES('','" . $a . "', '" . $b . "', '')");
        if ($insert_row)
            {
            print 'saved';
            }
          else
            {
            die('Error : (' . $mysqli->errno . ') ' . $mysqli->error);
            }
        }
    }

?>

1 个答案:

答案 0 :(得分:0)

我从来没有让updateQueries工作,但推荐的方法是使用update(也是一个变异选项)。使用update为我工作,这篇文章非常有用:

https://dev-blog.apollodata.com/apollo-clients-new-imperative-store-api-6cb69318a1e3