#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# This file creates a temporary table containing rows with 
# unicode characters. This test uses orafetchall to
# count the total number of rows containing a particular unicode 
# string. The test result should be 2 if the unicode characters were
# stored and retrieved properly
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: ofetchall_i18n.test,v 1.4 1999/10/12 02:01:22 mtariq Exp $

# more exhaustive test than what is in basic_tests.test
# tests internal function orafetch-all



source [file  join [pwd] [file dirname [info script]] defs.tcl]

test orafetchtest {test oratcl cmd orafetch} {
    set handle [oralogon $oracleuser/$oraclepw@$connstring]
    set cursor [oraopen $handle]
    set unistr \uc3\ua9
    orasql $cursor "create table test_ofetchi18n (name varchar2(15))"
    set str "insert into test_ofetchi18n (name) values ('$unistr')"
    orasql $cursor $str
    orasql $cursor "insert into test_ofetchi18n (name) values ('Joe')"
    orasql $cursor "insert into test_ofetchi18n (name) values ('Jane')"
    orasql $cursor $str
    orasql $cursor "insert into test_ofetchi18n (name) values ('Bob')"
    orasql $cursor "select name from test_ofetchi18n"
    set match_rows 0
    orafetch $cursor {
      if {[string compare @1 $unistr] == 0} {
         # name equal to test string then increment match_rows
         incr match_rows
      }
      if {$match_rows == 2} {
        break
      }
  }
    
  orasql $cursor "drop table test_ofetchi18n"
  oralogoff $handle
  set result $match_rows   
  } {2}

::tcltest::cleanupTests

return
