Add a function to fetch information about a table
Mostly so whether a field can contain NULL values can be determined.
This commit is contained in:
parent
b30904e1af
commit
bddf7a4240
1 changed files with 15 additions and 0 deletions
|
|
@ -114,6 +114,21 @@
|
||||||
'()
|
'()
|
||||||
lst))
|
lst))
|
||||||
|
|
||||||
|
(define (table-schema conn table-name)
|
||||||
|
(map
|
||||||
|
(match-lambda
|
||||||
|
((column_name data_type is_nullable)
|
||||||
|
(list column_name
|
||||||
|
data_type
|
||||||
|
(string=? is_nullable "YES"))))
|
||||||
|
(exec-query
|
||||||
|
conn
|
||||||
|
"
|
||||||
|
SELECT column_name, data_type, is_nullable
|
||||||
|
FROM information_schema.columns
|
||||||
|
WHERE table_name = $1"
|
||||||
|
(list table-name))))
|
||||||
|
|
||||||
(define* (insert-missing-data-and-return-all-ids
|
(define* (insert-missing-data-and-return-all-ids
|
||||||
conn
|
conn
|
||||||
table-name
|
table-name
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue