Index: DBRow.php
===================================================================
--- DBRow.php	(revision 37487)
+++ DBRow.php	(working copy)
@@ -1048,5 +1048,68 @@
 			throw new Exception('Cannot get changes - the original values were not stored');
 		}	
 	}
+	
+	/**
+	 * Very basic validation to insure that cases that would not cause errors 
+	 * when doing inserts and updates can be checked for before doing an insert/update
+	 *
+	 * @param array $errors - (optional)
+	 *
+	 * @return bool False if a condition is not valid
+	 */
+	public function isValid(&$errors=array())
+	{
+		$this->db->loadModule('Reverse');
+	
+		foreach (array_merge($this->fields_normal, $this->pri_keys) as $field) {
+			$field_defs = $this->db->reverse->getTableFieldDefinition($this->table->name, $field);
+			foreach ($field_defs as $def) {
+
+				if (strcmp($def['mdb2type'], 'text')==0) {
+					$length = null;
+					if (array_key_exists('length', $def)) {
+						$length = (int)$def['length'];
+					} else {
+						switch($def['nativetype']) {
+							case 'longtext':
+								$length = 4294967295;
+								break;
+						
+							case 'mediumtext':
+								$length = 16777215;
+								break;
+						
+							case 'text':
+								$length = 65535;
+								break;
+
+							case 'tinytext':
+								$length = 255;
+								break;
+						}
+					}
+					if (is_int($length)) 
+						if (!function_exists('mb_strlen')) {
+							function mb_strlen($string)
+							{
+								return strlen($string);
+							}
+						}
+						if (mb_strlen($this->$field)>$length) {
+						$errors[$field] = 'The value of "' . $this->table->getLabel($field) . '" exceeds the input length of ' . $length;
+						break;
+					}
+				} else if (array_key_exists('notnull', $def) && $def['notnull'] && is_null($this->$field)) {
+					$errors[$field] = 'The value of "' . $this->table->getLabel($field) . '" cannot be null';
+					break;
+				} else if (strcmp($def['mdb2type'], 'integer')==0 && !is_numeric($this->$field) && !is_null($this->$field)) {
+					$errors[$field] = 'The value of "' . $this->table->getLabel($field) . '" must be numeric';
+					break;					
+				}
+			}
+		}
+				
+		return count($errors)==0;
+	}
 }
 
