Icon edb_jsonload

Returns the data for a BLOB column in an Elevate Web Builder dataset from a cursor.

Syntax
edb_jsonload(<CursorHandle>, <ColumnName>,
                     <RowKeyValues>)

<CursorHandle> =

Handle of cursor returned by edb_execute function

<ColumnName> =

Name of BLOB column from which to retrieve data

<RowKeyValues> =

String containing a semicolon-delimited list of key values

Returns
The BLOB column data as a string
if successful, and FALSE if there are any errors

Usage
The edb_jsonload function generates the BLOB column data for a given row in a cursor.

Warning This function moves the current row pointer in the cursor.

Please see the Elevate Web Builder manual for more information on datasets and the JSON data formats used with them.

<?php

// The following script connects to an ElevateDB
// Server and database, prepares and executes a
// direct table open, and then handles the incoming
// Elevate Web Builder dataset requests for the
// column definitions, rows, or BLOB data
//
// THIS IS JUST FOR ILLUSTRATIVE PURPOSES
//
// If you really need to use the ElevateDB PHP
// Extension with Elevate Web Builder, please see
// the Elevate Web Builder PHP DataSet Manager
// included with Elevate Web Builder.  It requires
// much less coding, and handles the dataset JSON
// transparently

$con = edb_connect("type=remote;charset=Ansi;address=127.0.0.1;"+
                   "uid=Administrator;pwd=EDBDefault;database=Test");
if (!$con)
  {
  die("Could not connect: " . edb_errmsg());
  }

$cmd = edb_prepare($con,"customer",EDB_COMMAND_TABLE);

$cursor = edb_execute($cmd);

if (isset($_SERVER["HTTP_X_EWBUSER"]) and isset($_SERVER["HTTP_X_EWBPASSWORD"]))
   {
   $user = $_SERVER["HTTP_X_EWBUSER"];
   $pwd = $_SERVER["HTTP_X_EWBPASSWORD"];
   }
else if (isset($_GET["user"]) and isset($_GET["password"]))
   {
   $user = $_GET["user"];
   $pwd = $_GET["password"];
   }
else
   {
   $user = NULL;
   $pwd = NULL;
   }           

if ($_GET["method"])
   {
   switch ($_GET["method"])
      {
      case "columns":
         {
         $cols = edb_jsoncols($cursor);
         if ($cols)
            {
            header("Content-Type: application/json; charset=utf-8");
            echo $cols;
            }
         else
            {
            die "Error retrieving dataset columns (" . edb_errmsg() . ")";
            }
         break;
         }
      case "rows":
         {
         $rows = edb_jsonrows($cursor,$_SERVER["SCRIPT_NAME"],"customer",FALSE,$_GET,$user,$pwd);
         if ($rows)
            {
            header("Content-Type: application/json; charset=utf-8");
            echo $rows;
            }
         else
            {
            die "Error retrieving dataset rows (" . edb_errmsg() . ")";
            }
         break;
         }
      case "load":
         {
         $data = edb_jsonload($cursor,$_GET["column"],$_GET["row"]);
         $content_type = edb_jsonloadtype($cursor,$_GET["column"],$_GET["row"]);
         if ($content_type <> "")
            {
            header("Content-Type: " . $content_type);
            }
         echo $data;
         break;
         }
      }
  }
else
  {
  die "Dataset method not specified";
  }

edb_disconnect($con);
?>
Image