2016-08-31

tclcubrid v0.4

Source code:
tclcubrid


About:

CUBRID is an open source SQL-based relational database management system with object extensions developed by Naver Corporation for web applications.

tclcubrid is a Tcl extension by using CUBRID CCI (CCI Client Interface) driver to connect CUBRID. I write this extension to research CUBRID and CCI (CCI Client Interface) driver.


Main changelog:
  1. Update test cases
  2. Update README.md


原始碼並沒有更動,只有更新 test cases,加入更多基本測試。

2016-08-18

tclcubrid v0.3

Source code:
tclcubrid


About:

CUBRID is an open source SQL-based relational database management system with object extensions developed by Naver Corporation for web applications.

tclcubrid is a Tcl extension by using CUBRID CCI (CCI Client Interface) driver to connect CUBRID. I write this extension to research CUBRID and CCI (CCI Client Interface) driver.


Main changelog:

  1. Add sequence type support
  2. Add set type support


嘗試加入更多 type 的支援。

2016-08-17

tclcubrid v0.2

Source code:
tclcubrid


About:

CUBRID is an open source SQL-based relational database management system with object extensions developed by Naver Corporation for web applications.

tclcubrid is a Tcl extension by using CUBRID CCI (CCI Client Interface) driver to connect CUBRID. I write this extension to research CUBRID and CCI (CCI Client Interface) driver.


Main changelog:
  1. Using cci_connect_ex to replace cci_connect_3_0 method
  2. Add monetary type support
  3. Add enum type support


替換使用的 method,改為使用 cci_connect_ex。並且嘗試加入更多 type 的支援。

2016-08-05

Tcl extension for CUBRID database: tclcubrid

Source code:
tclcubrid


About:

CUBRID is an open source SQL-based relational database management system with object extensions developed by Naver Corporation for web applications.

tclcubrid is a Tcl extension by using CUBRID CCI (CCI Client Interface) driver to connect CUBRID. I write this extension to research CUBRID and CCI (CCI Client Interface) driver.


這是開發中的早期版本,而且沒有進行比較完整的測試,比較簡單的功能已經可以使用,但是 BLOB/CLOB 我不知道怎麼樣簡化會比較好,所以目前並不支援。

使用 CUBRID 10.0 在 openSUSE LEAP 42.1 上測試。


2016/08/06
加入實驗性質的 CLOB/BLOB 支援,大小限制為 65536

2016/08/07
加入 TDBC interface

2016/08/10
移除 bit/varbit 的支援,改寫法以後,結果還是一樣不正確。
所以我移除掉 bit/varbit 的支援。

更新 CLOB/BLOB 大小限制為 131072。

2016/08/11
更新 bind 所使用的 type 名稱,讓使用的名稱與 TDBC 更接近。
int -> integer
short -> smallint

我知道我在哪裡犯錯了,重新加回 bit/varbit 的支援。

2016/08/12
Github 上建立第一個 tag,版本號碼為 0.1。

2016-07-12

Build Casstcl on openSUSE LEAP 42.1 (64bit)

下載 Cassandra C++ driver source code 以後,在解壓縮的根目錄下,修改 CMakeLists.txt 的內容, 因為要加入 openSUSE 的資料。
    elseif(EXISTS "/etc/redhat-release" OR EXISTS "/etc/fedora-release" OR
           EXISTS "/etc/slackware-version" OR EXISTS "/etc/gentoo-release" OR
           EXISTS "/etc/os-release")
      if(CMAKE_SIZEOF_VOID_P EQUAL 8)
        set (CMAKE_INSTALL_LIBDIR "lib64")
      else()
        set (CMAKE_INSTALL_LIBDIR "lib")
      endif()

(* 我有送出一個 pull request 被接受了,所以接下來的版本可能可以不用修改這裡)

Cassandra C++ driver 需要 libuv-devel 和 Open SSL 有安裝才能正確編譯。

建立一個 build 的目錄,然後使用下面的命令建立 Makefile (for openSUSE 64bit):
cmake -DCMAKE_INSTALL_PREFIX=/usr  ..

再來就是 make 與 make install: 
make
sudo make install

下面就是測試的 C++ 程式:
#include <cassandra.h>
#include <stdio.h>

int main() {
  /* Setup and connect to cluster */
  CassFuture* connect_future = NULL;
  CassCluster* cluster = cass_cluster_new();
  CassSession* session = cass_session_new();

  /* Add contact points */
  cass_cluster_set_contact_points(cluster, "127.0.0.1");

  /* Provide the cluster object as configuration to connect the session */
  connect_future = cass_session_connect(session, cluster);

  if (cass_future_error_code(connect_future) == CASS_OK) {
    CassFuture* close_future = NULL;

    /* Build statement and execute query */
    CassStatement* statement
      = cass_statement_new("SELECT keyspace_name "
                           "FROM system_schema.keyspaces", 0);

    CassFuture* result_future = cass_session_execute(session, statement);

    if(cass_future_error_code(result_future) == CASS_OK) {
      /* Retrieve result set and iterate over the rows */
      const CassResult* result = cass_future_get_result(result_future);
      CassIterator* rows = cass_iterator_from_result(result);

      while(cass_iterator_next(rows)) {
        const CassRow* row = cass_iterator_get_row(rows);
        const CassValue* value = cass_row_get_column_by_name(row, "keyspace_name");

        const char* keyspace;
        size_t keyspace_length;
        cass_value_get_string(value, &keyspace, &keyspace_length);
        printf("keyspace_name: '%.*s'\n",
               (int)keyspace_length, keyspace);
      }

      cass_result_free(result);
      cass_iterator_free(rows);
    } else {
      /* Handle error */
      const char* message;
      size_t message_length;
      cass_future_error_message(result_future, &message, &message_length);
      fprintf(stderr, "Unable to run query: '%.*s'\n",
              (int)message_length, message);
    }

    cass_statement_free(statement);
    cass_future_free(result_future);

    /* Close the session */
    close_future = cass_session_close(session);
    cass_future_wait(close_future);
    cass_future_free(close_future);
  } else {
    /* Handle error */
    const char* message;
    size_t message_length;
    cass_future_error_message(connect_future, &message, &message_length);
    fprintf(stderr, "Unable to connect: '%.*s'\n",
            (int)message_length, message);
  }

  cass_future_free(connect_future);
  cass_cluster_free(cluster);
  cass_session_free(session);

  return 0;
}

注意,system_schema.keyspaces 在 3.x 之前,需要使用 system.schema_keyspaces 才行 (CASSANDRA-6717)。

因為 Tcl driver 建立在 CPP driver 之上,所以接下來是在 openSUSE 64bit 環境安裝 Tcl driver。

下面是 build 的命令:

autoconf
./configure --enable-64bit --libdir=/usr/lib64/tcl
make
sudo make install

如果成功的話,就可以使用 casstcl 這個套件來存取 Apache Cassandra。

下面是一個範例:

package require casstcl

set cass [::casstcl::connect -host 127.0.0.1 -port 9042]
$cass select "SELECT keyspace_name FROM system_schema.keyspaces;" row {
  parray row
}
$cass delete

目前 casstcl 在 prepared statement 使用 ? 做 parameters binding,需要在第一次使用 exec 前呼叫 reimport_column_type_map,執行的結果才會是正確的(更正:或者是在 create table 之後,因為新增的 table 還沒有對應資料)。

2016-07-07

tcljsonnet v0.4

首頁:
tcljsonnet


主要更新:
將 Jsonnet code base 版本升到 v0.8.9 版。

2016-06-15

TkCVS

TkCVS


因為需要在 Linux 環境中有一個簡易的 SVN 介面,所以下載 TkCVS 來使用。稍微看了一下,我發現是使用呼叫 svn command line tool 然後讀取結果的方法。

下面是 source code 的片段:
  set commandline "svn log -g -l 1"
  set ret [catch {eval "exec $commandline"} output]

很有趣的做法。

2016-05-26

GeodeREST v0.1: Apache Geode REST Client Library for Tcl

Hompage


GeodeREST: Apache Geode REST Client Library for Tcl

About

Apache Geode provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing.

This extension is an Apache Geode REST Client Library for Tcl. The library consists of a single Tcl Module file.

一些說明

目前有二個方式可以從 Tcl 存取 Apache Geode,一個是利用 memcached interface (memcached-for-Tcl),一個則是 REST interface。

這個 Tcl extension 試著利用 Apache Geode REST interface 存取資料。

2016-05-10

tcl-lmdb v0.3.5

檔案放置網頁


tcl-lmdb - Tcl interface to the Lightning Memory-Mapped Database

About


This is the Lightning Memory-Mapped Database (LMDB) extension for Tcl using the Tcl Extension Architecture (TEA).

LMDB is a Btree-based database management library with an API similar to BerkeleyDB. The library is thread-aware and supports concurrent read/write access from multiple processes and threads. The DB structure is multi-versioned, and data pages use a copy-on-write strategy, which also provides resistance to corruption and eliminates the need for any recovery procedures. The database is exposed in a memory map, requiring no page cache layer of its own. This extension provides an easy to use interface for accessing LMDB database files from Tcl.

Main Change

  • Fix overflow of a nearby variable on the stack patch from gahr
  • Chase gcc 4.8 warning patch from gahr
  • env open command: let -fixedmap default to false

一些說明


merge 從 gahr 來的修正 patch。

2016-05-09

tclxqilla v0.1

Homepage


tclxqilla

About


XQilla is an XQuery and XPath 2 library and command line utility written in C++, implemented on top of the Xerces-C library. It is made available under the terms of the Apache License v2.

XQilla's XQC API implements a standard C API for XQuery implementations, defined in collaboration with the Zorba project.

tclxqilla is a Tcl extension to use XQilla XQC API to execute XQuery expression.
This extension is using Tcl_LoadFile to load XQilla library.

一些說明


對 XQilla 的 XQC API 做的 Tcl extension。我本來是要做某個東西的 prototype,不過後來發現跟我的想像有點差距,所以只做完簡單版的 Tcl extension for XQilla library 以後,就停止我的計畫了。

說不定有人會需要,所以我把 source code 放上去 Github。