Exemple #1
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, getContentAsString)
{
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  std::string buffer;
  This.getContent(buffer);
  DBXML_RETURN_STRINGL((char *)buffer.data(), buffer.length(), 1);
} PHP_DBXML_METHOD_END()
/* {{{ proto string XmlQueryExpression::getQueryPlan()
   Gets the query plan */
PHP_DBXML_METHOD_BEGIN(XmlQueryExpression, getQueryPlan)
{
  PHP_DBXML_STUFFED_THIS(XmlQueryExpression);
  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }
  std::string str = This.getQueryPlan();
  DBXML_RETURN_STRINGL((char*)str.data(), str.length(), 1);
} PHP_DBXML_METHOD_END()
PHP_DBXML_METHOD_BEGIN(XmlData, get_data)
{
  PHP_DBXML_STUFFED_THIS(XmlData);
 
  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }

  DBXML_RETURN_STRINGL((char*)This.get_data(), This.get_size(), 1);
} PHP_DBXML_METHOD_END()
/* {{{ proto string XmlIndexSpecification::getDefaultIndex()
   returns the default indexing strategy */
PHP_DBXML_METHOD_BEGIN(XmlIndexSpecification, getDefaultIndex)
{
  std::string index;
  PHP_DBXML_STUFFED_THIS(XmlIndexSpecification);

  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }

  index = This.getDefaultIndex();
  DBXML_RETURN_STRINGL((char*)index.data(), index.length(), 1);
} PHP_DBXML_METHOD_END()
/* {{{ proto string XmlIndexLookup::getNodeName()
   returns the index */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, getNodeName)
{
  std::string index;
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }

  index = This.getNodeName();
  DBXML_RETURN_STRINGL((char*)index.data(), index.length(), 1);
} PHP_DBXML_METHOD_END()
/* {{{ proto string XmlIndexSpecification::find(string uri, string name)
   returns the indexing strategy, or false */
PHP_DBXML_METHOD_BEGIN(XmlIndexSpecification, find)
{
  char *uri, *name;
  int uri_len, name_len;
  std::string index;
  PHP_DBXML_STUFFED_THIS(XmlIndexSpecification);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uri, &uri_len, &name, &name_len)) {
    RETURN_FALSE;
  }

  if (This.find(std::string(uri, uri_len), std::string(name, name_len), index)) {
    DBXML_RETURN_STRINGL((char*)index.data(), index.length(), 1);
  } else {
    RETURN_FALSE;
  }
} PHP_DBXML_METHOD_END()