From 3010765d12e73ebfe1b7dc376b1d65ed260ca7aa Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 31 Aug 2008 03:07:41 -0500 Subject: [PATCH] delete old mysql --- extra/db/mysql/ffi/ffi.factor | 25 ----------- extra/db/mysql/lib/lib.factor | 78 ----------------------------------- extra/db/mysql/mysql.factor | 51 ----------------------- 3 files changed, 154 deletions(-) delete mode 100644 extra/db/mysql/ffi/ffi.factor delete mode 100644 extra/db/mysql/lib/lib.factor delete mode 100755 extra/db/mysql/mysql.factor diff --git a/extra/db/mysql/ffi/ffi.factor b/extra/db/mysql/ffi/ffi.factor deleted file mode 100644 index c047393c99..0000000000 --- a/extra/db/mysql/ffi/ffi.factor +++ /dev/null @@ -1,25 +0,0 @@ -! Copyright (C) 2007 Berlin Brown, 2008 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -! Adapted from mysql.h and mysql.c -! Tested with MySQL version - 5.0.24a -USING: alien alien.syntax combinators kernel system ; -IN: db.mysql.ffi - -<< "mysql" { - { [ os winnt? ] [ "libmySQL.dll" "stdcall" ] } - { [ os macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] } - { [ os unix? ] [ "libmysqlclient.so.14" "cdecl" ] } -} cond add-library >> - -LIBRARY: mysql - -FUNCTION: void* mysql_init ( void* mysql ) ; -FUNCTION: char* mysql_error ( void* mysql ) ; -FUNCTION: void* mysql_real_connect ( void* mysql, char* host, char* user, char* passwd, char* db, int port, char* unixsocket, long clientflag ) ; -FUNCTION: void mysql_close ( void* sock ) ; -FUNCTION: int mysql_query ( void* mysql, char* q ) ; -FUNCTION: void* mysql_use_result ( void* mysql ) ; -FUNCTION: void mysql_free_result ( void* result ) ; -FUNCTION: char** mysql_fetch_row ( void* result ) ; -FUNCTION: int mysql_num_fields ( void* result ) ; -FUNCTION: ulong mysql_affected_rows ( void* mysql ) ; diff --git a/extra/db/mysql/lib/lib.factor b/extra/db/mysql/lib/lib.factor deleted file mode 100644 index db8c08180b..0000000000 --- a/extra/db/mysql/lib/lib.factor +++ /dev/null @@ -1,78 +0,0 @@ -! Copyright (C) 2007 Berlin Brown, 2008 Doug Coleman. -! See http://factorcode.org/license.txt for license. -! Adapted from mysql.h and mysql.c -! Tested with MySQL version - 5.0.24a -USING: kernel alien io prettyprint sequences -namespaces arrays math db.mysql.ffi system accessors ; -IN: db.mysql.lib - -SYMBOL: my-conn - -TUPLE: mysql-db handle host user password db port ; -TUPLE: mysql-statement ; -TUPLE: mysql-result-set ; - -: new-mysql ( -- conn ) - f mysql_init ; - -: mysql-error ( mysql -- ) - [ mysql_error throw ] when* ; - -! : mysql-connect ( mysql-connection -- ) - ! new-mysql over set-mysql-db-handle - ! dup { - ! mysql-db-handle - ! mysql-db-host - ! mysql-db-user - ! mysql-db-password - ! mysql-db-db - ! mysql-db-port - ! } get-slots f 0 mysql_real_connect mysql-error ; - -! ========================================================= -! Low level mysql utility definitions -! ========================================================= - -: (mysql-query) ( mysql-connection query -- ret ) - >r db-handle>> r> mysql_query ; - -! : (mysql-result) ( mysql-connection -- ret ) - ! [ mysql-db-handle mysql_use_result ] keep - ! [ set-mysql-connection-resulthandle ] keep ; - -! : (mysql-affected-rows) ( mysql-connection -- n ) - ! mysql-connection-mysqlconn mysql_affected_rows ; - -! : (mysql-free-result) ( mysql-connection -- ) - ! mysql-connection-resulthandle drop ; - -! : (mysql-row) ( mysql-connection -- row ) - ! mysql-connection-resulthandle mysql_fetch_row ; - -! : (mysql-num-cols) ( mysql-connection -- n ) - ! mysql-connection-resulthandle mysql_num_fields ; - -! : mysql-char*-nth ( index object -- str ) - ! #! Utility based on 'char*-nth' to perform an additional sanity check on the value - ! #! extracted from the array of strings. - ! void*-nth [ alien>char-string ] [ "" ] if* ; - -! : mysql-row>seq ( object n -- seq ) - ! [ swap mysql-char*-nth ] map-with ; - -! : (mysql-result>seq) ( seq -- seq ) - ! my-conn get (mysql-row) dup [ - ! my-conn get (mysql-num-cols) mysql-row>seq - ! over push - ! (mysql-result>seq) - ! ] [ drop ] if - ! ! Perform needed cleanup on fetched results - ! my-conn get (mysql-free-result) ; - -! : mysql-query ( query -- ret ) - ! >r my-conn get r> (mysql-query) drop - ! my-conn get (mysql-result) ; - -! : mysql-command ( query -- n ) - ! mysql-query drop - ! my-conn get (mysql-affected-rows) ; diff --git a/extra/db/mysql/mysql.factor b/extra/db/mysql/mysql.factor deleted file mode 100755 index 1767bf3d50..0000000000 --- a/extra/db/mysql/mysql.factor +++ /dev/null @@ -1,51 +0,0 @@ -! Copyright (C) 2008 Doug Coleman. -! See http://factorcode.org/license.txt for license. -USING: alien continuations destructors io kernel prettyprint -sequences db db.mysql.ffi ; -IN: db.mysql - -TUPLE: mysql-db handle host user password db port ; -TUPLE: mysql-statement ; -TUPLE: mysql-result-set ; - -M: mysql-db db-open ( mysql-db -- ) - ; - -M: mysql-db dispose ( mysql-db -- ) - mysql-db-handle mysql_close ; - -M: mysql-db ( str in out -- statement ) - 3drop f ; - -M: mysql-db ( str in out -- statement ) - 3drop f ; - -M: mysql-statement prepare-statement ( statement -- ) - drop ; - -M: mysql-statement bind-statement* ( statement -- ) - drop ; - -M: mysql-statement query-results ( query -- result-set ) - drop f ; - -M: mysql-result-set #rows ( result-set -- n ) - drop 0 ; - -M: mysql-result-set #columns ( result-set -- n ) - drop 0 ; - -M: mysql-result-set row-column ( result-set n -- obj ) - 2drop f ; - -M: mysql-result-set advance-row ( result-set -- ) - drop ; - -M: mysql-db begin-transaction ( -- ) - ; - -M: mysql-db commit-transaction ( -- ) - ; - -M: mysql-db rollback-transaction ( -- ) - ;