新生児育児は大変だ

3/23に出産して現在生後24日となりました

 

産前休業中はやっぱりつわりがあったけど、友達にも会えたし、勉強やプログラミングもできて充実した時間を過ごせました…妊娠中一番幸せな時期でした。

 

出産は気合いを入れてエアコン掃除をした日曜の深夜に何の前触れもなく陣痛が始まり、ギリ月曜の午前の無痛分娩に間に合い、病院に着いて3時間で産まれました。痛かったは痛かったけどもうほとんど忘れたくらいです。産まれた瞬間、お腹にずっといた子についに会えてすごく感動しました。

産後2日くらいでつわりがなくなったと思います。

 

出産してから2週間はまだ娘もよく寝てたのと幸せいっぱいのテンションなのか、家事したり産後の手続きやらニューボーンフォトやらお宮参りの予約やらをしたりいろいろやってました。なんなら産前に終わらせる予定で課金した大学のDSAのコース期限が切れる前にと思いちょっとだけやってたりしました。

 

夜間も3回くらい授乳していて、謎の悪寒と汗ダラダラで体調はやばかったけどなんとかなってました。しかし、2週目までのボーナスタイムだったようです。

 

ここまではうちの子って育てやすいのかな?と思ってました…周りの人にも結構寝れてる!むしろ寝過ぎて授乳の間隔空くのが気になる!なんて言ってました。

 

そして3週目に入って1時間おき授乳(ぐずったら母乳あげて!とも言われていた)、置いた瞬間泣く、何しても泣き止まない、吐き戻し激しい、などの状態になり、もう無理…と正気を取り戻した…を3日ほど繰り返し、12時間のうち自分の授乳は2回のみであとは夫がミルク、の状態を一回経て、たっぷり寝たはずなのに身体が動かず、心がざわざわしてなんかフラフラするしもう病院か行政に頼るしかない…と出産した病院に今日から2泊産後ケア入院できませんか?と電話して、予約がいっぱいで断られて…もうミルクで行った方がいいんですかね?と聞いたり…翌日日帰り産後ケアを入れてくれて3.5時間くらい寝かせてもらって、リフレッシュできました。

 

そこからまた授乳しても寝ずに泣いてばかりの日が続き、2、3日おきに限界を迎えてもうだめだーと完ミ寄りに移行したり、保健師さんの訪問に若干の産後うつ傾向を見出されて電話をもらったりしてました。夫を頼って少しでも寝てとのこと。

 

夫は時短勤務で夜勤担当してくれてるってすでにだいぶ頼ってるなと感じるけど、夫も結構しんどそうに見える。。同じベンチャー勤務で仕事がいかに責任が重く大変かも知ってるしなぁ。。(つまりその状態で子供産んだ自分たちがアクセル踏みすぎだったってことね😔)

 

里帰りの打診もあったけど、うちの両親もフルタイムで働いてるから結局ワンオペになるのではという。。

 

大変なりに人類がみなやってきたこと(しかも1人だけじゃなく多くが2人以上)なのに自分はもう無理かもみたいな気持ちになってて、毎日「新生児 限界」「産後うつ」みたいなワードで検索している今日この頃。。娘は愛しいし守りたいけど、朝が近づくと目が覚めて動悸がしたり身体が強張ってきて逆に寝れなかったり、食欲わかなかったりでしんどい😇 抱っこすると頑張ろうって気持ちが湧いてくるんだけどね。

 

それでもつわり入院中よりはしんどくはない。ただ、泣きに対応するために抱っこして歩いたり揺れたりする体力がすぐに尽きてしまう…

 

とりあえず、今はシッターさんに廃課金させてもらうしかないかなぁ。。東京都の助成も結構出るし。おそらく死ぬ時に使わずに余るであろう100万円(仮)を今使わないでどうする?って感じではあるので。。

 

あとは、自分は未来から二度と戻らない娘の新生児期にタイムスリップしてきたという妄想で時折鼓舞してします。

写真でここまでの成長を見返すと涙が出るほど可愛くて愛おしい🥲余裕がなくても写真たくさん撮ろう。

 

新生児もあと4日で終わりだけど、これから少しでも楽になりますように…

続・入院生活 14週

妊娠14週が終わろうとしてます。

 

正直な感想は「こんなにも悪阻が良くならないものなのか」です。吐き気で水分が思うように取れず、16時になると時報のように熱っぽさと頭痛が到来。まだ一般的につわりがある方が多数派と思われる時期だからこんなものかな。少し食べれてはいるからか体重の減少は止まりつつあり、マイナス8キロくらいで下げ止まってそう。

 

まああと1ヶ月もすれば概ねよくなってはいるはず…と思いつつネットでは18週でもしんどい人や産むまで悪阻の人がいて怖い。

 

点滴してるから脱水の心配はないし、病院食が概ね通常の半分2回食べられてるので栄養面も大きな心配はなさそう。仕事と金銭面は諦めるしかない。家に帰りたいと強く思うわけでもない。

 

それでも辛いものは辛い。何が辛いって吐き気と体のしんどさが辛い。一日一日今日も終わった!と思ってもあまり変わらない日が続いていく。わずかな差分を見て改善してると感じるしかないし、⚪︎週になったらもっと楽になると信じながら過ごすしかない。

 

出産までおよそ5ヶ月半。つわりの開始からいままでは2ヶ月半くらい。きっと苦しい期間は折り返しに入っているはず。

 

肝機能障害が出てきたので点滴を減らしたいと先生に言われたので、頑張って水を飲んでいきます。そして点滴を刺すところがだんだんなくなってきました。前の入院のときは1日2日で差し替えになるのがザラでしたが、今回は1週間近く長持ちするようになったので回復してる証拠かも?

妊娠悪阻入院生活

安定期まで公にしないつもりだったけど、いずれにせよこの経験を人に話していきたい、と思ったので書きます。

 

妊娠8wから悪阻で入院してて、11wはじめに退院して自宅療養してたものの12wで来た検診でぶっ倒れて再入院になりました。

 

5wにはじめて嘔吐してから、6wはなんやかんや出かけたり一部の食事が食べられてたけど、7wにはゼリーとクラッカー少々しか受け付けず、通院点滴しようとおもって病院に来たら入院に。

 

8w9wは胆汁を吐いたり強い悪寒でも汗ダラダラ、夜中にうまく息ができなくなったりすることがあり特にしんどかったです。それでも一日4回程度の嘔吐だったので、もっと重い人は重いだろうなと思ってました。プリンペランを何度か点滴してもらいましたが、逆に手足のむずむず感が出る気がして以降使うのをやめました。

 

10wには、早く楽になりたい思いで少しだけ食事をとり始め、11wのはじめに点滴も減らして自分で水分がとれるようになったところで退院。

 

自宅ではほぼ寝たきりでしたが、2日くらいは多少食べられた(しかも嘔吐なし)ものの3日目から食べたものをすぐ嘔吐するようになり水も気持ち悪くて飲めず、、からのケトン+3で再入院になりました。今は一日点滴4本とフルーツのみ出してもらう生活に後戻り。

 

一度目の入院は早く帰りたい、仕事に戻らなきゃ、お金心配、つわりのピーク(8w-10w)過ぎたらきっと楽になるはず、という気持ちで過ごしてましたが、12w再入院の時点であーこれはもしかしたら16w過ぎてもいるやつかも、点滴もあるし病院で少しでも楽に安全に過ごしたい、と半ば諦めモードに入ってます。ピーク時より症状はマシなので、回復も早いと嬉しいです。

 

これで切迫早産にでもなってさらに入院になったらお金がきついのでトツキトオカアプリで紹介されてた保険に月5000円で入会しました。悪阻入院に適用される保険はわかりませんが、これから妊娠を考えてる方はぜひ検討してほしいです。入院治療自体は高額医療費制度で月16万くらいが上限になるっぽいですが、私は部屋代とか食事代が別途かかるのですでに倍以上のお金が飛びました😇

 

入院中の過ごし方ですが、昼までは寝る以外の選択肢なし、調子がいい時はスマホが多少見れるという感じです。(刺激が強いコンテンツは無理)Xで同じく悪阻で入院していた方の投稿を読んで、いつか終わりが来ることや、産後一年過ごしたけど悪阻より辛いことはなかった、という話に希望を持ったりしてます。そして週に一度のエコーで赤ちゃんが成長してるのが見れるのが癒しです。

 

一度コウノドリの漫画を読んでみましたが今まで知らなかった数多の妊娠によるリスクを知ってしまい、不安が増し過ぎたのでやめておけばよかったです。本当にすべての母たち、そして医療職の皆様はすごいと思いました。

 

本当に本当に一日でも早く悪阻で苦しむ人がいなくなるように、医療技術の進歩を心から願ってます…🙏 

 

抗がん剤治療もこれの比じゃないくらい相当しんどいことが想像できたので、みんな本当健康診断をちゃんと受けて、身体を大切に生きてほしいです。

Tips for Handling Japanese in Snowflake ODBC with Ruby

This article is the English version of Snowflake ODBC with Ruby で日本語を扱うTips ~ ruby-odbc と共に ~

As of 2025/03, Snowflake does not have a Ruby SDK. Therefore, when using a Ruby application as a client, it is necessary to implement a REST API or ODBC connection. This time, we had to investigate errors in ODBC connections, so here is a summary of the contents.

Environment

Errors that were occurring

Condition 1) The number of characters in the string column definition is small (e.g. VARCHAR(4)) Condition 2) Japanese strings are stored.

The following two types of errors occurred in the case of a table called `Sequel::DatabaseError

Sequel::DatabaseError: ArgumentError: negative string size (or size too big)

→ Error in data acquisition process.

JSON::GeneratorError: source sequence is illegal/malformed utf-8

→ No error occurs in the data acquisition process itself, but an error occurs when the object containing the acquired byte sequence is JSON serialized.

Investigation

We will follow the location where the error occurs. This line was traceable in the former Ruby stack trace.

https://github.com/jeremyevans/sequel/blob/5.89.0/lib/sequel/adapters/odbc.rb#L95

Debugging it, I found that s is an object of ODBC::Statement 1. The each method is defined in the C extension part of ruby-odbc.

https://github.com/larskanis/ruby-odbc/blob/38d1431b7b8589e54079d93817db03a3846afbf7/ext/odbc.c#L6785

The code for the latest Ruby 3.2-compatible v0.999992 Gem is maintained by Christian Werner, but the code is not committed to GitHub, so for the sake of explanation, I'll check the code with the previous version by Lars Kanis. 2

If you follow the code of stmt_each, you will find a function called do_fetch. This function has about 500 lines and is very hard to read...

https://github.com/larskanis/ruby-odbc/blob/38d1431b7b8589e54079d93817db03a3846afbf7/ext/odbc.c#L5921

To get the results, call the SQLGetData function.

https://learn.microsoft.com/ja-jp/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-ver16

According to ChatGPT, the specification seems to be as follows

In the case of the SQLGetData function, the data itself is passed as an address (pointer) of a buffer allocated in advance, and the acquired data is written to that buffer inside the function. The length of the data and the null flag are also stored in the pointer (StrLen_or_IndPtr) that is passed in advance.

The size of the buffer to be allocated in advance is set to S.

The preallocated buffer size is the column metadata obtained by the SQLColAttribute function.

https://github.com/larskanis/ruby-odbc/blob/38d1431b7b8589e54079d93817db03a3846afbf7/ext/odbc.c#L3184

The following conditions can be summarized for string columns.

ODBC driver return type ruby-odbc UNICODE flag type size
SQL_LONGVARCHAR ON (UNICODE=true) SQL_C_WCHAR SQL_NO_TOTAL
SQL_LONGVARCHAR OFF (UNICODE=false) SQL_C_CHAR SQL_NO_TOTAL
SQL_LONGVARCHAR ON (UNICODE=true) SQL_C_WCHAR number of characters × sizeof(SQLWCHAR) + sizeof(SQLWCHAR)(NULL-terminated)
non SQL_LONGVARCHAR OFF (UNICODE=false) SQL_C_CHAR number of characters + 1 (for null terminated)

To set UNICODE to true, you apparently need to build for UTF8 and call it with require 'odbc_utf8'. 3

This has suggested that if the byte size of the data is large relative to the number of characters in the column, the fourth pattern may result in an error because the buffer size allocated is smaller than actually needed.

In light of the above, we will look again at the implementation within do_fetch.

https://github.com/larskanis/ruby-odbc/blob/38d1431b7b8589e54079d93817db03a3846afbf7/ext/odbc.c#L6169

The variable curlen is initialized with the size obtained earlier.

https://github.com/larskanis/ruby-odbc/blob/38d1431b7b8589e54079d93817db03a3846afbf7/ext/odbc.c#L6361

If type == SQL_C_CHAR, we call rb_tainted_str_new (moved to rb_str_new in Ruby 3.2) with the character size we just got and generate a string.

https://github.com/larskanis/ruby-odbc/blob/38d1431b7b8589e54079d93817db03a3846afbf7/ext/odbc.c#L6361

If you look at the definition of the rb_tainted_str_new function in Ruby's string.c, you will see that internally the str_new0 function is called, and in it, if len < 0 (if curlen is a negative value), the following error message is generated

https://github.com/ruby/ruby/blob/v3_1_6/string.c#L881-L883

Since curlen is also specified as an argument to SQLGetData, it is likely that under some condition the call to SQLGetData causes curlen to be negative and an error to occur. (I ran out of steam before I could continue further investigation...)

Solution

  • The right way: use the UTF-8 version of ruby-odbc (odbc_utf8).
    • Untested, but you may need to be creative when using it with Sequel.
    • Only adding require "odbc_utf8" before Sequel worked.
  • Workaround: In Snowflake, specify MapToLongVarchar parameter 4 in Snowflake ODBC driver as configuration/connection parameter so that the column type is mapped to SQL_LONGVARCHAR.

Conclusion

Most of this research was code reading of ruby-odbc. With little information available in Japanese, this was a good opportunity to deepen my understanding of the internal workings of the ODBC binding in Ruby. I hope it will be helpful for those who face similar challenges.

Throwback to 2024

Surprisingly, almost one year had passed after I wrote my last article.

The most impressive thing was getting messages from three old friends. One is related to the marriage of my high school friend. The other one is about the passing of my favorite singer. l found out later that some friends facing the sad event came to remind me. The other is about a job change from the sales to the engineer.

Though I've lost many feelings to adapt to this environment, so-called web venture, while talking with these people, I've regained lost parts of my memories. In the process of installing new values other than mine, I came to regret many of my choices, but I came to think I would take the almost same way if I lived my life twice. I wanted to dance, but I would get a guitar and begin a band. I also wanted to learn computer science but would learn literature :P The environment and the atmosphere of the time were hard molds for me.

Fortunately, since I've been successful in my job choice, I want to be a nice programmer who makes great software by myself :)

There were a few hardships while working as a team manager. I didn't take the time to write blogs or to go to some engineering communities. There was no room for my mind. The thought that being a great engineering manager I think is only accomplished by being a great programmer (compared with me) is growing stronger day by day. I've noticed my limited cap in being a manager in a place that is not a popular company.

To make software, you should work with teammates. To meet great teammates, you or your teammates should be an attractive programmer or your company must be a winning horse. My teammates are attractive, but I should be more attractive to gain great power. Thankfully, opportunities to work with people I would like to work with have gradually appeared.

The thing I should do is just code, sometimes read books or blogs, and code. The only way to enjoy my work from the bottom of my heart is to code.

During the holidays, I read several books and articles by giants of software architecture or OOP. I need to understand the fundamentals of cohesion and coupling and SOLID. And I should know how languages implement the concept. It's like being a third-year rookie, but it takes time to know the heart of the matter.