DELAEMON BLOG

Live as if you were to die tomorrow. Learn as if you were to live forever.

2013-05-01から1ヶ月間の記事一覧

MySQL UDF UDF_ARGS, UDF_INIT

mysql_com.h 487 typedef struct st_udf_args 488 { 489 unsigned int arg_count;>-->---/* Number of arguments */ 490 enum Item_result *arg_type;>-->---/* Pointer to item_results */ 491 char **args;>->--->--->---/* Pointer to argument */ 492 un…

MySQL UserDefinedFunction

http://dev.mysql.com/doc/refman/4.1/ja/adding-udf.html単純関数のUDFでhello world的なものを作ってみる。orz.c #include <string.h> #include <mysql/mysql.h> my_bool orz_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { return 0; } void orz_deinit(UDF_INIT *initi</mysql/mysql.h></string.h>…

Apache Module logging

前回のままだとエラーメッセージを画面に出力してるので、ログファイルに書き出すように変更。読み込み #include "http_log.h エラー int code = apr_dbd_select(dbd->driver, r->pool, dbd->handle, &res, stmt, 0); if (code != 0) { ap_log_rerror(APLOG_…

Apache Module mod_dbd (ubuntu 12.4 apache install)

Apache Moduleからmod_dbdを使ってDBにアクセス、レコードの中身を表示してみる。 mod_dbdはapr(Apache Portable Runtime)を使ってデータベースを操作するもの。 http://httpd.apache.org/docs/2.4/mod/mod_dbd.html http://apr.apache.org/ubuntuにはmodule…

Apache Module IPを表示

ひな形つくってモジュールとディレクトリの紐付け済みでmod_xx.cを以下に編集 // ~ 省略 #include "http_core.h" /* The sample content handler */ static int ip_handler(request_rec *r) { const char *remotehost = NULL; if (strcmp(r->handler, "ip"))…

Apache Module ClearSilver

前作ったhello worldモジュールでClearSilverを使って表示してみるhttp://delaemon.hatenablog.jp/entry/2013/04/24/010326Makefile コマンドをapxs → apxs2へ。ClearSilverのインストールされたパスを指定。読み込むライブラリを指定。 # the used tools AP…