]> andersk Git - moira.git/commitdiff
Use the last_name, first_name, and middle_name columns of our view of
authorzacheiss <zacheiss>
Wed, 25 Feb 2004 01:41:33 +0000 (01:41 +0000)
committerzacheiss <zacheiss>
Wed, 25 Feb 2004 01:41:33 +0000 (01:41 +0000)
the Warehouse rather than the full_name column; update file format that
staffload knows how to read accordingly.  This lets us distinguish a
first name with embedded white space from a first name and a middle
name.

regtape/staff.pc
regtape/staff.sql

index 8edf98ac71dd9f221b7696405dd6e07f835455ac..558e6d27a77db6b6653955e93d9c762e7c12efd4 100644 (file)
@@ -24,7 +24,9 @@ RCSID("$Header$");
 /* File format is:
  *
  * id number [9]
- * name (last, first middle) [30]
+ * last name [30]
+ * first name [30]
+ * middle name [30]
  * office address [24]
  * phone1 [12]
  * phone2 [12]
@@ -34,9 +36,13 @@ RCSID("$Header$");
 
 #define LOC_ID 0
 #define LEN_ID 9
-#define LOC_NAME (LOC_ID + LEN_ID)
-#define LEN_NAME 30
-#define LOC_OFFICE (LOC_NAME + LEN_NAME)
+#define LOC_LAST_NAME (LOC_ID + LEN_ID)
+#define LEN_LAST_NAME 30
+#define LOC_FIRST_NAME (LOC_LAST_NAME + LEN_LAST_NAME)
+#define LEN_FIRST_NAME 30
+#define LOC_MIDDLE_NAME (LOC_FIRST_NAME + LEN_FIRST_NAME)
+#define LEN_MIDDLE_NAME 30
+#define LOC_OFFICE (LOC_MIDDLE_NAME + LEN_MIDDLE_NAME)
 #define LEN_OFFICE 24
 #define LOC_PHONE (LOC_OFFICE + LEN_OFFICE)
 #define LEN_PHONE 12
@@ -137,7 +143,8 @@ struct entry *get_next_entry(FILE *in)
 {
   static struct entry e;
   static char buf[BUFSIZ];
-  static char name[LEN_NAME + 1], id[LEN_ID + 1];
+  static char last_name[LEN_LAST_NAME + 1], id[LEN_ID + 1];
+  static char first_name[LEN_FIRST_NAME + 1], middle_name[LEN_MIDDLE_NAME + 1];
   static char office[LEN_OFFICE + 1], phone[LEN_PHONE + 1];
   static char phone2[LEN_PHONE2 + 1], dept[LEN_DEPT + 1], title[LEN_TITLE + 1];
   int ends_sr, ends_jr, ends_iii, ends_iv, ends_ii, ends_v;
@@ -147,41 +154,19 @@ struct entry *get_next_entry(FILE *in)
     return NULL;
 
   strlcpy(id, &buf[LOC_ID], LEN_ID + 1);
-  strlcpy(name, &buf[LOC_NAME], LEN_NAME + 1);
+  strlcpy(last_name, &buf[LOC_LAST_NAME], LEN_LAST_NAME + 1);
+  strlcpy(first_name, &buf[LOC_FIRST_NAME], LEN_FIRST_NAME + 1);
+  strlcpy(middle_name, &buf[LOC_MIDDLE_NAME], LEN_MIDDLE_NAME + 1);
   strlcpy(office, &buf[LOC_OFFICE], LEN_OFFICE + 1);
   strlcpy(phone, &buf[LOC_PHONE], LEN_PHONE + 1);
   strlcpy(phone2, &buf[LOC_PHONE2], LEN_PHONE2 + 1);
   strlcpy(dept, &buf[LOC_DEPT], LEN_DEPT + 1);
   strlcpy(title, &buf[LOC_TITLE], LEN_TITLE + 1);
 
-  p = strchr(name, ',');
-  if (p)
-    *p = '\0';
-  e.last = strtrim(name);
-  if (p)
-    {
-      p++;
-      while (isspace(*p))
-       p++;
-      e.first = p;
-      p = strchr(e.first, ' ');
-      if (p)
-       {
-         *p = '\0';
-         e.first = strtrim(e.first);
-         e.middle = strtrim(p + 1);
-       }
-      else
-       {
-         e.first = strtrim(e.first);
-         e.middle = "";
-       }
-    }
-  else
-    {
-      e.first = "";
-      e.middle = "";
-    }
+  e.last = strtrim(last_name);
+  e.first = strtrim(first_name);
+  e.middle = strtrim(middle_name);
+
   ends_sr = ends_jr = ends_iii = ends_iv = ends_ii = ends_v = 0;
   LookForSt(e.last);
   LookForO(e.last);
index 14a35fce01e9ece1b549de10712d1265f5a3b226..ef14b0079cd65024155453a146231d271458aaa4 100644 (file)
@@ -1,8 +1,8 @@
 set head off
 set feedback off
 set pagesize 0
-set linesize 271
+set linesize 331
 spool /moira/load/staff.input.unsorted
-select mit_id || rpad(nvl(full_name, ' '), 30, ' ') || rpad(substr(nvl(office_location, ' '), 0, 12), 12, ' ') || rpad(substr(nvl(secondary_office_location, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(office_phone, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(secondary_office_phone, ' '), 0, 12), 12, ' ') || rpad(substr(department_name, 0, 50), 50, ' ') || substr(directory_title, 0, 50) from wareuser.moira_employee;
+select mit_id || rpad(nvl(last_name, ' '), 30, ' ') || rpad(nvl(first_name, ' '), 30, ' ') || rpad(nvl(middle_name, ' '), 30, ' ') || rpad(substr(nvl(office_location, ' '), 0, 12), 12, ' ') || rpad(substr(nvl(secondary_office_location, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(office_phone, ' '), 0, 12), 12, ' ') || lpad(substr(nvl(secondary_office_phone, ' '), 0, 12), 12, ' ') || rpad(substr(department_name, 0, 50), 50, ' ') || substr(directory_title, 0, 50) from wareuser.moira_employee;
 spool off
 quit
This page took 0.034038 seconds and 5 git commands to generate.