mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 10:56:10 +02:00
Refrain from querying the catalogs again.
When we already have the information in the pgloader internal catalogs, don't issue another MySQL query. In this case, it's been used to fetch the list of columns and their data types so that we can choose to send either `colname` or maybe astext(`colname`) as `colname` for some geographic types. That's one less MySQL query per table.
This commit is contained in:
parent
181f344159
commit
dfac729daa
@ -247,17 +247,12 @@
|
||||
(:linestring (format nil "astext(`~a`) as `~a`" name name))
|
||||
(t (format nil "`~a`" name))))
|
||||
|
||||
(defun get-column-list (dbname table-name)
|
||||
(defun get-column-list (copy)
|
||||
"Some MySQL datatypes have a meaningless default output representation, we
|
||||
need to process them on the SQL side (geometric data types).
|
||||
|
||||
This function assumes a valid connection to the MySQL server has been
|
||||
established already."
|
||||
(loop with sql = (format nil
|
||||
(sql "/mysql/get-column-list.sql")
|
||||
dbname table-name)
|
||||
for (name type) in (mysql-query sql :result-type 'list)
|
||||
collect (get-column-sql-expression name type)))
|
||||
need to process them on the SQL side (geometric data types)."
|
||||
(loop :for field :in (fields copy)
|
||||
:collect (get-column-sql-expression (mysql-column-name field)
|
||||
(mysql-column-dtype field))))
|
||||
|
||||
(declaim (inline fix-nulls))
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@
|
||||
(when qmynd:*mysql-encoding*
|
||||
(log-message :notice "Force encoding to ~a for ~a"
|
||||
qmynd:*mysql-encoding* table-name))
|
||||
(let* ((cols (get-column-list (db-name (source-db mysql)) table-name))
|
||||
(let* ((cols (get-column-list mysql))
|
||||
(sql (format nil "SELECT ~{~a~^, ~} FROM `~a`" cols table-name)))
|
||||
|
||||
(if (range-list mysql)
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
-- params: dbname
|
||||
-- table-name
|
||||
select column_name, data_type
|
||||
from information_schema.columns
|
||||
where table_schema = '~a' and table_name = '~a'
|
||||
order by ordinal_position;
|
||||
Loading…
x
Reference in New Issue
Block a user