Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-596

[PHP][Manual] The 'test_lob' table which is not created initially may lead some misunderstandings

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PHP 9.1.0 0004
    • Component/s: PHP Driver
    • Labels:
    • Environment:
      • OS: Linux 64
      • CUBRID: CUBRID 9.1 (9.1.0.0212) (64bit release build for linux_gnu) (Mar 14 2013 00:16:33)
      • PHP-Driver: 9.1.0.0004 (2013-07-08)

      Description

      I just noticed that there is a test_lob table described in several documents such as cubrid_lob2_seek() http://www.php.net/manual/en/function.cubrid-lob2-seek.php cubrid_lob2_seek64() http://www.php.net/manual/en/function.cubrid-lob2-seek64.php

      such as:

      {code}
      $conn = cubrid_connect("localhost", 33000, "demodb", "public", "");

      $req = cubrid_execute($conn, "select * from test_lob");
      $row = cubrid_fetch_row($req, CUBRID_LOB);
      $lob = $row[1];{code}

      However the table 'test_lob' has not been initialized beforehand in the demodb database (e.g. CUBRID 9.1.0), it may result in some confusions to user

      Related issue: APIS-557

        Activity

        Hide
        cn15800 谢韦华[Bert] added a comment -

        fixed

        Show
        cn15800 谢韦华[Bert] added a comment - fixed
        Hide
        cn15800 谢韦华[Bert] added a comment -
        {code}
        // test_lob (id INT, contents CLOB)
        // Data length of doc_1.txt should be greater than 20101029056306120215.

        $conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");

        cubrid_execute($conn,"DROP TABLE if exists test_lob");
        cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)");

        $req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES (?, ?)");
        cubrid_bind($req, 1, 1);

        $lob = cubrid_lob2_new($conn, "clob");
        cubrid_lob2_import($lob, "doc_1.txt");
        cubrid_lob2_bind($req, 2, $lob, 'CLOB'); // or cubrid_lob2_bind($req, 2, $lob);

        cubrid_execute($req);

        cubrid_lob2_close($lob);

        $req = cubrid_execute($conn, "select * from test_lob");
        $row = cubrid_fetch_row($req, CUBRID_LOB);
        $lob = $row[1];

        cubrid_lob2_seek64($lob, "20101029056306120215", CUBRID_CURSOR_FIRST);
        $data = cubrid_lob2_read($lob, 20);
        echo $data."\n";
        cubrid_disconnect($conn);{code}
        Show
        cn15800 谢韦华[Bert] added a comment - {code} // test_lob (id INT, contents CLOB) // Data length of doc_1.txt should be greater than 20101029056306120215. $conn = cubrid_connect("localhost", 33000, "demodb", "dba", ""); cubrid_execute($conn,"DROP TABLE if exists test_lob"); cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)"); $req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES (?, ?)"); cubrid_bind($req, 1, 1); $lob = cubrid_lob2_new($conn, "clob"); cubrid_lob2_import($lob, "doc_1.txt"); cubrid_lob2_bind($req, 2, $lob, 'CLOB'); // or cubrid_lob2_bind($req, 2, $lob); cubrid_execute($req); cubrid_lob2_close($lob); $req = cubrid_execute($conn, "select * from test_lob"); $row = cubrid_fetch_row($req, CUBRID_LOB); $lob = $row [1] ; cubrid_lob2_seek64($lob, "20101029056306120215", CUBRID_CURSOR_FIRST); $data = cubrid_lob2_read($lob, 20); echo $data."\n"; cubrid_disconnect($conn);{code}
        Hide
        cn15800 谢韦华[Bert] added a comment -

        Notice: If system have not enough memory, this test case will failed, because cci need to malloc enough memory to

        load doc_1.txt

        Show
        cn15800 谢韦华[Bert] added a comment - Notice: If system have not enough memory, this test case will failed, because cci need to malloc enough memory to load doc_1.txt
        Hide
        ryin005 Ray Yin added a comment -

        The document has been updated.

        Close the issue

        Show
        ryin005 Ray Yin added a comment - The document has been updated. Close the issue

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            ryin005 Ray Yin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: