HSQLのシングルクォーテーションとawk

update 文をawkで出力しようとしたら
awkでシングルクォーテーションが出力出来なかった。

awk -v q="'" '{print "update \"UnitMaster\" set \"s1_lv\"=" $2 ",\"s2_lv\"=" $3 ", \"s3_lv\"=" $4 ", \"s4_lv\"=" $5 ", \"s5_lv\"=" $6 " where \"id\"=" q $1 q;}'

こんな感じで -v を使い。

HSQLはopenofficeのbaseですがSQL実行時にcolumnはだぶるクォーテーション、値はシングルクォーテーションと使い分けが必要なようです。

This entry was posted on 金曜日, 1月 10th, 2014 at 11:49 AM and is filed under awk. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。