Hi everyone,

I want to know how to call my user defined function binarycopy() in MonetDB/sql/backends/monet5/UDF/svom.c in another C program?

I dont want to use my UDF i sql client but want to use as a C API.


Thanks!
Meng


2013/7/4 hlfwm hlfwm <hlfwmqd@gmail.com>
Another important question is how to call my defined function by a user to test it?

I mean not called in sql client , but in another C program.


Thanks !

Meng


2013/7/4 hlfwm hlfwm <hlfwmqd@gmail.com>
Hi, 

when i use my UDF in sql , i got :

sql>select binarycopy('starid','10000',1);
TypeException:user.s6_1[5]:'svom.binarycopy' undefined in: _9:any := svom.binarycopy(_6:str, _7:str, _8:int)
program contains errors

anyone knows what mean by what is undefined in _9:any???



2013/7/3 hlfwm hlfwm <hlfwmqd@gmail.com>
Hi Stefan,

Thanks very much, i entered into gdb debug and set a breakpoint at binaryCopy,

(gdb) b binaryCopy
Note: breakpoint 1 (permanent) also set at pc 0x7fffee687f2a.
Breakpoint 2 at 0x7fffee687f2a: file svom.c, line 36.

but how could i debug my defined function and step into it, how to enter my function?

Best regards,
Meng


2013/7/2 Stefan Manegold <Stefan.Manegold@cwi.nl>
turn "lib_svom" into "lib__svom" (mind the double '_' as with udf & ssdb --- exactly the name difference you noticed and were wondering about ...) and things should work ... --- you also need to start with a newly created virgin empty database to ensure that all scripts in libdir/monetdb5/createdb (i.e., including your 81_svom.sql) are executed (they are not expected to be idempotent and thus only executed with the first server start on a new virgin empty DB) ...

----- Original Message -----
> hi, my Makefile.ag :
>
> [svomhpc@localhost/home/data1/download/new/MonetDB/sql/backends/monet5/UDF]$>cat
> Makefile.ag
> # The contents of this file are subject to the MonetDB Public License
> # Version 1.1 (the "License"); you may not use this file except in
> # compliance with the License. You may obtain a copy of the License
> at
> # http://www.monetdb.org/Legal/MonetDBLicense
> #
> # Software distributed under the License is distributed on an "AS IS"
> # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
> the
> # License for the specific language governing rights and limitations
> # under the License.
> #
> # The Original Code is the MonetDB Database System.
> #
> # The Initial Developer of the Original Code is CWI.
> # Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
> # Copyright August 2008-2013 MonetDB B.V.
> # All Rights Reserved.
>
> INCLUDES = .. \
>          ../../../include \
>         ../../../common \
>         ../../../storage \
>         ../../../server \
>         ../../../../monetdb5/modules/atoms \
>         ../../../../monetdb5/modules/kernel \
>         ../../../../monetdb5/mal \
>         ../../../../monetdb5/modules/mal \
>         ../../../../monetdb5/optimizer \
>         ../../../../clients/mapilib \
>         ../../../../common/options \
>         ../../../../common/stream \
>         ../../../../gdk
>
> lib__udf = {
>         MODULE
>         DIR = libdir/monetdb5
>         SOURCES = udf.c udf.h udf_impl.h
>         LIBS = ../../../../monetdb5/tools/libmonetdb5 \
>                    ../../../../gdk/libbat
> }
>
> lib__ssdb = {
>         MODULE
>         DIR = libdir/monetdb5
>         SOURCES = ssdb.c ssdb.h
>         LIBS = ../../../../monetdb5/tools/libmonetdb5 \
>                 ../../../../gdk/libbat \
>                 ../../../server/libsqlserver \
>                 ../../../storage/libstore \
>                 ../../../storage/bat/libbatstore \
>                 ../../../storage/restrict/librestrictstore \
>                 ../../../common/libsqlcommon \
>                 ../../../../common/stream/libstream
> }
>
> lib_svom = {
>         MODULE
>         DIR = libdir/monetdb5
>         SOURCES = svom.c svom.h
>         LIBS = ../../../../monetdb5/tools/libmonetdb5 \
>                ../../../../gdk/libbat
>                ../../../server/libsqlserver \
>                ../../../storage/libstore \
>                ../../../storage/bat/libbatstore \
>                ../../../storage/restrict/librestrictstore \
>                ../../../common/libsqlcommon \
>                ../../../../common/stream/libstream
> }
>
> headers_mal = {
>         HEADERS = mal
>         DIR = libdir/monetdb5
>         SOURCES = udf.mal ssdb.mal svom.mal
> }
>
> headers_sql = {
>         HEADERS = sql
>         DIR = libdir/monetdb5/createdb
>         SOURCES = 80_udf.sql 80_ssdb.sql 81_svom.sql
> }
>
> headers_autoload = {
>         HEADERS = mal
>         DIR = libdir/monetdb5/autoload
>         SOURCES = 80_udf.mal 80_ssdb.mal 81_svom.mal
> }
>
> EXTRA_DIST_DIR = Tests
>
>
> 2013/7/2 Stefan Manegold <Stefan.Manegold@cwi.nl>
>
> > There is no function "reverse" in UDF.
> >
> > What does `mserver5` say?
> >
> > Can you share your Makefile.ag?
> >
> > Stefan
> >
> > ----- Original Message -----
> > > Hi Stefan,
> > >
> > > i double-checked my Makefile.ag, and mserver5 start-up message:
> > >
> > > [svomhpc@localhost /home/data1/opt/MonetDB]$>*ps -ef|grep
> > > monetdb*
> > > svomhpc  19083     1  0 12:58 ?        00:00:00 monetdbd start
> > > mydbfarm2
> > > svomhpc  19090 19083  0 12:58 ?        00:00:01
> > > /home/data1/opt/MonetDB/bin/mserver5
> > > --dbpath=/home/data1/mydbfarm2/mydb2
> > > --set merovingian_uri
> > > mapi:monetdb://localhost.localdomain:50000/mydb2
> > > --set mapi_open false --set mapi_port 0 --set mapi_usock
> > > /home/data1/mydbfarm2/mydb2/.mapi.sock --set monet_vault_key
> > > /home/data1/mydbfarm2/mydb2/.vaultkey --set gdk_nr_threads 4
> > > --set
> > > max_clients 64 --set sql_optimizer default_pipe --set
> > > monet_daemon
> > > yes
> > > svomhpc  19399 26416  0 13:16 pts/2    00:00:00 grep --color=auto
> > > monetdb
> > > [svomhpc@localhost /home/data1/opt/MonetDB]$>
> > > [svomhpc@localhost /home/data1/opt/MonetDB]$>
> > > [svomhpc@localhost /home/data1/opt/MonetDB]$>
> > > [svomhpc@localhost /home/data1/opt/MonetDB]$>*sudo gdb
> > > /home/data1/opt/MonetDB/bin/mserver5 19090*
> > > GNU gdb (GDB) Fedora (7.5.0.20120926-25.fc18)
> > > Copyright (C) 2012 Free Software Foundation, Inc.
> > > License GPLv3+: GNU GPL version 3 or later
> > > <http://gnu.org/licenses/gpl.html
> > > >
> > > This is free software: you are free to change and redistribute
> > > it.
> > > There is NO WARRANTY, to the extent permitted by law.  Type "show
> > > copying"
> > > and "show warranty" for details.
> > > This GDB was configured as "x86_64-redhat-linux-gnu".
> > > For bug reporting instructions, please see:
> > > <http://www.gnu.org/software/gdb/bugs/>...
> > > Reading symbols from /home/data1/opt/MonetDB/bin/mserver5...done.
> > > Attaching to program: /home/data1/opt/MonetDB/bin/mserver5,
> > > process
> > > 19090
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/libmonetdb5.so.14...done.
> > > Loaded symbols for /home/data1/opt/MonetDB/lib/libmonetdb5.so.14
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/libbat.so.9...done.
> > > Loaded symbols for /home/data1/opt/MonetDB/lib/libbat.so.9
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/libmapi.so.6...done.
> > > Loaded symbols for /home/data1/opt/MonetDB/lib/libmapi.so.6
> > > Reading symbols from /lib64/libuuid.so.1...Reading symbols from
> > > /lib64/libuuid.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libuuid.so.1
> > > Reading symbols from /lib64/libreadline.so.6...Reading symbols
> > > from
> > > /lib64/libreadline.so.6...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libreadline.so.6
> > > Reading symbols from /lib64/libxml2.so.2...Reading symbols from
> > > /lib64/libxml2.so.2...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libxml2.so.2
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/libstream.so.3...done.
> > > Loaded symbols for /home/data1/opt/MonetDB/lib/libstream.so.3
> > > Reading symbols from /lib64/libm.so.6...(no debugging symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libm.so.6
> > > Reading symbols from /lib64/libz.so.1...Reading symbols from
> > > /lib64/libz.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libz.so.1
> > > Reading symbols from /lib64/libbz2.so.1...Reading symbols from
> > > /lib64/libbz2.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libbz2.so.1
> > > Reading symbols from /lib64/libcurl.so.4...Reading symbols from
> > > /lib64/libcurl.so.4...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libcurl.so.4
> > > Reading symbols from /lib64/libpcre.so.1...Reading symbols from
> > > /lib64/libpcre.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libpcre.so.1
> > > Reading symbols from /lib64/libssl.so.10...Reading symbols from
> > > /lib64/libssl.so.10...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libssl.so.10
> > > Reading symbols from /lib64/libcrypto.so.10...Reading symbols
> > > from
> > > /lib64/libcrypto.so.10...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libcrypto.so.10
> > > Reading symbols from /lib64/libdl.so.2...(no debugging symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libdl.so.2
> > > Reading symbols from /lib64/libpthread.so.0...(no debugging
> > > symbols
> > > found)...done.
> > > [New LWP 19099]
> > > [New LWP 19098]
> > > [New LWP 19097]
> > > [New LWP 19096]
> > > [New LWP 19094]
> > > [New LWP 19093]
> > > [New LWP 19092]
> > > [New LWP 19091]
> > > [Thread debugging using libthread_db enabled]
> > > Using host libthread_db library "/lib64/libthread_db.so.1".
> > > Loaded symbols for /lib64/libpthread.so.0
> > > Reading symbols from /lib64/libc.so.6...(no debugging symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libc.so.6
> > > Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging
> > > symbols
> > > found)...done.
> > > Loaded symbols for /lib64/ld-linux-x86-64.so.2
> > > Reading symbols from /lib64/libtinfo.so.5...Reading symbols from
> > > /lib64/libtinfo.so.5...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libtinfo.so.5
> > > Reading symbols from /lib64/liblzma.so.5...Reading symbols from
> > > /lib64/liblzma.so.5...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/liblzma.so.5
> > > Reading symbols from /lib64/libidn.so.11...Reading symbols from
> > > /lib64/libidn.so.11...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libidn.so.11
> > > Reading symbols from /lib64/liblber-2.4.so.2...Reading symbols
> > > from
> > > /lib64/liblber-2.4.so.2...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/liblber-2.4.so.2
> > > Reading symbols from /lib64/libldap-2.4.so.2...Reading symbols
> > > from
> > > /lib64/libldap-2.4.so.2...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libldap-2.4.so.2
> > > Reading symbols from /lib64/librt.so.1...(no debugging symbols
> > > found)...done.
> > > Loaded symbols for /lib64/librt.so.1
> > > Reading symbols from /lib64/libgssapi_krb5.so.2...Reading symbols
> > > from
> > > /lib64/libgssapi_krb5.so.2...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libgssapi_krb5.so.2
> > > Reading symbols from /lib64/libkrb5.so.3...Reading symbols from
> > > /lib64/libkrb5.so.3...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libkrb5.so.3
> > > Reading symbols from /lib64/libk5crypto.so.3...Reading symbols
> > > from
> > > /lib64/libk5crypto.so.3...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libk5crypto.so.3
> > > Reading symbols from /lib64/libcom_err.so.2...Reading symbols
> > > from
> > > /lib64/libcom_err.so.2...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libcom_err.so.2
> > > Reading symbols from /lib64/libssl3.so...Reading symbols from
> > > /lib64/libssl3.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libssl3.so
> > > Reading symbols from /lib64/libsmime3.so...Reading symbols from
> > > /lib64/libsmime3.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libsmime3.so
> > > Reading symbols from /lib64/libnss3.so...Reading symbols from
> > > /lib64/libnss3.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libnss3.so
> > > Reading symbols from /lib64/libnssutil3.so...Reading symbols from
> > > /lib64/libnssutil3.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libnssutil3.so
> > > Reading symbols from /lib64/libplds4.so...Reading symbols from
> > > /lib64/libplds4.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libplds4.so
> > > Reading symbols from /lib64/libplc4.so...Reading symbols from
> > > /lib64/libplc4.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libplc4.so
> > > Reading symbols from /lib64/libnspr4.so...Reading symbols from
> > > /lib64/libnspr4.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libnspr4.so
> > > Reading symbols from /lib64/libssh2.so.1...Reading symbols from
> > > /lib64/libssh2.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libssh2.so.1
> > > Reading symbols from /lib64/libresolv.so.2...(no debugging
> > > symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libresolv.so.2
> > > Reading symbols from /lib64/libsasl2.so.2...Reading symbols from
> > > /lib64/libsasl2.so.2...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libsasl2.so.2
> > > Reading symbols from /lib64/libkrb5support.so.0...Reading symbols
> > > from
> > > /lib64/libkrb5support.so.0...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libkrb5support.so.0
> > > Reading symbols from /lib64/libkeyutils.so.1...Reading symbols
> > > from
> > > /lib64/libkeyutils.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libkeyutils.so.1
> > > Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libgcc_s.so.1
> > > Reading symbols from /lib64/libcrypt.so.1...(no debugging symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libcrypt.so.1
> > > Reading symbols from /lib64/libselinux.so.1...Reading symbols
> > > from
> > > /lib64/libselinux.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libselinux.so.1
> > > Reading symbols from /lib64/libfreebl3.so...Reading symbols from
> > > /lib64/libfreebl3.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libfreebl3.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_geom.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_geom.so
> > > Reading symbols from /lib64/libgeos_c.so.1...Reading symbols from
> > > /lib64/libgeos_c.so.1...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libgeos_c.so.1
> > > Reading symbols from /lib64/libgeos-3.3.2.so...Reading symbols
> > > from
> > > /lib64/libgeos-3.3.2.so...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libgeos-3.3.2.so
> > > Reading symbols from /lib64/libstdc++.so.6...(no debugging
> > > symbols
> > > found)...done.
> > > Loaded symbols for /lib64/libstdc++.so.6
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_json.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_json.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_jaql.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_jaql.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_sql.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_sql.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_fits.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_fits.so
> > > Reading symbols from /lib64/libcfitsio.so.0...Reading symbols
> > > from
> > > /lib64/libcfitsio.so.0...(no debugging symbols found)...done.
> > > (no debugging symbols found)...done.
> > > Loaded symbols for /lib64/libcfitsio.so.0
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_lsst.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_lsst.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_ssdb.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_ssdb.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_udf.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_udf.so
> > > Reading symbols from
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_opt_sql_append.so...done.
> > > Loaded symbols for
> > > /home/data1/opt/MonetDB/lib/monetdb5/lib_opt_sql_append.so
> > > 0x0000003efdeeb5f3 in select () from /lib64/libc.so.6
> > > Missing separate debuginfos, use: debuginfo-install
> > > bzip2-libs-1.0.6-7.fc18.x86_64 cfitsio-3.300-2.fc18.x86_64
> > > cyrus-sasl-lib-2.1.23-36.fc18.x86_64 geos-3.3.2-3.fc18.x86_64
> > > glibc-2.16-24.fc18.x86_64 keyutils-libs-1.5.5-3.fc18.x86_64
> > > krb5-libs-1.10.3-5.fc18.x86_64 libcom_err-1.42.5-1.fc18.x86_64
> > > libcurl-7.27.0-4.fc18.x86_64 libgcc-4.7.2-8.fc18.x86_64
> > > libidn-1.25-3.fc18.x86_64 libselinux-2.1.12-7.fc18.x86_64
> > > libssh2-1.4.2-2.fc18.x86_64 libstdc++-4.7.2-8.fc18.x86_64
> > > libuuid-2.22.1-2.1.fc18.x86_64 libxml2-2.9.0-3.fc18.x86_64
> > > ncurses-libs-5.9-7.20121017.fc18.x86_64 nspr-4.9.2-1.fc18.x86_64
> > > nss-3.14-7.fc18.x86_64 nss-softokn-freebl-3.14-5.fc18.x86_64
> > > nss-util-3.14-1.fc18.x86_64 openldap-2.4.33-3.fc18.x86_64
> > > openssl-libs-1.0.1c-7.fc18.x86_64 pcre-8.31-2.fc18.x86_64
> > > readline-6.2-5.fc18.x86_64 xz-libs-5.1.2-2alpha.fc18.x86_64
> > > zlib-1.2.7-9.fc18.x86_64
> > > (gdb) *b reverse*
> > > Function "reverse" not defined.
> > > Make breakpoint pending on future shared library load? (y or [n])
> > > n
> > > (gdb) *b udf.reverse*
> > > Function "udf.reverse" not defined.
> > > Make breakpoint pending on future shared library load? (y or [n])
> > > n
> > > (gdb)* b binaryCopy*
> > > Function "binaryCopy" not defined.
> > > Make breakpoint pending on future shared library load? (y or [n])
> > > n
> > > (gdb) *b binarycopy*
> > > Function "binarycopy" not defined.
> > > Make breakpoint pending on future shared library load? (y or [n])
> > > n
> > >
> > > gdb still find binarycopy and udf functions............
> > >
> > >
> > > 2013/6/29 Stefan Manegold <Stefan.Manegold@cwi.nl>
> > >
> > > > Please double-check your Makefile.ag and make sure it look like
> > > > the
> > > > one in
> > > > the canonical UDF example.
> > > >
> > > > Please double-check the messaged produced by your mserver5 at
> > > > start-up.
> > > >
> > > > Stefan
> > > >
> > > > ----- Original Message -----
> > > > > yes, i do follow the two page, but i didn't use the
> > > > > udf_impl.h<
> > > >
> > http://dev.monetdb.org/hg/MonetDB/file/a035a0351643/sql/backends/monet5/UDF/udf_impl.h
> > > > >
> > > > > like
> > > > > file.
> > > > >
> > > > >
> > > > > 2013/6/29 Stefan Manegold <Stefan.Manegold@cwi.nl>
> > > > >
> > > > > > Did you follow the proper step to add a C-implemented UDF
> > > > > > in
> > > > > > MonetDB?
> > > > > >
> > > > > > Cf.,
> > > > > >
> > > > > >
> > > >
> > http://www.monetdb.org/Documentation/Cookbooks/SQLrecipies/UserDefinedFunction
> > > > > > and
> > > > > > http://dev.monetdb.org/hg/MonetDB/file/tip/sql/backends/monet5/UDF
> > > > > >
> > > > > > for documentation and canonical example.
> > > > > >
> > > > > > Stefan
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > > [svomhpc@localhost /home/data1]$>*sudo gdb
> > > > > > > /home/data1/opt/MonetDB/bin/mserver5 21260*
> > > > > > > [sudo] password for svomhpc:
> > > > > > > ............................
> > > > > > > Reading symbols from
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_lsst.so...done.
> > > > > > > Loaded symbols for
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_lsst.so
> > > > > > > Reading symbols from
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_ssdb.so...done.
> > > > > > > Loaded symbols for
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_ssdb.so
> > > > > > > Reading symbols from
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_udf.so...done.
> > > > > > > Loaded symbols for
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_udf.so
> > > > > > > Reading symbols from
> > > > > > >
> > /home/data1/opt/MonetDB/lib/monetdb5/lib_opt_sql_append.so...done.
> > > > > > > Loaded symbols for
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5/lib_opt_sql_append.so
> > > > > > >
> > ...................................................................
> > > > > > > (gdb) b binarycopy
> > > > > > > Function "binarycopy" not defined.
> > > > > > >
> > > > > > > accordiing to the above, the svom lib is not loaded.
> > > > > > >
> > > > > > >
> > > > > > > [svomhpc@localhost
> > > > > > > /home/data1/opt/MonetDB/lib/monetdb5]$>ll
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1180 Jun 28 11:18
> > > > > > > lib_fits.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   66800 Jun 28 11:18
> > > > > > > lib_fits.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1192 Jun 28 11:18
> > > > > > > lib_geom.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   75821 Jun 28 11:18
> > > > > > > lib_geom.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1170 Jun 28 11:18
> > > > > > > lib_jaql.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc  434287 Jun 28 11:18
> > > > > > > lib_jaql.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1170 Jun 28 11:18
> > > > > > > lib_json.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc  217026 Jun 28 11:18
> > > > > > > lib_json.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1170 Jun 28 11:18
> > > > > > > lib_lsst.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   34435 Jun 28 11:18
> > > > > > > lib_lsst.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1230 Jun 28 11:18
> > > > > > > lib_opt_sql_append.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   30396 Jun 28 11:18
> > > > > > > lib_opt_sql_append.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1164 Jun 28 11:18
> > > > > > > lib_sql.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc 3026400 Jun 28 11:18
> > > > > > > lib_sql.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1170 Jun 28 11:18
> > > > > > > lib_ssdb.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc 1833811 Jun 28 11:18
> > > > > > > lib_ssdb.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1164 Jun 28 11:18
> > > > > > > *libsvom.la*
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   29015 Jun 28 11:18
> > > > > > > *libsvom.so*
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1164 Jun 28 11:18
> > > > > > > lib_udf.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   38231 Jun 28 11:18
> > > > > > > lib_udf.so
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc    1176 Jun 28 11:18
> > > > > > > lib_vault.la
> > > > > > > -rwxr-xr-x. 1 svomhpc svomhpc   42556 Jun 28 11:18
> > > > > > > lib_vault.so
> > > > > > >
> > > > > > > i dont know why the name of libsvom.la is different from
> > > > > > > other
> > > > > > > libs,
> > > > > > > could
> > > > > > > anyone tell me  how to correct the name?
> > > > > > >
> > > > > > >
> > > > > > > Thanks!
> > > > > > >
> > > > > > > Meng Wan
> > > > > > >
> > > > > > >
> > > > > > > 2013/6/26 Miguel Ping <miguel.ping@telecom.pt>
> > > > > > >
> > > > > > > >  I would do something like this:
> > > > > > > >
> > > > > > > > ps -ef | grep mserver5
> > > > > > > > > dude    27387 27358  0 17:46 ?        00:00:00
> > > > > > > > > /usr/local/bin/mserver5
> > > > > > > > --set gdk_d...
> > > > > > > > sudo gdb $(which mserver5) 27387
> > > > > > > >
> > > > > > > > (gdb) b binaryCopy
> > > > > > > > Breakpoint 1 at 0x7f71ef7b4000: file svom.c,...
> > > > > > > > (gdb) continue
> > > > > > > > <start mclient, test>
> > > > > > > >
> > > > > > > > But if the error happens before hitting your function,
> > > > > > > > I
> > > > > > > > don't
> > > > > > > > know
> > > > > > > > how to
> > > > > > > > debug.
> > > > > > > >
> > > > > > > >
> > > > > > > > On 06/26/2013 08:10 AM, hlfwm hlfwm wrote:
> > > > > > > >
> > > > > > > >  i defined a user defined function "binarycopy",when i
> > > > > > > >  use
> > > > > > > >  my
> > > > > > > >  function,
> > > > > > > > there is error:
> > > > > > > >  sql>select binarycopy('starid','1111',1);
> > > > > > > > TypeException:user.s1_1[5]:'svom.binarycopy' undefined
> > > > > > > > in:
> > > > > > > > _9:any
> > > > > > > > :=
> > > > > > > > svom.binarycopy(_6:str, _7:str, _8:int)
> > > > > > > > program contains errors
> > > > > > > >
> > > > > > > >  i want to debug the error with mal, there also some
> > > > > > > >  error:
> > > > > > > >
> > > > > > > >  [svomhpc@localhost /home/data1]$>mclient -l mal -u
> > > > > > > >  monetdb
> > > > > > > >  -d
> > > > > > > >  mydb4
> > > > > > > > password:
> > > > > > > > Welcome to mclient, the MonetDB interactive terminal
> > > > > > > > (unreleased)
> > > > > > > > Type \q to quit, \? for a list of available commands
> > > > > > > > mal>
> > > > > > > > mal>
> > > > > > > > mal>function test(i:int):str;
> > > > > > > > mal>io.print(i);
> > > > > > > > mal>i:=i*2;
> > > > > > > > mal>b:=bat.new(:int,:int);
> > > > > > > > mal>bat.insert(b,1,i);
> > > > > > > > mal>io.print(b);
> > > > > > > > mal>return test:= "ok";
> > > > > > > > mal>end test;
> > > > > > > > MAPI  = (monetdb) /tmp/.s.monetdb.50000
> > > > > > > > QUERY = end test;
> > > > > > > >  ERROR = !TypeException:user.test[3]:'bat.new'
> > > > > > > >  undefined
> > > > > > > >  in:
> > > > > > > >  b:any
> > > > > > > >  :=
> > > > > > > > bat.new(_5:int, _6:int)
> > > > > > > >         !TypeException:user.test[4]:'bat.insert'
> > > > > > > >         undefined
> > > > > > > >         in:
> > > > > > > >         _7:any :=
> > > > > > > > bat.insert(b:any, _8:int, i:int)
> > > > > > > > mal>
> > > > > > > >
> > > > > > > >  could anyone tell me how to debug my function ,please?
> > > > > > > >
> > > > > > > >  Thanks!
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > _______________________________________________
> > > > > > > > users-list mailing list
> > > > > > > > users-list@monetdb.org
> > > > > > > > http://mail.monetdb.org/mailman/listinfo/users-list
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > users-list mailing list
> > > > > > > users-list@monetdb.org
> > > > > > > http://mail.monetdb.org/mailman/listinfo/users-list
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > | Stefan.Manegold@CWI.nl | DB Architectures   (DA) |
> > > > > > | www.CWI.nl/~manegold/  | Science Park 123 (L321) |
> > > > > > | +31 (0)20 592-4212     | 1098 XG Amsterdam  (NL) |
> > > > > >
> > > > > > _______________________________________________
> > > > > > users-list mailing list
> > > > > > users-list@monetdb.org
> > > > > > http://mail.monetdb.org/mailman/listinfo/users-list
> > > > > >
> > > > >
> > > > > _______________________________________________
> > > > > users-list mailing list
> > > > > users-list@monetdb.org
> > > > > http://mail.monetdb.org/mailman/listinfo/users-list
> > > > >
> > > >
> > > > --
> > > > | Stefan.Manegold@CWI.nl | DB Architectures   (DA) |
> > > > | www.CWI.nl/~manegold/  | Science Park 123 (L321) |
> > > > | +31 (0)20 592-4212     | 1098 XG Amsterdam  (NL) |
> > > >
> > > > _______________________________________________
> > > > users-list mailing list
> > > > users-list@monetdb.org
> > > > http://mail.monetdb.org/mailman/listinfo/users-list
> > > >
> > >
> > > _______________________________________________
> > > users-list mailing list
> > > users-list@monetdb.org
> > > http://mail.monetdb.org/mailman/listinfo/users-list
> > >
> >
> > --
> > | Stefan.Manegold@CWI.nl | DB Architectures   (DA) |
> > | www.CWI.nl/~manegold/  | Science Park 123 (L321) |
> > | +31 (0)20 592-4212     | 1098 XG Amsterdam  (NL) |
> >
> > _______________________________________________
> > users-list mailing list
> > users-list@monetdb.org
> > http://mail.monetdb.org/mailman/listinfo/users-list
> >
>
> _______________________________________________
> users-list mailing list
> users-list@monetdb.org
> http://mail.monetdb.org/mailman/listinfo/users-list
>

--
| Stefan.Manegold@CWI.nl | DB Architectures   (DA) |
| www.CWI.nl/~manegold/  | Science Park 123 (L321) |
| +31 (0)20 592-4212     | 1098 XG Amsterdam  (NL) |

_______________________________________________
users-list mailing list
users-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/users-list