~zorba-coders/zorba/bugs-912586-912593-912722

« back to all changes in this revision

Viewing changes to swig/php/tests/test12.php

  • Committer: Cezar Andrei
  • Date: 2012-03-28 15:42:12 UTC
  • mfrom: (10606.1.129 zorba)
  • Revision ID: cezar.lp@cezarandrei.com-20120328154212-jh2heq49xcqjppce
Merge from trunck and resolve ChangeLog conflict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?
 
2
/*
 
3
 * Copyright 2006-2012 The FLWOR Foundation.
 
4
 *
 
5
 * Licensed under the Apache License, Version 2.0 (the "License");
 
6
 * you may not use this file except in compliance with the License.
 
7
 * You may obtain a copy of the License at
 
8
 * 
 
9
 * http://www.apache.org/licenses/LICENSE-2.0
 
10
 *
 
11
 * Unless required by applicable law or agreed to in writing, software
 
12
 * distributed under the License is distributed on an "AS IS" BASIS,
 
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
 * See the License for the specific language governing permissions and
 
15
 * limitations under the License.
 
16
 */
 
17
 
 
18
//require '@phpPath@/Zorba/zorba_api_wrapper.php';
 
19
require 'C:/dev/zapi/build/swig/php/Zorba/zorba_api_wrapper.php';
 
20
 
 
21
class MyDiagnosticHandler(zorba_api.DiagnosticHandler): 
 
22
  def error(self, *args):
 
23
    print "Error args: ", args
 
24
 
 
25
def test(zorba):
 
26
  #Read and write result
 
27
  print 'Executing: compilerHints.xq'
 
28
  f = open('compilerHints.xq', 'r')
 
29
  lines = f.read()
 
30
  f.close()
 
31
  diagnosticHandler = MyDiagnosticHandler()
 
32
  compilerHints = zorba_api.CompilerHints()
 
33
  compilerHints.setOptimizationLevel(1)
 
34
  xquery = zorba.compileQuery(lines, compilerHints, diagnosticHandler)
 
35
  
 
36
  result = xquery.execute()
 
37
  print result
 
38
  return
 
39
 
 
40
 
 
41
store = zorba_api.InMemoryStore_getInstance()
 
42
zorba = zorba_api.Zorba_getInstance(store)
 
43
 
 
44
print "Running: CompileQuery string + Dignostinc handler + CompilerHint - with optimization 1"
 
45
test(zorba)
 
46
print "Success"
 
47
 
 
48
 
 
49
zorba.shutdown()
 
50
zorba_api.InMemoryStore_shutdown(store)
 
51
 
 
52
?>
 
 
b'\\ No newline at end of file'