<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>AdoDBRecord.kdevelop</filename>
    </added>
    <added>
      <filename>Doxyfile</filename>
    </added>
    <added>
      <filename>Inflector.class.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -17,6 +17,7 @@
 
 	require_once(&quot;${PREFIX_ADODB}adodb.inc.php&quot;);
 	require_once(&quot;AdoDBRecord_Base.class.php&quot;);
+	require_once(&quot;Inflector.class.php&quot;);
 
 	# AdoDB version min. v4.56 is needed
 	function _adodb_version_check()
@@ -32,6 +33,7 @@
 	function _adodb_record_init() {
 		global $_adodb_column_cache;
 		$_adodb_column_cache = array();
+		AdoDBRecord_Base::register_hooks();
 	}
 
 	# FIXME initiate your connection here
@@ -68,9 +70,10 @@
 			global $_adodb_column_cache;
 			$conn = _adodb_conn();
 
+			parent::AdoDBRecord_Base();
+
 			# TODO move code to seperate base class
-			# FIXME do inflections
-			if (!$this-&gt;_table_name) $this-&gt;_table_name = _class_name();
+			if (!$this-&gt;_table_name) $this-&gt;_table_name = Inflector::pluralize(_class_name());
 			if ($_adodb_column_cache[$this-&gt;_table_name])
 			$this-&gt;_columns = $conn-&gt;GetCol(sprintf(&quot;SHOW COLUMNS FROM `%s`&quot;, $this-&gt;_table_name()));
 </diff>
      <filename>AdoDBRecord.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,15 @@
 
 	class AdoDBRecord_Base {
 
-		function _setup() {}
+		function AdoDBRecord_Base() {
+			# call the setup hook
+			$this-&gt;_setup();
+		}
+
+		# standard setup hook does nothing
+		# can be implemented in derived classes
+		function _setup() {
+		}
 
 		# register the hook which defines a derived class
 		function register_hooks() {</diff>
      <filename>AdoDBRecord_Base.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,22 +14,27 @@
 	# attribute accessors.
 
 	require_once(&quot;AdoDBRecord_Implementer.class.php&quot;);
-	
+
 	class AdoDBRecord_BaseImplementer extends AdoDBRecord_Implementer {
 		function create_stream($class_name) {
+			# extract the class name from the stream name first
+			preg_match(&quot;#([a-z0-9_]*)(\.(.*))?#i&quot;,$class_name, $parts) or die(&quot;Invalid class name '$class_name'&quot;);
+			$class = $parts[1];
+
+			# build class
 			return &lt;&lt;&lt;EOC
-				class $class_name extends AdoDBRecord {
+				class $class extends AdoDBRecord {
 				}
 EOC;
 		}
 
 		function write_attr_accessors($attribute) {
-			return &lt;&lt;&lt;EOF
+			return &lt;&lt;&lt;EOA
 				function $attribute(\$value = false) {
 					if (\$value) return \$this-&gt;_attributes[&quot;$attribute&quot;] = \$value;
 					return \$this-&gt;_attributes[&quot;$attribute&quot;];
 				}
-EOF;
+EOA;
 		}
 	}
 ?&gt;</diff>
      <filename>AdoDBRecord_BaseImplementer.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -12,19 +12,24 @@
 	# It is usually meant to implement PHP code virtually for inclusion by
 	# require_once() and friends. Derived classes are used to choose the
 	# implementation.
+	#
+	# Implementation interface:
+	# http://php.net/manual/en/function.stream-wrapper-register.php
 
 	class AdoDBRecord_Implementer {
 		var $stream = NULL;
 		var $position = 0;
 
+		# customize this in derived classes to create the actual stream
 		function create_stream($name) {
 			die(&quot;Virtual method called for loading '$name'.&quot;);
 		}
 
 		function stream_open($path, $mode, $options, &amp;$opened_path) {
 			$this-&gt;position = 0;
-			$this-&gt;stream = $this-&gt;create_stream($path);
-			return false;
+			$this-&gt;stream = '&lt;?php ' . $this-&gt;create_stream(preg_replace(&quot;#^.*://#&quot;, &quot;&quot;, $path, 1)) or die(&quot;Stream creation failed for '$path'&quot;) . ' ?&gt;';
+			$opened_path = $path;
+			return true;
 		}
 
 		function stream_read($count) {
@@ -40,6 +45,10 @@
 			return $this-&gt;position;
 		}
 
+		function stream_eof() {
+			return strlen($this-&gt;stream) &lt; $this-&gt;position;
+		}
+
 		function stream_seek($offset, $whence) {
 			switch ($whence) {
 				case SEEK_SET:</diff>
      <filename>AdoDBRecord_Implementer.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;?php
 
-	require_once(&quot;AdoDBRecord:Example_Base&quot;);
+	require_once(&quot;AdoDBRecord://Example_Base&quot;);
 
 	class Example extends Example_Base {
 		# just an empty stub class currently</diff>
      <filename>examples/Example.class.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2eab19965a5ef4c1e4e9619a079997fb7fe0cb4d</id>
    </parent>
  </parents>
  <author>
    <name>Kai Krakow</name>
    <email>kk@netactive.de</email>
  </author>
  <url>http://github.com/kakra/adodbrecord/commit/356cfe38ee82e330a67958bf56b8b5060bee3bce</url>
  <id>356cfe38ee82e330a67958bf56b8b5060bee3bce</id>
  <committed-date>2008-08-05T08:38:22-07:00</committed-date>
  <authored-date>2008-08-05T08:38:22-07:00</authored-date>
  <message>Add inflectors

This branch adds inflectors and is currently incomplete.</message>
  <tree>89e2c7770c0a5eccb4a0b65961b56b6ef5939dd4</tree>
  <committer>
    <name>Kai Krakow</name>
    <email>kk@netactive.de</email>
  </committer>
</commit>
