Author: timbo
Date: Sat Feb 28 03:47:11 2004
New Revision: 168

Modified:
   dbi/trunk/DBI.pm
   dbi/trunk/DBI.xs
   dbi/trunk/dbi_sql.h
   dbi/trunk/lib/DBI/PurePerl.pm
   dbi/trunk/t/01basics.t
   dbi/trunk/t/02dbidrv.t
Log:
Added SQL_CURSOR_TYPE constants thanks to Jeff Urlwin
Fixed t/zz_02dbidrv_pp.t test failure.


Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Sat Feb 28 03:47:11 2004
@@ -222,6 +222,13 @@
        SQL_INTERVAL_HOUR_TO_SECOND
        SQL_INTERVAL_MINUTE_TO_SECOND
    ) ],
+   sql_cursor_types => [ qw(
+        SQL_CURSOR_FORWARD_ONLY
+        SQL_CURSOR_KEYSET_DRIVEN
+        SQL_CURSOR_DYNAMIC
+        SQL_CURSOR_STATIC
+        SQL_CURSOR_TYPE_DEFAULT
+   ) ], # for ODBC cursor types
    utils     => [ qw(
        neat neat_list dump_results looks_like_number
    ) ],

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Sat Feb 28 03:47:11 2004
@@ -3366,6 +3366,11 @@
        SQL_WCHAR                        = SQL_WCHAR
        SQL_WLONGVARCHAR                 = SQL_WLONGVARCHAR
        SQL_WVARCHAR                     = SQL_WVARCHAR
+       SQL_CURSOR_FORWARD_ONLY          = SQL_CURSOR_FORWARD_ONLY
+       SQL_CURSOR_KEYSET_DRIVEN         = SQL_CURSOR_KEYSET_DRIVEN
+       SQL_CURSOR_DYNAMIC               = SQL_CURSOR_DYNAMIC
+       SQL_CURSOR_STATIC                = SQL_CURSOR_STATIC
+       SQL_CURSOR_TYPE_DEFAULT          = SQL_CURSOR_TYPE_DEFAULT
        DBIpp_cm_cs     = DBIpp_cm_cs
        DBIpp_cm_hs     = DBIpp_cm_hs
        DBIpp_cm_dd     = DBIpp_cm_dd

Modified: dbi/trunk/dbi_sql.h
==============================================================================
--- dbi/trunk/dbi_sql.h (original)
+++ dbi/trunk/dbi_sql.h Sat Feb 28 03:47:11 2004
@@ -76,6 +76,15 @@
 #define        SQL_SUCCESS_WITH_INFO           1
 #define        SQL_NO_DATA_FOUND               100
 
+/*
+ * for ODBC SQL Cursor Types
+ */
+#define SQL_CURSOR_FORWARD_ONLY         0UL
+#define SQL_CURSOR_KEYSET_DRIVEN        1UL
+#define SQL_CURSOR_DYNAMIC              2UL
+#define SQL_CURSOR_STATIC               3UL
+#define SQL_CURSOR_TYPE_DEFAULT         SQL_CURSOR_FORWARD_ONLY
+
 #endif /*      SQL_SUCCESS     */
 
 /* Handy macro for testing for success and success with info.          */

Modified: dbi/trunk/lib/DBI/PurePerl.pm
==============================================================================
--- dbi/trunk/lib/DBI/PurePerl.pm       (original)
+++ dbi/trunk/lib/DBI/PurePerl.pm       Sat Feb 28 03:47:11 2004
@@ -91,6 +91,13 @@
 use constant SQL_WLONGVARCHAR => (-10);
 use constant SQL_WVARCHAR => (-9);
 
+# for Cursor types
+use constant SQL_CURSOR_FORWARD_ONLY  => 0;
+use constant SQL_CURSOR_KEYSET_DRIVEN => 1;
+use constant SQL_CURSOR_DYNAMIC       => 2;
+use constant SQL_CURSOR_STATIC        => 3;
+use constant SQL_CURSOR_TYPE_DEFAULT  => SQL_CURSOR_FORWARD_ONLY;
+
 use constant IMA_HAS_USAGE     => 0x0001; #/* check parameter usage    */
 use constant IMA_FUNC_REDIRECT => 0x0002; #/* is $h->func(..., "method")*/
 use constant IMA_KEEP_ERR      => 0x0004; #/* don't reset err & errstr */

Modified: dbi/trunk/t/01basics.t
==============================================================================
--- dbi/trunk/t/01basics.t      (original)
+++ dbi/trunk/t/01basics.t      Sat Feb 28 03:47:11 2004
@@ -20,7 +20,7 @@
 }
 
 
-use DBI qw(:sql_types :utils);
+use DBI qw(:sql_types :utils :sql_cursor_types);
 
 warn "   Using DBI::PurePerl (DBI_PUREPERL=$DBI::PurePerl) on $Config{archname}\n"
     if $DBI::PurePerl;
@@ -79,9 +79,14 @@
 $switch->trace_msg("Test \$h->trace_msg text.\n", 1);
 DBI->trace_msg("Test DBI->trace_msg text.\n", 1);
 
+# spot check a few of the sql data types
 ok(0, SQL_VARCHAR == 12);
 ok(0, SQL_ALL_TYPES == 0);
 
+# spot check a few of the sql cursor types
+ok(0, SQL_CURSOR_FORWARD_ONLY == 0);
+ok(0, SQL_CURSOR_DYNAMIC == 2);
+
 my @is_num = looks_like_number(undef, "", "foo", 1, ".", 2, "2");
 ok(0, !defined $is_num[0]);    # undef -> undef
 ok(0, !defined $is_num[1]);    # "" -> undef (eg "don't know")
@@ -120,5 +125,5 @@
 ok(0, @installed_drivers >= 1);
 ok(0, grep { $_ eq 'Sponge' } @installed_drivers);
 
-BEGIN { $tests = 45 }
+BEGIN { $tests = 47 }
 exit 0;

Modified: dbi/trunk/t/02dbidrv.t
==============================================================================
--- dbi/trunk/t/02dbidrv.t      (original)
+++ dbi/trunk/t/02dbidrv.t      Sat Feb 28 03:47:11 2004
@@ -129,7 +129,7 @@
 ok($DBI::state, "IM999");
 
 eval { $DBI::rows = 1 };
-ok($@ =~ m/Can't modify/);
+ok($@ =~ m/Can't modify/) unless $DBI::PurePerl && main::ok(1);
 
 ok($drh->{FetchHashKeyName}, 'NAME');
 $drh->{FetchHashKeyName} = 'NAME_lc';

Reply via email to