<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/cursor_test.rb</filename>
    </added>
    <added>
      <filename>test/db_test.rb</filename>
    </added>
    <added>
      <filename>test/env_test.rb</filename>
    </added>
    <added>
      <filename>test/stat_test.rb</filename>
    </added>
    <added>
      <filename>test/txn_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -14,11 +14,9 @@ task :default =&gt; &quot;test&quot;
 desc &quot;Clean&quot;
 task :clean do
   include FileUtils
-  rm_rf File.join('ext', 'bdb_aux._c')
-  rm_rf File.join('ext', 'Makefile')
-  rm_rf File.join('ext', 'mkmf.log')
-  rm_rf File.join('ext', 'conftest.c')
-  rm_rf File.join('ext', '*.o')
+  Dir.chdir('ext') do
+    rm(Dir.glob('*') - ['bdb.c', 'bdb.h', 'extconf.rb'])
+  end
   rm_rf 'pkg'
 end
  </diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -94,9 +94,10 @@ static void db_free(t_dbh *dbh)
     fprintf(stderr,&quot;%s/%d %s 0x%x\n&quot;,__FILE__,__LINE__,&quot;db_free cleanup!&quot;,dbh);
 #endif
 
-  if ( dbh ) {
+  if (dbh) {
     if (dbh-&gt;db) {
-      dbh-&gt;db-&gt;close(dbh-&gt;db,NOFLAGS);
+			if (dbh-&gt;db_opened == 1)
+      	dbh-&gt;db-&gt;close(dbh-&gt;db,NOFLAGS);
       if ( RTEST(ruby_debug) &amp;&amp; dbh-&gt;filename[0] != '\0')
     fprintf(stderr,&quot;%s/%d %s %p %s\n&quot;,__FILE__,__LINE__,
         &quot;db_free database was still open!&quot;,dbh-&gt;db,dbh-&gt;filename);
@@ -272,7 +273,7 @@ VALUE db_open(VALUE obj, VALUE vtxn, VALUE vdisk_file,
   }
   filename_copy(dbh-&gt;filename,vdisk_file)
   dbh-&gt;adbc=rb_ary_new();
-
+	dbh-&gt;db_opened = 1;
   return obj;
 }
 
@@ -304,6 +305,31 @@ VALUE db_flags_set(VALUE obj, VALUE vflags)
 
 /*
  * call-seq:
+ *	db.flags -&gt; value
+ *
+ * get database flags.
+ * see http://www.sleepycat.com/docs/api_c/db_get_flags.html
+ *
+ */
+VALUE db_flags_get(VALUE obj)
+{
+  t_dbh *dbh;
+  int rv;
+  u_int32_t flags;
+
+  Data_Get_Struct(obj,t_dbh,dbh);
+  if (!dbh-&gt;db)
+    raise_error(0,&quot;db is closed&quot;);
+
+  rv = dbh-&gt;db-&gt;get_flags(dbh-&gt;db,&amp;flags);
+  if ( rv != 0 ) {
+    raise_error(rv, &quot;db_flag_get failure: %s&quot;,db_strerror(rv));
+  }
+  return INT2NUM(flags);
+}
+
+/*
+ * call-seq:
  *	db.pagesize=value
  *
  * set database flags based on DB constants.
@@ -493,7 +519,7 @@ VALUE db_close(VALUE obj, VALUE vflags)
   if ( rv != 0 ) {
     raise_error(rv, &quot;db_close failure: %s&quot;,db_strerror(rv));
   }
-
+	dbh-&gt;db_opened = 0;
   return obj;
 }
 
@@ -577,9 +603,8 @@ VALUE db_get(VALUE obj, VALUE vtxn, VALUE vkey, VALUE vdata, VALUE vflags)
   }
 
   if ( ! NIL_P(vflags) ) {
-    rb_warning(&quot;flags nil&quot;);
-    flags=NUM2UINT(vflags);
-  }
+		flags=NUM2UINT(vflags);
+	}
   
   Data_Get_Struct(obj,t_dbh,dbh);
   if (!dbh-&gt;db)
@@ -637,7 +662,6 @@ VALUE db_pget(VALUE obj, VALUE vtxn, VALUE vkey, VALUE vdata, VALUE vflags)
   }
 
   if ( ! NIL_P(vflags) ) {
-    rb_warning(&quot;flags nil&quot;);
     flags=NUM2UINT(vflags);
   }
   
@@ -909,8 +933,9 @@ VALUE db_rename(VALUE obj, VALUE vdisk_file,
 		     StringValueCStr(newname),
 		     flags);
 
-  if (rv)
+  if (rv) {
     raise_error(rv,&quot;db_rename failed: %s&quot;,db_strerror(rv));
+	}
   return Qtrue;
 }
 
@@ -2559,6 +2584,7 @@ void Init_bdb() {
   rb_define_method(cDb,&quot;cursor&quot;,db_cursor,2);
   rb_define_method(cDb,&quot;associate&quot;,db_associate,4);
   rb_define_method(cDb,&quot;flags=&quot;,db_flags_set,1);
+	rb_define_method(cDb,&quot;flags&quot;,db_flags_get,0);
   rb_define_method(cDb,&quot;open&quot;,db_open,6);
   rb_define_method(cDb,&quot;close&quot;,db_close,1);
   rb_define_method(cDb,&quot;[]&quot;,db_aget,1);
@@ -2636,6 +2662,3 @@ void Init_bdb() {
   rb_define_method(cTxn,&quot;tid&quot;,txn_id,0);
   rb_define_method(cTxn,&quot;set_timeout&quot;,txn_set_timeout,2);
 }
-void Init_bdb2a() {
-  Init_bdb2();
-}</diff>
      <filename>ext/bdb.c</filename>
    </modified>
    <modified>
      <diff>@@ -50,6 +50,7 @@ typedef struct s_envh {
 typedef struct s_dbh {
   VALUE self;
   DB *db;
+	int db_opened;
   VALUE aproc;
   t_envh *env; /* Parent environment, NULL if not opened from one */
   VALUE adbc; /* Ruby array holding opened cursor */</diff>
      <filename>ext/bdb.h</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1,6 @@
+require &quot;test/unit&quot;
 require &quot;bdb&quot;
+
+class Test::Unit::TestCase
+  
+end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/all_test.rb</filename>
    </removed>
    <removed>
      <filename>test/skus.gz</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>e505f13f179b4fff53d0de2a35c9913412c62412</id>
    </parent>
  </parents>
  <author>
    <name>mattbauer</name>
    <email>bauer@mmmultiworks.com</email>
  </author>
  <url>http://github.com/mattbauer/bdb/commit/93716e1eadf6f3affb239acbc30ac2650875dbc0</url>
  <id>93716e1eadf6f3affb239acbc30ac2650875dbc0</id>
  <committed-date>2008-12-28T21:14:29-08:00</committed-date>
  <authored-date>2008-12-28T21:14:29-08:00</authored-date>
  <message>Test structure change and db test updates</message>
  <tree>40316d9a150040d19c36d588d6071f13c7b0015e</tree>
  <committer>
    <name>mattbauer</name>
    <email>bauer@mmmultiworks.com</email>
  </committer>
</commit>
