(defun dmgen-convert-sql-desc-line-to-attribute ()
"Assuming point is at the beginning of the line, this function
converts a line
|Aufl_Sort_ID |INTEGER |32 |0 |0 |
into a corresponding tag of datamodel.xml, as defined by dmutils."
(interactive)
(let* ((name-start-pos nil)
(name-end-pos nil)
(type-start-pos nil)
(type-end-pos nil)
(length-start-pos nil)
(length-end-pos nil)
(nullable-start-pos nil)
(nullable-end-pos nil)
(name-string nil)
(type-string nil)
(length-string nil)
(nullable-string nil)
)
(forward-char)
(setq name-start-pos (point))
(re-search-forward " \\||" nil t)
(backward-char)
(setq name-end-pos (point))
(search-forward "|" nil t)
(setq type-start-pos (point))
(re-search-forward " \\||" nil t)
(backward-char)
(setq type-end-pos (point))
(search-forward "|" nil t)
(setq length-start-pos (point))
(re-search-forward " \\||" nil t)
(backward-char)
(setq length-end-pos (point))
(search-forward "|" nil t)
(search-forward "|" nil t)
(setq nullable-start-pos (point))
(re-search-forward " \\||" nil t)
(backward-char)
(setq nullable-end-pos (point))
(setq name-string (buffer-substring name-start-pos name-end-pos))
(setq type-string (buffer-substring type-start-pos type-end-pos))
(setq length-string (buffer-substring length-start-pos length-end-pos))
(setq nullable-string (buffer-substring nullable-start-pos nullable-end-pos))
(message "name-string = [%s], type-string = [%s], length-string = [%s], nullable-string = [%s]"
name-string type-string length-string nullable-string)
(move-beginning-of-line nil)
(kill-line)
(insert (concat " ")
(move-beginning-of-line nil)
(next-line)
)
)
(provide 'dojo-datamodel)