Merge lp:~zorba-coders/zorba/phpapi into lp:zorba
- phpapi
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~zorba-coders/zorba/phpapi |
Merge into: | lp:zorba |
Diff against target: |
628 lines (+507/-10) 8 files modified
doc/php/examples/CMakeLists.txt (+10/-3) doc/php/examples/php.ini.in (+1/-0) doc/php/examples/simple.php.in (+1/-1) doc/php/examples/test.php.in (+122/-0) swig/php/CMakeLists.txt (+18/-5) swig/php/XQueryProcessor.php (+353/-0) swig/php/generate_proxy.php.in (+1/-1) swig/php/test.xq (+1/-0) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/phpapi |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rodolfo Ochoa | Pending | ||
Matthias Brantner | Pending | ||
David Graf | Pending | ||
Review via email: mp+87718@code.launchpad.net |
This proposal supersedes a proposal from 2011-12-24.
This proposal has been superseded by a proposal from 2012-01-07.
Commit message
Description of the change
This merge adds the PHP API that was introduced at the PHP Tour 2011.
It contains a test for it (php2).
From the last merge proposal, the following things have been done:
- Revert bogus change in swig/php/
- Introduce a STD Iterator for streaming results.
- Make the parseXML() method private.
- Improve importQueryFromURI
The two key tests are:
- php1
- php2
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal | # |
William Candillon (wcandillon) wrote : | # |
> - One thing that I don't understand is the relationship with the existing PHP binding.
The low level API enables us to extend/debug the XQueryProcessor API more easily.
> - The first three changes in swig/php/
This is fixed in commit 10597.
> - executeToURI is only capable of writing to files. Also, it currently doesn't stream.
This is fixed in commit 10598.
> - importQueryFromURI only works for file URIs.
This is fixed in commit 10600. There is a test for it in commit 10601.
> - The parse functionality should probably be removed. It merges two functionalities which don't really belong together (retrieving of data and parsing xml). The latter can also be done in XQuery. If this philosophy is to push more functionality into XQuery, the parse functionality should be removed or made symmetric to the existing C++ and XQuery data manager APIs.
This is fixed in commit 10598. Unfortunately there two orthogonal things in commit 10598.
> - getItem doesn't have a comment and is incomplete. Shouldn't it support more/all XQuery types?
It should support any kind of PHP type. Currently objects are not supported. Maybe in the futur we will introduce support for objects.
- 10607. By Matthias Brantner
-
Bug #911956: Zorba fails to build with gcc 4.7.0 Approved: Till Westmann, Matthias Brantner
- 10608. By Markos Zaharioudakis
-
fixed bug in no-copy rule + made zorba cmd use the for-serializati
on-only mode Approved: Markos Zaharioudakis - 10609. By Gabriel Petrovay
-
Fixed libedit search on mac issue.
Added history support from libedit for UNIX platforms.
Approved: David Graf, Gabriel Petrovay - 10610. By Markos Zaharioudakis
-
moved atomic type codes enum to the store api Approved: Markos Zaharioudakis
- 10611. By Chris Hillery
-
Expose Item::getNamesp
aceBindings( ) through the public API. Approved: Matthias Brantner, Chris Hillery - 10612. By Daniel Turcanu
-
Removed test versioning/link1 to avoid bug 908062 on Windows Approved: Daniel Turcanu, Chris Hillery
- 10613. By Gabriel Petrovay
-
Implemented the stop command.
Fixed termination on Windows.
TODO: still a problem on Windows when quitting the debugger client: a zorba store is shut down and in the store destructor a lock hangs the execution of xqdb forever. Not even Ctrl-C helps (probably because everything is called from the exit function in main.cpp) Approved: David Graf, Gabriel Petrovay - 10614. By Markos Zaharioudakis
-
types-related optimization for the general comparison operator Approved: Markos Zaharioudakis
- 10615. By Chris Hillery
-
Ensure clean test run when Zorba build with ZORBA_WITH_
BIG_INTEGER. Approved: Matthias Brantner, Chris Hillery - 10616. By Markos Zaharioudakis
-
fixed timing bug in zorbacmd Approved: Markos Zaharioudakis
- 10617. By Markos Zaharioudakis
-
fixed bug in detecting mutually recursive functions Approved: Markos Zaharioudakis
- 10618. By Markos Zaharioudakis
-
fixed bug in no-copy rule Approved: Markos Zaharioudakis
- 10619. By Markos Zaharioudakis
-
Fixed bug 917923 (bug in copying outer var values into the eval dynamic context) Approved: Markos Zaharioudakis
- 10620. By Gabriel Petrovay
-
Added Ctrl-C hooking in the debugger. Ctrl-C can not kill the debugger anymore. It will only stop the running query. Approved: David Graf, Gabriel Petrovay
- 10621. By William Candillon
-
This merge adds the PHP API that was introduced at the PHP Tour 2011. Approved: Rodolfo Ochoa, William Candillon
- 10622. By Chris Hillery
-
This merge adds the PHP API that was introduced at the PHP Tour 2011. Approved: Rodolfo Ochoa, William Candillon
- 10623. By Sorin Marian Nasoi <email address hidden>
-
Added the information about the Zorba module version in the generated XQDoc documentation. Approved: William Candillon, Sorin Marian Nasoi
- 10624. By Markos Zaharioudakis
-
fix for bug #919189 Approved: Markos Zaharioudakis
- 10625. By Markos Zaharioudakis
-
fix for bug #866423 Approved: Markos Zaharioudakis
- 10626. By Matthias Brantner
-
fn:serialize avoids copying the result but returns a streamable string instead Approved: Till Westmann, Matthias Brantner
- 10627. By Matthias Brantner
-
Implemented StaticContext:
:getNamespaceBi ndings to resolve bug #905035. In the same commit, the function getNamespaceURI ByPrefix was deprecated because it's superseded by the new function. Approved: Rodolfo Ochoa, Markos Zaharioudakis - 10628. By Markos Zaharioudakis
-
fix for bug #866932 (string pool not empty on shutdown)
Approved: Markos Zaharioudakis - 10629. By Chris Hillery
-
Remove test case sc3_ex3 in order to merge the removal of the non-core JSON module. sc3_ex3 will be re-added along with the core JSON module. Approved: Paul J. Lucas, Chris Hillery
- 10630. By Markos Zaharioudakis
-
More types-related optimizations for the comparison operators Approved: Markos Zaharioudakis
- 10631. By Markos Zaharioudakis
-
Fixed bug involving positional var and groupby Approved: Markos Zaharioudakis
- 10632. By Chris Hillery
-
- updated the import scripts to use the latest version of XQTS, XQUTS and XQFTTS as of 25.01.2012
- added EXPECTED_FAILURES for XQFTTS XQuery and XQueryX tests
- updated the W3C conformance documentation
- included fix for the XQFTTS XQueryX tests created by Daniel in lp:~zorba-coders/zorba/xqueryx_fulltext branch Approved: Chris Hillery, Sorin Marian Nasoi - 10633. By Markos Zaharioudakis
-
type-related optimizagtions of boolean iterators Approved: Markos Zaharioudakis
- 10634. By Paul J. Lucas
-
Migrated several unit tests to libunittest. Approved: Chris Hillery, Paul J. Lucas
- 10635. By Chris Hillery
-
Fix filename when creating library for unversioned module. Approved: Dennis Knochenwefel, Chris Hillery
- 10636. By Markos Zaharioudakis
-
type-related optimizations for sequence-type iterators Approved: Markos Zaharioudakis
- 10637. By Paul J. Lucas
-
Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator) Approved: Matthias Brantner, Paul J. Lucas
- 10638. By Chris Hillery
-
Install the XHTML DTD locally so we don't ask w3.org for it. Approved: Chris Hillery, Sorin Marian Nasoi
- 10639. By Chris Hillery
-
Added DECLARE_
ZORBA_URI_ FILE() for installing files of any type that we would like to load by URI. Also made built-in URI mappers look on the filesystem for any kind of URIs, not just modules and schemas. Approved: Cezar Andrei, Chris Hillery - 10640. By Daniel Turcanu
-
several fixes for the plan serializer + implemented materialize_
clause: :clone( ) Approved: Matthias Brantner, Chris Hillery - 10641. By Markos Zaharioudakis
-
w3c test modules-
schema- context now passes Approved: Markos Zaharioudakis - 10642. By Ghislain Fourny
-
Correcting two typos (parameter name and document debug output). Approved: Ghislain Fourny, Matthias Brantner
- 10643. By William Candillon
-
Fix for bug #918592 Approved: Chris Hillery, Rodolfo Ochoa
- 10644. By Chris Hillery
-
Several fixes related to test breakages caused by zorba-xquery.com changes:
1. Don't attempt HTTP resolution w/ HttpStream if Zorba compiled without CURL.
2. store/example_3 test: load content from zorbatest site like other tests.
3. fetch_bogus2 and impot5 test: change "ver" test module to be identified with a flworfound.org URI, so we'll get a 404 when loading it wrong. (Both example.com and zorba-xquery.com don't return 404 for unknown URLs.)
Approved: Matthias Brantner, Chris Hillery - 10645. By Rodolfo Ochoa
-
Added recognition for URIs without authority, this is a JAVA URI case. Approved: Rodolfo Ochoa, Cezar Andrei
- 10646. By Rodolfo Ochoa
-
added
#include "stdafx.h"and changed uri_util.h having
ZORBA_DLL_PUBLIC extern char const uri_safe[];
ZORBA_DLL_PUBLIC extern signed char const hex2dec[]; Approved: Cezar Andrei, Matthias Brantner - 10647. By Sorin Marian Nasoi <email address hidden>
-
Downloaded the latest version of the W3C Working Draft 13 December 2011for XQuery 3.0 F&O to be used in test "xquery_3_0". Approved: Juan Zacarias, Sorin Marian Nasoi
- 10648. By Ghislain Fourny
-
Using GET_PUL_FACTORY macro. Approved: Markos Zaharioudakis
- 10649. By Markos Zaharioudakis
-
optimization for the Item::add/
removeReference methods Approved: Markos Zaharioudakis - 10650. By Chris Hillery
-
Ensure same module is not declared twice with the same version number (including twice with no declared version).
Approved: Sorin Marian Nasoi, Chris Hillery - 10651. By Chris Hillery
-
Download v1.0 of http-client. Approved: Sorin Marian Nasoi, Chris Hillery
- 10652. By Ghislain Fourny
-
Made same-directory simple store includes. Approved: Matthias Brantner, Markos Zaharioudakis
- 10653. By Paul J. Lucas
-
Simple fix. Approved: William Candillon, Paul J. Lucas
- 10654. By Markos Zaharioudakis
-
use SUBSEQUENCE_INT function, instead of SUBSEQUENCE_INT in partial_eval_eq rewrite rule Approved: Markos Zaharioudakis
- 10655. By Paul J. Lucas
-
Added clone(). Approved: Matthias Brantner, William Candillon
- 10656. By Markos Zaharioudakis
-
small optimization for subsequence iterators Approved: Markos Zaharioudakis
- 10657. By Markos Zaharioudakis
-
1. Optimization: preallocate and reuse temp sequence iterator for LetVarITerator and CtxVarIterator.
2. Optimization: enhanced push-down of positional predicate into LetVarITerator and CtxVarIterator. Approved: Markos Zaharioudakis - 10658. By Markos Zaharioudakis
-
Fixed bug #872288 Approved: Markos Zaharioudakis
- 10659. By Till Westmann
-
added a new unit test for the plan serializer Approved: Matthias Brantner, Till Westmann
- 10660. By Markos Zaharioudakis
-
Fixed bug #867022 Approved: Markos Zaharioudakis
- 10661. By Markos Zaharioudakis
-
fix for bug #867266 Approved: Markos Zaharioudakis
- 10662. By Paul J. Lucas
-
New JSON parser and module. Approved: Sorin Marian Nasoi, Paul J. Lucas
- 10663. By Paul J. Lucas
-
- Added transcode_streambuf
- file:read-text now respects encodings
- http:send-request now respects encodings Approved: Matthias Brantner, Paul J. Lucas - 10664. By Markos Zaharioudakis
-
Optimization: changed the implementation of the free-vars annotation and got rid of the annotations map in expressions Approved: Markos Zaharioudakis
- 10665. By Matthias Brantner
-
Put the state file written by the uuid functionality into the system's temp directory (temporary solution). Approved: Till Westmann, Matthias Brantner
- 10666. By Paul J. Lucas
-
Fixed return type. Approved: Juan Zacarias, Matthias Brantner, Paul J. Lucas
- 10667. By Matthias Brantner
-
added two api functions to introspect the functions of a static context Approved: Till Westmann, Matthias Brantner
- 10668. By William Candillon <email address hidden>
-
Fix typos in doxygen documentation. Approved: Cezar Andrei, Matthias Brantner
- 10669. By William Candillon
-
Update the XQDDF ebnf to fit with XQuery 3.0 syntax. Approved: William Candillon, Matthias Brantner
- 10670. By William Candillon
-
Add support for return and parameters elements in XQDoc. Approved: William Candillon, Sorin Marian Nasoi
- 10671. By Rodolfo Ochoa
-
Just some precompiled headers included Approved: Matthias Brantner, Cezar Andrei
- 10672. By William Candillon
-
XQuery 3.0 concat operator Approved: Matthias Brantner, William Candillon
- 10673. By David Graf
-
Added the new external variable value tests that will be added to the w3c testsuite to the zorba rbkt tests. Inclusive the failing once. Added launchpad entries for them and marked the tests as expected failures. Approved: Matthias Brantner, David Graf
- 10674. By Chris Hillery
-
Update data-cleaning module to release 1.0 (fixes conversion tests).
Approved: Sorin Marian Nasoi, Chris Hillery - 10675. By William Candillon
-
Add --compile-plan and --execute-plan option to zorba command line.
Example:
zorba -q 1+1 --compile-plan > test.xqc
zorba -q test.xqc -f --execute-plan Approved: William Candillon, Matthias Brantner - 10676. By Chris Hillery
-
Error checking for DownloadModules
.cmake; try three times on failures.
Approved: Sorin Marian Nasoi, Chris Hillery - 10677. By Matthias Brantner
-
more efficient implementation of xs:base64Binary items Approved: Till Westmann, Matthias Brantner
- 10678. By Ghislain Fourny
-
Makes same-directory store includes in the headers as well. Approved: Till Westmann, Matthias Brantner
- 10679. By Markos Zaharioudakis
-
Fixed bug in codegen: do not create a materialize clause if one exists already Approved: Markos Zaharioudakis
- 10680. By William Candillon
-
Remove conflicting shortcut -e for --execute-plan option. Approved: Matthias Brantner, William Candillon
- 10681. By Ghislain Fourny
-
Replacing ulong positions with xs_integer for positions in collections. Approved: Ghislain Fourny, Matthias Brantner
- 10682. By Ghislain Fourny
-
Refactored CollectionSet class. zorba::
store:: CollectionSet is abstract, zorba:: simplestore: :SimpleCollecti onSet is its implementation for the simple store. Approved: Matthias Brantner, Till Westmann - 10683. By Paul J. Lucas
-
Fixed bug 942808. Approved: Matthias Brantner, Paul J. Lucas
- 10684. By Markos Zaharioudakis
-
removed properties-
generating scripts and restored zorba_properties.h and store_properties.h files. Approved: Markos Zaharioudakis - 10685. By Daniel Turcanu
-
Making https work on Windows. Approved: Gabriel Petrovay, Sorin Marian Nasoi
- 10686. By Ghislain Fourny
-
Refactored QName pool and QNameItem class. Approved: Markos Zaharioudakis
- 10687. By Sorin Marian Nasoi <email address hidden>
-
Updated the web crawler tutorial. Approved: Nicolae Brinza, Sorin Marian Nasoi
- 10688. By William Candillon
-
Optimize iterator generation for the concat operator (fixes bug #942011) Approved: Matthias Brantner, Markos Zaharioudakis
- 10689. By Paul J. Lucas
-
Better implementation of ZORBA_WITH_
BIG_INTEGER= OFF: now limited to 63 bits (for a 64-bit implementation of a long long). Also added build_options.dox. Approved: Markos Zaharioudakis, Matthias Brantner - 10690. By Markos Zaharioudakis
-
fixed bug involing eval and the no-copy rule Approved: Markos Zaharioudakis
- 10691. By Matthias Brantner
-
fix for bug #943788 (streamable string is not seekable) Approved: Till Westmann, Matthias Brantner
- 10692. By Federico Cavalieri <federico@M702X>
-
Fixed bug #912579 (validate-in-place on non-root elements)
Fixed merge of updput primitives
Fixed merge conflict. Approved: Markos Zaharioudakis, Cezar Andrei - 10693. By Markos Zaharioudakis
-
Added test that illustrates bug #944002 Approved: Markos Zaharioudakis
- 10694. By Markos Zaharioudakis
-
Fixed another bug involving eval and the no-copy rule Approved: Markos Zaharioudakis
- 10695. By Paul J. Lucas
-
Added ~XmlNodeTokeniz
erCallback( ) to destroy tokenizers. Approved: Matthias Brantner, Paul J. Lucas - 10696. By Ghislain Fourny
-
Introduces an abstract layer between zorba::
store:: collection and zorba:: simplestore: :SimpleCollecti on. Approved: Matthias Brantner, Markos Zaharioudakis - 10697. By Markos Zaharioudakis
-
fixed bug #944002
Approved: Markos Zaharioudakis - 10698. By Ghislain Fourny
-
Making two non-abstract functions in simplecollection API also non-virtual. Approved: Matthias Brantner, Markos Zaharioudakis
- 10699. By Ghislain Fourny
-
Added default constructors for index classes in simple store. Approved: Markos Zaharioudakis, Matthias Brantner
- 10700. By Markos Zaharioudakis
-
Fixed bug #867024 Approved: Markos Zaharioudakis
- 10701. By Sorin Marian Nasoi <email address hidden>
-
Fixed bug lp:946896. Approved: William Candillon, Sorin Marian Nasoi
- 10702. By Markos Zaharioudakis
-
Fixed memory leak in no-copy rule Approved: Markos Zaharioudakis
- 10703. By Matthias Brantner
-
A new module that provides URL-related functions. Currently, it provides functions to do URL-decoding but other URL-related functions (e.g. to retrieve the scheme or path) will be added later. Approved: Matthias Brantner, Chris Hillery
- 10704. By Markos Zaharioudakis
-
fixes bug 924987
- extended TypeIdentifier to also support schema-element, schema-attribute
and namespace-node sequence types
- fixed TypeOps::get_type_ identifier
- added a test to the staticcollectionmanager unit test
- added operator<< for TypeIdentifier Approved: Markos Zaharioudakis, Till Westmann - 10705. By Paul J. Lucas
-
Set dispose_
data_using_ delete_ = false in reserve(). Approved: Markos Zaharioudakis, Matthias Brantner - 10706. By Cezar Andrei <email address hidden>
-
Fix for bug 891209 : validation with xsi:type returns untyped. Approved: Matthias Brantner, Markos Zaharioudakis, Cezar Andrei
- 10707. By Sorin Marian Nasoi <email address hidden>
-
- fixed the test 'moduleDocument
ation': all modules that appear in ZorbaManifest.xml are checked for correct XQDoc documentation
- re-enabled the 'moduleDocumentation' test that was previously disabled. Approved: Sorin Marian Nasoi, Chris Hillery - 10708. By Markos Zaharioudakis
-
bug fixes: some methods in atomic_item.h should have been virtual + use myChild local var in children iterators" Approved: Markos Zaharioudakis
- 10709. By Paul J. Lucas
-
Added links to full-text documentation. Approved: Matthias Brantner, Paul J. Lucas
- 10710. By Paul J. Lucas
-
fix Bug #949111: getUnsignedIntV
alue() not implemented for Integer Approved: Matthias Brantner, Paul J. Lucas - 10711. By Paul J. Lucas
-
Added delete theSerStream; Approved: Matthias Brantner, Paul J. Lucas
- 10712. By Sorin Marian Nasoi <email address hidden>
-
Fix for bug lp:948712: Added a way for easy copy&paste of the import schema statements. Approved: Matthias Brantner, Sorin Marian Nasoi
- 10713. By Matthias Brantner
-
StaticCollectio
nManager: :declaredIndexe s() doesn't return temporary indexes anymore. Also isDeclaredIndex also doesn't return true if asked whether a temporary index is declared. Approved: Till Westmann, Matthias Brantner - 10714. By Matthias Brantner
-
- fix bug #938934 "collection dml:truncate function missing"
- fixes documentation bug: raise zerr:ZDDY0003 instead of zerr:ZDDY0009 Approved: Till Westmann, Markos Zaharioudakis, Matthias Brantner - 10715. By Matthias Brantner
-
fixed bug #951772 Comment node crashes serialization) Approved: William Candillon, Matthias Brantner
- 10716. By Matthias Brantner
-
Fixed bug #952829 (Nondeterministic annotation doesn't seem to be checked) Approved: Matthias Brantner, William Candillon
- 10717. By Rodolfo Ochoa
-
This fixes the error:
n strings remain in the pool.
and change it to a more comprehensive error with reference to document that helps to prevent the error. Approved: Matthias Brantner, Markos Zaharioudakis, Cezar Andrei - 10718. By Markos Zaharioudakis
-
Fixed bug #948259 Approved: Markos Zaharioudakis
- 10719. By Ghislain Fourny
-
Introduced function OrdPathNode:
:getDescendantN odeByOrdPath (from Sausalito). Approved: Markos Zaharioudakis, Matthias Brantner - 10720. By Matthias Brantner
-
2.2 release preparations Approved: Chris Hillery, Matthias Brantner
- 10721. By Rodolfo Ochoa
-
- Fixed bug for PHP wrapper pointing to a wrong DLL name
- Fixed precompiled headers bug
- Fixed warning -> Conversion Int to Bool - Performance warning Approved: Cezar Andrei, William Candillon, Matthias Brantner - 10722. By William Candillon
-
Minor update of the PHP example page.
Unmerged revisions
Preview Diff
1 | === modified file 'doc/php/examples/CMakeLists.txt' |
2 | --- doc/php/examples/CMakeLists.txt 2011-08-19 00:03:31 +0000 |
3 | +++ doc/php/examples/CMakeLists.txt 2012-01-07 17:53:24 +0000 |
4 | @@ -20,14 +20,21 @@ |
5 | MESSAGE(STATUS "PHP Path:" ${phpPath}) |
6 | SET(phpExtensionPath ${CMAKE_BINARY_DIR}/swig/php) |
7 | MESSAGE(STATUS "PHP Extension Path: " ${phpExtensionPath}) |
8 | + SET(phpIncludePath ${CMAKE_BINARY_DIR}/swig/php) |
9 | + MESSAGE(STATUS "PHP Include Path: " ${phpExtensionPath}) |
10 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/php.ini.in ${CMAKE_CURRENT_BINARY_DIR}/php.ini) |
11 | MESSAGE(STATUS "Configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/php.ini) |
12 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/simple.php.in ${CMAKE_CURRENT_BINARY_DIR}/simple.php) |
13 | MESSAGE(STATUS "Simple configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php) |
14 | - ADD_TEST("php" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php) |
15 | + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test.php.in ${CMAKE_CURRENT_BINARY_DIR}/test.php) |
16 | + MESSAGE(STATUS "PHP test file configured: " ${CMAKE_CURRENT_BINARY_DIR}/test.php) |
17 | + ADD_TEST("php1" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php) |
18 | MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php) |
19 | - |
20 | - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/simple.php |
21 | + ADD_TEST("php2" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/test.php) |
22 | + MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/test.php) |
23 | + |
24 | + |
25 | + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/simple.php ${CMAKE_CURRENT_BINARY_DIR}/test.php |
26 | COMPONENT "php_examples" |
27 | DESTINATION |
28 | share/doc/zorba-${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER}/php/examples) |
29 | |
30 | === modified file 'doc/php/examples/php.ini.in' |
31 | --- doc/php/examples/php.ini.in 2009-10-30 16:34:37 +0000 |
32 | +++ doc/php/examples/php.ini.in 2012-01-07 17:53:24 +0000 |
33 | @@ -1,2 +1,3 @@ |
34 | enable_dl=On |
35 | extension_dir=@phpExtensionPath@ |
36 | +include_path=".:@phpIncludePath@" |
37 | \ No newline at end of file |
38 | |
39 | === modified file 'doc/php/examples/simple.php.in' |
40 | --- doc/php/examples/simple.php.in 2011-08-04 02:14:56 +0000 |
41 | +++ doc/php/examples/simple.php.in 2012-01-07 17:53:24 +0000 |
42 | @@ -14,7 +14,7 @@ |
43 | * See the License for the specific language governing permissions and |
44 | * limitations under the License. |
45 | */ |
46 | -require '@phpPath@/zorba_api_wrapper.php'; |
47 | +require '@phpPath@/Zorba/zorba_api_wrapper.php'; |
48 | |
49 | function example_1(Zorba $aZorba) |
50 | { |
51 | |
52 | === added file 'doc/php/examples/test.php.in' |
53 | --- doc/php/examples/test.php.in 1970-01-01 00:00:00 +0000 |
54 | +++ doc/php/examples/test.php.in 2012-01-07 17:53:24 +0000 |
55 | @@ -0,0 +1,122 @@ |
56 | +<?php |
57 | +/* |
58 | + * Copyright 2006-2008 The FLWOR Foundation. |
59 | + * |
60 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
61 | + * you may not use this file except in compliance with the License. |
62 | + * You may obtain a copy of the License at |
63 | + * |
64 | + * http://www.apache.org/licenses/LICENSE-2.0 |
65 | + * |
66 | + * Unless required by applicable law or agreed to in writing, software |
67 | + * distributed under the License is distributed on an "AS IS" BASIS, |
68 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
69 | + * See the License for the specific language governing permissions and |
70 | + * limitations under the License. |
71 | + */ |
72 | +require '@phpPath@/Zorba/XQueryProcessor.php'; |
73 | + |
74 | +function omitXMLDecl($xml) |
75 | +{ |
76 | + $xml = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $xml); |
77 | + $xml = trim($xml); |
78 | + return $xml; |
79 | +} |
80 | + |
81 | +function assertEquality($test, $reference, $label) |
82 | +{ |
83 | + $test = omitXMLDecl($test); |
84 | + echo "=====================================\n"; |
85 | + var_dump($test); |
86 | + var_dump($reference); |
87 | + if($test != $reference) { |
88 | + throw new Exception( |
89 | + "Test " |
90 | + . $label |
91 | + . " failed. Result:\n" |
92 | + . $test |
93 | + . "\nDoesn't match reference:\n" |
94 | + . $reference |
95 | + ); |
96 | + } |
97 | +} |
98 | +/* Test 1 */ |
99 | +$xquery = new XQueryProcessor(); |
100 | +$xquery->importQuery('1+1'); |
101 | +$result = $xquery->execute(); |
102 | +assertEquality($result, '2', "1+1"); |
103 | + |
104 | +/* Test 2 */ |
105 | +$query = <<<'XQ' |
106 | +declare variable $foo as xs:string external; |
107 | +declare variable $bar as xs:integer external; |
108 | +declare variable $doc1 as document-node() external; |
109 | +declare variable $doc2-str as xs:string external; |
110 | +declare variable $doc2 as document-node() := parse-xml($doc2-str); |
111 | + |
112 | +$foo, $bar, $doc1 , $doc2 |
113 | +XQ; |
114 | + |
115 | +$xquery->importQuery($query); |
116 | + |
117 | +$xquery->setVariable("foo", "bar"); |
118 | +$xquery->setVariable("bar", 3); |
119 | + |
120 | +$doc = simplexml_load_string('<root />'); |
121 | +$xquery->setVariable("doc1", $doc); |
122 | + |
123 | +$doc = "<root />"; |
124 | +$xquery->setVariable("doc2-str", $doc); |
125 | + |
126 | +$result = trim($xquery->execute()); |
127 | +assertEquality($result, "bar 3<root/><root/>", "Test PHP Types Mapping"); |
128 | + |
129 | +/* Test 3 */ |
130 | +$xquery->importQuery("(1, 2, <foo bar='bar' />)"); |
131 | +$it = $xquery->getIterator(); |
132 | + |
133 | +foreach($it as $pos => $value) { |
134 | + switch($pos) { |
135 | + case 0: |
136 | + assertEquality($value, "1", "Consume the item at position {$pos}"); |
137 | + break; |
138 | + case 1: |
139 | + assertEquality($value, "2", "Consume the item at position {$pos}"); |
140 | + break; |
141 | + case 3: |
142 | + assertEquality($value, '<foo bar="bar"/>', "Consume the item at position {$pos}"); |
143 | + break; |
144 | + } |
145 | +} |
146 | + |
147 | +//Let's do it again |
148 | +$it = $xquery->getIterator(); |
149 | + |
150 | +foreach($it as $pos => $value) { |
151 | + switch($pos) { |
152 | + case 0: |
153 | + assertEquality($value, "1", "Consume the item at position {$pos}"); |
154 | + break; |
155 | + case 1: |
156 | + assertEquality($value, "2", "Consume the item at position {$pos}"); |
157 | + break; |
158 | + case 3: |
159 | + assertEquality($value, '<foo bar="bar"/>', "Consume the item at position {$pos}"); |
160 | + break; |
161 | + } |
162 | +} |
163 | + |
164 | +//Try the same query with execute |
165 | +$result = $xquery->execute(); |
166 | +assertEquality($result, "1 2<foo bar=\"bar\"/>", "Execute To URI"); |
167 | + |
168 | +/* Test 4 */ |
169 | +$xquery->importQueryFromURI("@phpPath@/test.xq"); |
170 | +$result = $xquery->execute(); |
171 | +assertEquality($result, "2", "Test importQueryFromURI"); |
172 | + |
173 | +/* Test 5 */ |
174 | +//$xquery->importQueryFromURI("http://zorba.s3.amazonaws.com/test.xq"); |
175 | +//$result = $xquery->execute(); |
176 | +//assertEquality($result, "2", "Test importQueryFromURI"); |
177 | +?> |
178 | |
179 | === modified file 'swig/php/CMakeLists.txt' |
180 | --- swig/php/CMakeLists.txt 2011-12-21 14:40:33 +0000 |
181 | +++ swig/php/CMakeLists.txt 2012-01-07 17:53:24 +0000 |
182 | @@ -38,6 +38,9 @@ |
183 | SWIG_LINK_LIBRARIES (zorba_api ${PHP5_LIBRARY}) |
184 | ENDIF (WIN32) |
185 | |
186 | + #Copy test to the build folder |
187 | + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/test.xq" "${CMAKE_CURRENT_BINARY_DIR}/test.xq") |
188 | + |
189 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h") |
190 | CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h") |
191 | |
192 | @@ -55,20 +58,23 @@ |
193 | |
194 | INSTALL ( |
195 | FILES |
196 | - ${CMAKE_CURRENT_BINARY_DIR}/zorba_api_wrapper.php |
197 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php |
198 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php |
199 | ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}zorba_api.so |
200 | DESTINATION ${PHP5_INSTALL_PATH} |
201 | ) |
202 | ELSE (NOT WIN32 OR CYGWIN) |
203 | IF (MSVC_IDE) |
204 | INSTALL ( FILES |
205 | - ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.php |
206 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php |
207 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php |
208 | ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/zorba_api.dll |
209 | COMPONENT "php_swig" |
210 | DESTINATION share/php ) |
211 | ELSE (MSVC_IDE) |
212 | INSTALL ( FILES |
213 | - ${CMAKE_CURRENT_BINARY_DIR}/zorba_api.php |
214 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php |
215 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php |
216 | ${CMAKE_CURRENT_BINARY_DIR}/php_zorba_api.dll |
217 | COMPONENT "php_swig" |
218 | DESTINATION share/php ) |
219 | @@ -77,6 +83,7 @@ |
220 | |
221 | ### Start PHP proxy generation |
222 | # Configure the test file |
223 | + SET (phpLibPrefix ${ZORBA_SWIG_LIB_PREFIX}) |
224 | SET (phpAPIPath ${CMAKE_CURRENT_BINARY_DIR}) |
225 | SET (phpLibPrefix ${ZORBA_SWIG_LIB_PREFIX}) |
226 | CONFIGURE_FILE ( |
227 | @@ -84,8 +91,13 @@ |
228 | ${CMAKE_CURRENT_BINARY_DIR}/generate_proxy.php |
229 | ) |
230 | |
231 | + CONFIGURE_FILE ( |
232 | + ${CMAKE_CURRENT_SOURCE_DIR}/XQueryProcessor.php |
233 | + ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php |
234 | + ) |
235 | + |
236 | ADD_CUSTOM_COMMAND ( |
237 | - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zorba_api_wrapper.php |
238 | + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php |
239 | # the following addes a dependency to the *.cxx file that is generated by swig |
240 | DEPENDS ${swig_generated_file_fullname} |
241 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate_proxy.php.in |
242 | @@ -94,7 +106,8 @@ |
243 | ) |
244 | ADD_CUSTOM_TARGET ( |
245 | Api_PHP_Wrapper ALL |
246 | - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zorba_api_wrapper.php |
247 | + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Zorba/zorba_api_wrapper.php |
248 | + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Zorba/XQueryProcessor.php |
249 | ) |
250 | ### End PHP proxy generation |
251 | |
252 | |
253 | === added file 'swig/php/XQueryProcessor.php' |
254 | --- swig/php/XQueryProcessor.php 1970-01-01 00:00:00 +0000 |
255 | +++ swig/php/XQueryProcessor.php 2012-01-07 17:53:24 +0000 |
256 | @@ -0,0 +1,353 @@ |
257 | +<?php |
258 | +require_once 'Zorba/zorba_api_wrapper.php'; |
259 | + |
260 | +class XQueryCompilerException extends Exception{} |
261 | +class XQueryProcessorException extends Exception{} |
262 | + |
263 | +/** |
264 | + * Iterate over an instance of the XML Data Model (i.e, a sequence of items). |
265 | + * This class implements the SPL Iterator interface. |
266 | + * |
267 | + * The following code snippet iterates over a small sequence of items. |
268 | + * <code> |
269 | + * <?php |
270 | + * require_once 'Zorba/XQueryProcessor.php'; |
271 | + * |
272 | + * $xquery = new XQueryProcessor(); |
273 | + * $xquery->importQuery('(1, 2, 3)'); |
274 | + * |
275 | + * $iterator = $xquery->getIterator(); |
276 | + * foreach($it as $key => $value) { |
277 | + * echo $value."\n"; |
278 | + * } |
279 | + * ?> |
280 | + * </code> |
281 | + */ |
282 | +class XQueryIterator implements Iterator { |
283 | + |
284 | + private $xquery = null; |
285 | + private $iterator = null; |
286 | + private $item = null; |
287 | + private $position = 0; |
288 | + private $valid = false; |
289 | + |
290 | + public function __construct(XQuery $xquery) |
291 | + { |
292 | + $this->xquery = $xquery; |
293 | + $this->item = Item::createEmptyItem(); |
294 | + } |
295 | + |
296 | + public function __destruct() |
297 | + { |
298 | + $this->xquery->destroy(); |
299 | + } |
300 | + |
301 | + public function rewind() |
302 | + { |
303 | + if ($this->iterator != null) { |
304 | + $this->iterator->close(); |
305 | + $this->iterator->destroy(); |
306 | + } |
307 | + |
308 | + $this->position = 0; |
309 | + $this->iterator = $this->xquery->iterator(); |
310 | + $this->iterator->open(); |
311 | + $this->valid = $this->iterator->next($this->item); |
312 | + } |
313 | + |
314 | + public function current() |
315 | + { |
316 | + return $this->item->serialize(); |
317 | + } |
318 | + |
319 | + public function key() |
320 | + { |
321 | + return $this->position; |
322 | + } |
323 | + |
324 | + public function next() |
325 | + { |
326 | + ++$this->position; |
327 | + $this->valid = $this->iterator->next($this->item); |
328 | + } |
329 | + |
330 | + public function valid() |
331 | + { |
332 | + return $this->valid; |
333 | + } |
334 | +} |
335 | + |
336 | +/** |
337 | + * The XQueryProcessor class allows to invoke |
338 | + * <a href="http://www.zorba-xquery.com">Zorba XQuery Processor</a>. |
339 | + * |
340 | + * Instruction to install the extension can be found at <a href=""></a>. |
341 | + * |
342 | + * The following code snippet executes a small <em>Hello World</em> program: |
343 | + * <code> |
344 | + * <?php |
345 | + * require_once 'ZorbaXQueryProcessor.php'; |
346 | + * |
347 | + * $xquery = new XQueryProcessor(); |
348 | + * |
349 | + * $query = <<<'XQ' |
350 | + * declare variable $name external; |
351 | + * |
352 | + * <h1>Hello {$name}</h1> |
353 | + * XQ; |
354 | + * |
355 | + * $xquery->importQuery($query); |
356 | + * |
357 | + * $xquery->setVariable('name', 'World'); |
358 | + * |
359 | + * echo $xquery->execute(); |
360 | + * ?> |
361 | + * </code> |
362 | + */ |
363 | +class XQueryProcessor { |
364 | + |
365 | + private $store = null; |
366 | + private $zorba = null; |
367 | + private $query = null; |
368 | + private $variables = array(); |
369 | + |
370 | + /** |
371 | + * Creates an XQueryProcessor instance. |
372 | + */ |
373 | + public function __construct(){ |
374 | + $this->store = InMemoryStore::getInstance(); |
375 | + $this->zorba = Zorba::getInstance($this->store); |
376 | + } |
377 | + |
378 | + /** |
379 | + * Shutdowns the XQueryProcessor instance. |
380 | + */ |
381 | + public function __destruct() { |
382 | + $this->zorba->shutdown(); |
383 | + InMemoryStore::shutdown($this->store); |
384 | + } |
385 | + |
386 | + /** |
387 | + * Import a query to execute. |
388 | + * For instance, the following code snippets imports and executes the query '1+1': |
389 | + * <code> |
390 | + * $xquery = new ZorbaXQueryProcessor(); |
391 | + * |
392 | + * $xquery->importQuery('1+1'); |
393 | + * |
394 | + * echo $xquery->execute() . '\n'; |
395 | + * </code> |
396 | + * In the following code snippet, the following code snippets imports and execute an <em>Hello World</em> query: |
397 | + * <code> |
398 | + * <?php |
399 | + * $xquery = new XQueryProcessor(); |
400 | + * |
401 | + * $query = <<<'XQ' |
402 | + * let $world := 'World' |
403 | + * return <h1>Hello {$world}</h1> |
404 | + * XQ; |
405 | + * |
406 | + * $xquery->importQuery($query); |
407 | + * |
408 | + * echo $xquery->execute() . '\n'; |
409 | + * ?> |
410 | + * </code> |
411 | + * |
412 | + * @param $query Query to execute. |
413 | + * @return ZorbaXQueryProcessor instance. |
414 | + */ |
415 | + public function importQuery($query) { |
416 | + if(!is_string($query)) { |
417 | + throw new XQueryProcessorException('The query parameter must be a string. For instance: XQueryProcessor->importQuery("1+1")'); |
418 | + } |
419 | + $this->query = $query; |
420 | + return $this; |
421 | + } |
422 | + |
423 | + /** |
424 | + * Import a query to execute from its filename. |
425 | + * For instance, the following code snippet imports the query file named <em>hello_word.xq</em>: |
426 | + * <code> |
427 | + * $xquery = new ZorbaXQueryProcessor(); |
428 | + * |
429 | + * $xquery->importQueryiFromURI('hello_world.xq'); |
430 | + * |
431 | + * echo $xquery->execute() . '\n'; |
432 | + * </code> |
433 | + * |
434 | + * @param $filename Filename of the query to execute. |
435 | + * @return ZorbaXQueryProcessor instance. |
436 | + */ |
437 | + public function importQueryFromURI($filename) { |
438 | + $ctx = null; |
439 | + if(func_num_args() == 2) { |
440 | + $ctx = func_get_arg(1); |
441 | + } |
442 | + $query = file_get_contents($filename, FILE_USE_INCLUDE_PATH, $ctx); |
443 | + $this->importQuery($query); |
444 | + return $this; |
445 | + } |
446 | + |
447 | + /** |
448 | + * Set value for an external variable. |
449 | + * |
450 | + * The following code snippet sets the value of the variable |
451 | + * <em>$i</em> with <em>1</em>. |
452 | + * <code> |
453 | + * $xquery = new ZorbaXQueryProcessor(); |
454 | + * |
455 | + * $query = <<<'XQ' |
456 | + * declare variable $i as xs:integer external; |
457 | + * |
458 | + * $i + 1 |
459 | + * 'XQ'; |
460 | + * |
461 | + * $xquery->importQuery($query); |
462 | + * $xquery->setVariable($i, 1); |
463 | + * |
464 | + * echo $xquery->execute() . '\n'; |
465 | + * </code> |
466 | + * |
467 | + * The following code snippet sets the value of the variable <em>$i</em> in |
468 | + * the local namespace with the value <em>1</em>. |
469 | + * <code> |
470 | + * $xquery = new ZorbaXQueryProcessor(); |
471 | + * |
472 | + * $query = <<<'XQ' |
473 | + * declare variable $local:i as xs:integer external; |
474 | + * |
475 | + * $i + 1 |
476 | + * 'XQ'; |
477 | + * |
478 | + * $xquery->importQuery($query); |
479 | + * $xquery->setVariable("http://www.w3.org/2005/xquery-local-functions", $i, 1); |
480 | + * |
481 | + * echo $xquery->execute() . '\n'; |
482 | + * </code> |
483 | + * |
484 | + * PHP types are converted to the following XML types: |
485 | + * - <b>string</b>: xs:string |
486 | + * - <b>float</b>: xs:float |
487 | + * - <b>long</b>: xs:long |
488 | + * - <b>integer</b>: xs:integer |
489 | + * - <b>boolean</b>: xs:boolean |
490 | + * - <b>DOMDocument</b>: document-node() |
491 | + * |
492 | + * @param string $namespace optional Namespace URI of the external variable. |
493 | + * @param string $name Local name of the external variable. |
494 | + * @param mixed $value of the external variable. |
495 | + * |
496 | + * return ZorbaXQueryProcessor instance. |
497 | + */ |
498 | + public function setVariable($arg1, $arg2) { |
499 | + $count = func_num_args(); |
500 | + if($count == 2) { |
501 | + $name = func_get_arg(0); |
502 | + $value = func_get_arg(1); |
503 | + $this->variables['_'][$name] = $value; |
504 | + } else { |
505 | + $ns = func_get_arg(0); |
506 | + $name = func_get_arg(1); |
507 | + $value = func_get_arg(2); |
508 | + $this->variables[$ns][$name] = $value; |
509 | + } |
510 | + return $this; |
511 | + } |
512 | + |
513 | + /** |
514 | + * Execute the Query. |
515 | + * |
516 | + * @return Query result. |
517 | + */ |
518 | + public function execute() { |
519 | + //Execute |
520 | + $query = $this->compile(); |
521 | + $result = $query->execute(); |
522 | + $query->destroy(); |
523 | + return $result; |
524 | + } |
525 | + |
526 | + public function getIterator() { |
527 | + return new XQueryIterator($this->compile()); |
528 | + } |
529 | + /** |
530 | + * |
531 | + */ |
532 | + private function compile() |
533 | + { |
534 | + if(!is_string($this->query)) { |
535 | + throw new XQueryCompilerException('No Query Imported. Use XQueryProcessor->importQuery($query).'); |
536 | + } |
537 | + //Compile Query |
538 | + $query = $this->zorba->compileQuery($this->query); |
539 | + //Set Variables |
540 | + $dctx = $query->getDynamicContext(); |
541 | + foreach($this->variables as $ns => $variables){ |
542 | + foreach($variables as $name => $value) { |
543 | + if($ns == "_") $ns = ""; |
544 | + $param = $this->zorba->compileQuery("."); |
545 | + $value = $this->getItem($value); |
546 | + $param->getDynamicContext()->setContextItem($value); |
547 | + $dctx->setVariable($ns, $name, $param->iterator()); |
548 | + } |
549 | + } |
550 | + return $query; |
551 | + } |
552 | + |
553 | + /* |
554 | + * Converts a PHP value to an XQuery Item. |
555 | + * - DOMDocument & SimpleXMLElement: document-node() |
556 | + * - String: xs:string |
557 | + * - Integer: xs:integer |
558 | + * - Boolean: xs:boolean |
559 | + * - Float: xs:float |
560 | + * - Long: xs:long |
561 | + */ |
562 | + private function getItem($value) { |
563 | + $itemFactory = $this->zorba->getItemFactory(); |
564 | + |
565 | + if($value instanceof DOMDocument or $value instanceof SimpleXMLElement) { |
566 | + $value = $this->parseXML($value->saveXML()); |
567 | + } else if(is_string($value)) { |
568 | + $value = $itemFactory->createString($value); |
569 | + } else if(is_int($value)) { |
570 | + $value = $itemFactory->createInteger($value); |
571 | + } else if(is_bool($value)) { |
572 | + $value = $itemFactory->createBoolean($value); |
573 | + } else if(is_float($value)) { |
574 | + $value = $itemFactory->createFloat($value); |
575 | + } else if(is_long($value)) { |
576 | + $value = $itemFactory->createLong($value); |
577 | + } else { |
578 | + throw new XQueryCompilerException("Unsupported variable type: ".gettype($value)); |
579 | + } |
580 | + |
581 | + assert($value instanceof Item); |
582 | + |
583 | + return $value; |
584 | + } |
585 | + |
586 | + /** |
587 | + * Parse an XML string to an XQuery Item. |
588 | + * This function is used internally only. |
589 | + * @param $xml string XML string to parse. |
590 | + * |
591 | + * @return Item instance. |
592 | + */ |
593 | + private function parseXML($xml) |
594 | + { |
595 | + $lDataManager = $this->zorba->getXmlDataManager(); |
596 | + $lDocMgr = $lDataManager->getDocumentManager(); |
597 | + $iter = $lDataManager->parseXML($xml); |
598 | + |
599 | + $iter->open(); |
600 | + $doc = Item::createEmptyItem(); |
601 | + |
602 | + $iter->next($doc); |
603 | + $iter->close(); |
604 | + $iter->destroy(); |
605 | + |
606 | + return $doc; |
607 | + } |
608 | +} |
609 | +?> |
610 | |
611 | === modified file 'swig/php/generate_proxy.php.in' |
612 | --- swig/php/generate_proxy.php.in 2011-12-21 14:40:33 +0000 |
613 | +++ swig/php/generate_proxy.php.in 2012-01-07 17:53:24 +0000 |
614 | @@ -164,7 +164,7 @@ |
615 | } |
616 | } |
617 | |
618 | -file_put_contents('zorba_api_wrapper.php', $wrapper); |
619 | +file_put_contents('Zorba/zorba_api_wrapper.php', $wrapper); |
620 | |
621 | function getRefParameters(ReflectionMethod $method, array $params) { |
622 | $result = ""; |
623 | |
624 | === added file 'swig/php/test.xq' |
625 | --- swig/php/test.xq 1970-01-01 00:00:00 +0000 |
626 | +++ swig/php/test.xq 2012-01-07 17:53:24 +0000 |
627 | @@ -0,0 +1,1 @@ |
628 | +1+1 |
- One thing that I don't understand is the relationship with the existing PHP binding. generate_ proxy.php. in should be reverted (renaming of libPrefix to prefix)
- The first three changes in swig/php/
- executeToURI is only capable of writing to files. Also, it currently doesn't stream.
- importQueryFromURI only works for file URIs.
- The parse functionality should probably be removed. It merges two functionalities which don't really belong together (retrieving of data and parsing xml). The latter can also be done in XQuery. If this philosophy is to push more functionality into XQuery, the parse functionality should be removed or made symmetric to the existing C++ and XQuery data manager APIs.
- getItem doesn't have a comment and is incomplete. Shouldn't it support more/all XQuery types?