Ejemplo n.º 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()
Ejemplo n.º 2
0
/* {{{ proto XmlResults execute() 
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, execute)
{
  zval *zqc,*zt;
  long flags = 0;
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

#define SET_PTR(expr)  \
  XmlQueryContext c = php_dbxml_get_XmlQueryContext_object_pointer(zqc TSRMLS_CC); \
  XmlResults r = expr; \
  object_init_ex(return_value, php_dbxml_XmlResults_ce); \
  php_dbxml_set_XmlResults_object_pointer(return_value, r TSRMLS_CC);

  if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
      "O|l", &zqc, php_dbxml_XmlQueryContext_ce, &flags)) {

    SET_PTR(This.execute(c, flags));
    php_dbxml_set_XmlResults_object_pointer(return_value, r TSRMLS_CC);
  } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
      "OO", &zt, php_dbxml_XmlTransaction_ce, &zqc, php_dbxml_XmlQueryContext_ce, &flags)) {

    XmlTransaction t = php_dbxml_get_XmlTransaction_object_pointer(zt TSRMLS_CC);
    SET_PTR(This.execute(t, c, flags));	  
  } else {
    WRONG_PARAM_COUNT;
  } 
} PHP_DBXML_METHOD_END()
Ejemplo n.º 3
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, setContent)
{
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  zval *zstr = NULL, *zdat = NULL;
  char *content;
  int contentlen;
  if(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &content, &contentlen)) {
    This.setContent(std::string(content, contentlen));
  }
  else if(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zdat, php_dbxml_XmlData_ce)) {
    XmlData dat = php_dbxml_get_XmlData_object_pointer(zdat TSRMLS_CC);
    This.setContent(dat);
  }
  else if(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zstr, php_dbxml_XmlInputStream_ce)) {
    XmlInputStream *str = PHP_DBXML_GET(zstr, XmlInputStream);
    This.setContentAsXmlInputStream(str);
  }
  else if(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zstr, php_dbxml_XmlEventReader_ce)) {
    XmlEventReader &reader = php_dbxml_get_XmlEventReader_object_ref(zstr TSRMLS_CC);
    This.setContentAsEventReader(reader);
  }
  else {
    return;
  }
} PHP_DBXML_METHOD_END()
Ejemplo n.º 4
0
/* {{{ proto bool XmlQueryExpression::isUpdateExpression()
   returns true if query is update */
PHP_DBXML_METHOD_BEGIN(XmlQueryExpression, isUpdateExpression) 
{
  PHP_DBXML_STUFFED_THIS(XmlQueryExpression);
  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }
  RETURN_BOOL(This.isUpdateExpression());
} PHP_DBXML_METHOD_END()
Ejemplo n.º 5
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, fetchAllData)
{
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }
  This.fetchAllData();
} PHP_DBXML_METHOD_END()
Ejemplo n.º 6
0
/* {{{ proto XmlIndexSpecification::setAutoIndexing(...)
   iterates indices */
PHP_DBXML_METHOD_BEGIN(XmlIndexSpecification, setAutoIndexing)
{
	PHP_DBXML_STUFFED_THIS(XmlIndexSpecification);
	bool val;
	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &val)) {
		return;
	}
	This.setAutoIndexing(val);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 7
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, getContentAsEventWriter)
{
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  zval *zv = NULL;
  if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zv, php_dbxml_XmlEventWriter_ce)) {
    XmlEventWriter &writer = php_dbxml_get_XmlEventWriter_object_ref(zv TSRMLS_CC);
    This.getContentAsEventWriter(writer);
  }
} PHP_DBXML_METHOD_END()
Ejemplo n.º 8
0
/* {{{ 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()
Ejemplo n.º 9
0
/* {{{ proto void XmlTransaction::commit([int flags])
   Commit the transaction */
PHP_DBXML_METHOD_BEGIN(XmlTransaction, commit)
{
  long flags = 0;
  PHP_DBXML_STUFFED_THIS(XmlTransaction);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags)) {
    RETURN_FALSE;
  }
  This.commit(flags);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 10
0
/* {{{ proto long getContainer()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, getContainer)
{
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }
  XmlContainer cont = This.getContainer();
  php_dbxml_set_XmlContainer_object_factory(return_value, cont TSRMLS_CC);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 11
0
/* {{{ proto long getHighBoundOperation()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, getHighBoundOperation)
{
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }
  XmlIndexLookup::Operation op = This.getHighBoundOperation();
  RETURN_LONG(op);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 12
0
/* {{{ proto XmlValue getHighBoundValue()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, getHighBoundValue)
{
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }
  XmlValue value = This.getHighBoundValue();
  php_dbxml_set_XmlValue_object_pointer(return_value, value TSRMLS_CC);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 13
0
PHP_DBXML_METHOD_BEGIN(XmlData, getReservedSize)
{
  PHP_DBXML_STUFFED_THIS(XmlData);
 
  if (ZEND_NUM_ARGS()) {
    WRONG_PARAM_COUNT;
  }

  RETURN_LONG(This.getReservedSize() );
} PHP_DBXML_METHOD_END()
Ejemplo n.º 14
0
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()
Ejemplo n.º 15
0
/* {{{ proto null setContainer()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, setContainer)
{
  zval *zv;
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);
  if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &zv, php_dbxml_XmlContainer_ce)) 
  {
    WRONG_PARAM_COUNT;
  }
  XmlContainer c = php_dbxml_get_XmlContainer_object_pointer(zv TSRMLS_CC);
  This.setContainer(c);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 16
0
/* {{{ proto string XmlIndexLookup::setNode()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, setNode)
{
  char *u, *n;
  int u_len, n_len;
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &u, &u_len, &n, &n_len)) {
    RETURN_FALSE;
  }
  This.setNode(std::string(u, u_len), std::string(n, n_len));
} PHP_DBXML_METHOD_END()
Ejemplo n.º 17
0
/* {{{ proto string XmlIndexLookup::setIndex()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, setIndex)
{
  char *i;
  int i_len;
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &i, &i_len)) {
    RETURN_FALSE;
  }
  This.setIndex(std::string(i, i_len));
} PHP_DBXML_METHOD_END()
Ejemplo n.º 18
0
PHP_DBXML_METHOD_BEGIN(XmlData, reserve)
{
  int size;
  PHP_DBXML_STUFFED_THIS(XmlData);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size)) {
    RETURN_FALSE;
  }

  This.reserve(size);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 19
0
/* {{{ proto null setHighBound()
 */
PHP_DBXML_METHOD_BEGIN(XmlIndexLookup, setHighBound)
{
  zval *zv;
  long op;
  PHP_DBXML_STUFFED_THIS(XmlIndexLookup);
  if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &zv, php_dbxml_XmlValue_ce, &op)) 
  {
    WRONG_PARAM_COUNT;
  }
  XmlValue v = php_dbxml_get_XmlValue_object_pointer(zv TSRMLS_CC);
  This.setHighBound(v, (XmlIndexLookup::Operation) op);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 20
0
/* {{{ 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()
Ejemplo n.º 21
0
PHP_DBXML_METHOD_BEGIN(XmlData, append)
{
  char *data;
  int data_len;
  PHP_DBXML_STUFFED_THIS(XmlData);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len)) {
    RETURN_FALSE;
  }

  This.append(data, data_len);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 22
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, equals)
{
  zval *zdoc = NULL;	
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  if(FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O",
				      &zdoc, php_dbxml_XmlDocument_ce)) {
    return;
  }
  XmlDocument other =
	  php_dbxml_get_XmlDocument_object_pointer(zdoc TSRMLS_CC);
  RETURN_BOOL(This == other);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 23
0
/* {{{ 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()
Ejemplo n.º 24
0
/* {{{ proto XmlTransaction XmlTransaction::createChild([int flags])
   Create a nested transaction */
PHP_DBXML_METHOD_BEGIN(XmlTransaction, createChild)
{
  long flags = 0;
  PHP_DBXML_STUFFED_THIS(XmlTransaction);

  if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags)) {
    RETURN_FALSE;
  }

  object_init_ex(return_value, php_dbxml_XmlTransaction_ce);
  XmlTransaction t = This.createChild(flags);
  php_dbxml_set_XmlTransaction_object_pointer(return_value, t TSRMLS_CC);
} PHP_DBXML_METHOD_END()
Ejemplo n.º 25
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, setMetaData)
{
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  zval *zvl = NULL, *zdat = NULL;
  char *uri, *name;
  int urilen, namelen;
  if(SUCCESS == zend_parse_parameters(
	     ZEND_NUM_ARGS() TSRMLS_CC, "ssO", 
	     &uri, &urilen, &name, &namelen,&zvl, php_dbxml_XmlValue_ce)) {
	  XmlValue vl = php_dbxml_get_XmlValue_object_pointer(zvl TSRMLS_CC);
	  This.setMetaData(std::string(uri, urilen),
			   std::string(name, namelen), vl);
  }
} PHP_DBXML_METHOD_END()
Ejemplo n.º 26
0
/* {{{ proto XmlIndexSpecification::addDefaultIndex(...)
   Adds an index */
PHP_DBXML_METHOD_BEGIN(XmlIndexSpecification, addDefaultIndex)
{
  char *index;
  int index_len;
  long type, syntax;
  PHP_DBXML_STUFFED_THIS(XmlIndexSpecification);

  if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ll", &type, &syntax)) {
    This.addDefaultIndex((XmlIndexSpecification::Type)type, (XmlValue::Type)syntax);
  } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &index, &index_len)) {
    This.addDefaultIndex(std::string(index, index_len));
  } else {
    WRONG_PARAM_COUNT;
  }
} PHP_DBXML_METHOD_END()
Ejemplo n.º 27
0
/* {{{ proto XmlIndexSpecification::replaceIndex(...)
   replaces an index */
PHP_DBXML_METHOD_BEGIN(XmlIndexSpecification, replaceIndex)
{
  char *uri, *name, *index;
  int uri_len, name_len, index_len;
  long type, syntax;
  PHP_DBXML_STUFFED_THIS(XmlIndexSpecification);

  if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ssll", &uri, &uri_len, &name, &name_len, &type, &syntax)) {
    This.replaceIndex(std::string(uri, uri_len), std::string(name, name_len), (XmlIndexSpecification::Type)type, (XmlValue::Type)syntax);
  } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sss", &uri, &uri_len, &name, &name_len, &index, &index_len)) {
    This.replaceIndex(std::string(uri, uri_len), std::string(name, name_len), std::string(index, index_len));
  } else {
    WRONG_PARAM_COUNT;
  }
} PHP_DBXML_METHOD_END()
Ejemplo n.º 28
0
PHP_DBXML_METHOD_BEGIN(XmlDocument, getMetaData)
{
  PHP_DBXML_STUFFED_THIS(XmlDocument);
  zval *zvl = NULL, *zdat = NULL;
  char *uri, *name;
  int urilen, namelen;
  if(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", 
      &uri, &urilen, &name, &namelen)) {
    XmlValue vl;
    if(This.getMetaData(std::string(uri, urilen), std::string(name, namelen), vl)) {
      php_dbxml_set_XmlValue_object_factory(return_value, vl TSRMLS_CC);
    } else {
      RETURN_FALSE;
    }
  }
} PHP_DBXML_METHOD_END()
Ejemplo n.º 29
0
/* {{{ 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()
Ejemplo n.º 30
0
/* {{{ proto XmlIndexSpecification::getIndexes(...)
   iterates indices */
PHP_DBXML_METHOD_BEGIN(XmlIndexSpecification, getIndexes)
{
  PHP_DBXML_STUFFED_THIS(XmlIndexSpecification);
  if (ZEND_NUM_ARGS() == 0) {
    std::string uri, name, index;
    array_init(return_value);
    while(This.next(uri, name, index)) {
      zval *el;
      MAKE_STD_ZVAL(el);
      array_init(el);
      add_assoc_stringl(el, "uri", (char *) uri.data(), (int)uri.length(), (int)1);
      add_assoc_stringl(el, "name", (char *) name.data(), (int)name.length(), (int)1);
      add_assoc_stringl(el, "index", (char *) index.data(), (int)index.length(), (int)1);
      add_next_index_zval(return_value, el);
    } 
    return;
  } else {
    WRONG_PARAM_COUNT;
  }
} PHP_DBXML_METHOD_END()