]> git.sur5r.net Git - openldap/commitdiff
Update back-sql
authorKurt Zeilenga <kurt@openldap.org>
Mon, 30 Oct 2000 17:25:36 +0000 (17:25 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 30 Oct 2000 17:25:36 +0000 (17:25 +0000)
servers/slapd/back-sql/docs/bugs
servers/slapd/back-sql/docs/concept
servers/slapd/back-sql/docs/install
servers/slapd/back-sql/docs/platforms
servers/slapd/back-sql/search.c

index ee75c84b20ae915ce23898860b17e81adb012e28..ae47e67684ca02e3342f34911bbadeb37b9aa36a 100644 (file)
@@ -12,4 +12,5 @@
     - it works with any other driver I tried
 4) ldapsearch sometimes refuses to show some attributes ("NOT PRINTABLE" diags)
    on Win32 (on linux everything's fine)
+5) back-sql crashes on invalid filters (to be fixed ASAP)
    
\ No newline at end of file
index b4366dfa14dea74a6d2eded25ea846752bbc5836..4d9303da7c27453fb3460e48728f09646fa96b79 100644 (file)
@@ -2,7 +2,7 @@ CONTENT
 1. Purpose
 2. Metainformation used
 3. Typical back-sql operation
-4. Several important common techniques
+4. Several important common techniques (referrals, multiclassing)
 
 1. Purpose
 Primary purpose of this backend is to PRESENT information stored in some RDBMS
@@ -184,6 +184,21 @@ delete instance in relational schema. Those can use a view instead of real
 table, something like this:
 
 
+Robin Elfrink wrote:
+
+> About using a view for ldap_entries...
+>
+> This is what I came up with this morning:
+>
+> CREATE VIEW ldap_entries (id, dn, oc_map_id, parent, keyval) AS
+>         SELECT (1000000000+userid),
+> UPPER(CONCAT(CONCAT('cn=',gecos),',o=MyCompany,c=NL'))
+> , 1, 0, userid FROM unixusers UNION
+>         SELECT (2000000000+groupnummer),
+> UPPER(CONCAT(CONCAT('cn=',groupnaam),',o=MyCompany,c=NL')), 2, 0,
+> groupnummer FROM groups;
+>
+
 
 3. Typical back-sql operation
 Having metainformation loaded, back-sql uses these tables to determine a set
@@ -219,7 +234,7 @@ Please see samples to find out what are the parameters passed, and other
 information on this matter - they are self-explanatory for those familiar
 with concept expressed above.
 
-4. Several common techniques
+4. Several common techniques (referrals, multiclassing etc.)
 First of all, lets remember that among other major differences to complete
 LDAP data model, the concept above does not directly support such things
 as multiple objectclasses for entry, and referrals.
index 532fe1e83aed2d9e44b9bbee31a0af22ec80c50a..daa686367eca8aefd186b857802fe532b458c12a 100644 (file)
@@ -1,18 +1,22 @@
+PLEASE READ THIS WHOLE FILE AND CONCEPT, BECAUSE THEY COVER SEVERAL STICKY
+ISSUES THAT YOU WILL PROBABLY STUMBLE ACROSS ANYWAY
+
 1. Build
 To build slapd with back-sql under Unix you need to build and install
-iODBC 2.50.3 (later versions should probably work, but not earlier). 
+iODBC 2.50.3 (later versions should probably work, but not earlier),
+or unixODBC (you will have to change -liodbc to -lodbc then).
 Then, at top of OpenLDAP source tree, run
 "configure <other options you need> --enable-sql", then "make" -
-this should build back-sql-enabled slapd, provided that you have iODBC 
+this should build back-sql-enabled slapd, provided that you have iODBC/unixODBC
 libraries and include files in include/library paths, "make install"...
 In other words, follow installation procedure described in OpenLDAP 
 Administrators Guide, adding --enbale-sql option to configure, and
-having iODBC libraries installed an accessible by compiler.
+having iODBC/unixODBC libraries installed an accessible by compiler.
 
 Under Win32/MSVC++, I modified the workspace so that back-sql is built into
-slapd automatically, since MS odbc32.dll is included in standard library pack,
-and it does no bad even if you don't plan to use it. I also could provide
-precompiled executables for those who don't have MSVC.
+slapd automatically, since MS ODBC manager, odbc32.dll, is included in
+standard library pack, and it does no bad even if you don't plan to use it.
+I also could provide precompiled executables for those who don't have MSVC.
 Note that Win32 port of OpenLDAP itself is experimental, and thus doesn't
 provide very convenient build environment (yet).
 
@@ -20,7 +24,7 @@ provide very convenient build environment (yet).
 Next, you need to define ODBC datasource with data you want to publish
 with help of back-sql. Assuming that you have your data in some SQL-compliant
 RDBMS, and have installed proper ODBC driver for this RDBMS, this is as simple
-as adding a record into odbc.ini (for iODBC), or using ODBC wizard in
+as adding a record into odbc.ini (for iODBC/unixODBC), or using ODBC wizard in
 Control Panel (for odbc32).
 Next, you need to add appropriate "database" record to your slapd.conf.
 See samples provided in "back-sql/RDBMS_DEPENDENT/" subdirectory. 
@@ -34,10 +38,16 @@ Several things worth noting about ODBC:
   different platforms, proxying and other connectivity and integration issues.
   They also support iODBC, and have good free customer service through
   newsserver (at news.openlinksw.com).
+  Also worth noting are: ODBC-ODBC bridge by EasySoft (which was claimed
+   by several people to be far more effective and stable than OpenLink),
+   OpenRDA package etc.
 - be carefull defining RDBMS connection parameters, you'll probably need only
-  "dbname" directive - all the rest can be defined in datasource. maybe you
-  will want to use dbuser/dbpasswd to override credentials defined in datasource
-- full list of configuration directives supported is available in file "guide"
+  "dbname" directive - all the rest can be defined in datasource. Every other
+  directive is used to override value stored in datasource definition.
+  Maybe you will want to use dbuser/dbpasswd to override credentials defined in datasource
+- full list of configuration directives supported is available in file "guide",
+  you may also analyze output of 'slapd -d 5' to find out some useful 
+  directives for redefining default queries 
 
 3. Creating and using back-sql metatables
 Read the file "concept" to understand, what metainformation you need to add,
index 3c90ae5af1fca0f2e52d50061c837e4ce91e5a51..65e326a58db557dc4af349ed21850f998be2c286 100644 (file)
@@ -1,18 +1,8 @@
-Platforms and configurations it has been tested on (for now I included only
- configurations I've tested personally):
+Platforms and configurations it has been tested on:
 
-1) slapd on redhat linux 6.0/6.1 (glibc 2.1.1/2.1.2), built with egcs
-   (versions packaged with appropriate red hat):
- iODBC 2.50.3 (on 6.0), 3.0beta (on 6.1),
- mySQL (on same linux) 3.22.25,3.22.30 trough myODBC 2.50.23,
- MSSQL (on WinNT 4/sp3) 7.0 through OpenLink driver suite 3 (broker on NT),
- Personal Oracle (on WinNT4/sp3) 8.0.3 through OpenLink driver suite 3 (broker on NT),
- Oracle (on linux 6.0) 8.0.5 through  OpenLink driver suite 3 (broker on linux)
+General: 
+ - ODBC managers: iODBC,unixODBC under unixes, odbc32.dll under Win32 family
+ - OSes: Linux/glibc, FreeBSD, OpenBSD, Solaris 2.6, Win98, WinNT, Win2000 server
+ - RDBMSes: Oracle 7/8/8i, MS SQL Server 6.5/7, mySQL
+ - access suites: OpenLink DAS, EasySoft OOB, various win32 drivers
  
-2) slapd on WinNT4/sp3, Win98 second edition, Windows2000pre,
-   built with MSVC++ 5,6:
-  ODBC32.DLL shipped with appropriate system,
-  MSSQL (on WinNT4/sp3,Win98,Win2000) 7.0, through its native driver,
-  Personal Oracle (on WinNT4/sp3,Win98) 8.0.3, through its native driver,
-  Oracle 7 (on Solaris/Sparc 2.6) through its native driver
-  
index e8b2d5800e6a4864ba02713f79e85213bf6f4219..914fca820447704130212e7992ee1438e968c644 100644 (file)
@@ -130,7 +130,12 @@ int backsql_process_sub_filter(backsql_srch_info *bsi,Filter *f)
  }
  if (f->f_sub_initial!=NULL)
  {
-  bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,f->f_sub_initial->bv_val,NULL);
+  if (bsi->bi->upper_func)
+   {
+    bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,toupper(f->f_sub_initial->bv_val),NULL);
+   }
+   else
+    bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,f->f_sub_initial->bv_val,NULL);
  }
 
  bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,"%",NULL);
@@ -139,11 +144,21 @@ int backsql_process_sub_filter(backsql_srch_info *bsi,Filter *f)
   for(i=0;f->f_sub_any[i]!=NULL;i++)
   {
    //Debug(LDAP_DEBUG_TRACE,"==>backsql_process_sub_filter(): sub_any='%s'\n",f->f_sub_any[i]->bv_val,0,0);
-   bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,f->f_sub_any[i]->bv_val,"%",NULL);
+   if (bsi->bi->upper_func)
+   {
+    bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,toupper(f->f_sub_any[i]->bv_val),"%",NULL);
+   }
+   else
+    bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,f->f_sub_any[i]->bv_val,"%",NULL);    
   }
 
  if (f->f_sub_final!=NULL)
-  bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,f->f_sub_final->bv_val,NULL);
+  if (bsi->bi->upper_func)
+   {
+    bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,toupper(f->f_sub_final->bv_val),NULL);
+   }
+   else
+    bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,f->f_sub_final->bv_val,NULL);
 
  bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,"')",NULL);
  
@@ -225,7 +240,7 @@ int backsql_process_filter(backsql_srch_info *bsi,Filter *f)
                        if (bsi->bi->upper_func)
                        bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,"(",
                                        bsi->bi->upper_func,"(",at->sel_expr,")='",
-                                               f->f_av_value->bv_val,"')",NULL);
+                                               toupper(f->f_av_value->bv_val),"')",NULL);
                        else
                         bsi->flt_where=backsql_strcat(bsi->flt_where,&bsi->fwhere_len,"(",at->sel_expr,"='",
                                                        f->f_av_value->bv_val,"')",NULL);