- let sth =
- dbh#prepare_cached
- "insert into files (hostid, name, content, title, mime_type)
- select ?, name, content, title, mime_type
- from files
- where hostid = ? and name is not null" in
- sth#execute [`Int hostid; `Int template];
-
- let sth =
- dbh#prepare_cached
- "insert into images (hostid, name, image, width, height, alt, title,
- longdesc, class, mime_type, thumbnail,
- tn_width, tn_height, tn_mime_type)
- select ?, name, image, width, height, alt, title, longdesc, class,
- mime_type, thumbnail, tn_width, tn_height, tn_mime_type
- from images
- where hostid = ? and name is not null" in
- sth#execute [`Int hostid; `Int template];
+ PGSQL(dbh)
+ "insert into files (hostid, name, content, title, mime_type)
+ select $hostid, name, content, title, mime_type
+ from files
+ where hostid = $template and name is not null";
+
+ PGSQL(dbh)
+ "insert into images (hostid, name, image, width, height, alt, title,
+ longdesc, class, mime_type, thumbnail,
+ tn_width, tn_height, tn_mime_type)
+ select $hostid, name, image, width, height, alt, title, longdesc, class,
+ mime_type, thumbnail, tn_width, tn_height, tn_mime_type
+ from images
+ where hostid = $template and name is not null";