From 8d3eacff7dea9916c3157b734d243b89e40233a5 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Tue, 14 Apr 2009 13:27:07 +0000
Subject: [PATCH] - respect bounds for operational attributes.

---
 opends/src/server/org/opends/server/backends/ndb/BackendImpl.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java b/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
index 23f8041..ec84448 100644
--- a/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
@@ -376,8 +376,8 @@
   private int getAttributeBound(AttributeType attrType) {
     // HACK: This should be done by Directory Server
     // Schema parser and available in AttributeSyntax.
-    String attrDefinition = attrType.getDefinition();
     try {
+      String attrDefinition = attrType.getDefinition();
       int boundOpenIndex = attrDefinition.indexOf("{");
       if (boundOpenIndex == -1) {
         return 0;
@@ -719,7 +719,13 @@
       attrsBuffer.append(attrName);
       attrsBuffer.append("`");
       attrsBuffer.append(" VARCHAR(");
-      attrsBuffer.append(ATTRLEN_STRING);
+      int attrBound = getAttributeBound(
+        DirectoryServer.getAttributeType(attrName.toLowerCase()));
+      if ((attrBound > 0) && (attrBound < NDB_MAXROWSIZE)) {
+        attrsBuffer.append(Integer.toString(attrBound));
+      } else {
+        attrsBuffer.append(ATTRLEN_STRING);
+      }
       attrsBuffer.append(")");
       nColumns++;
     }

--
Gitblit v1.10.0