Scheme query, difference between XML and SQL backend, coredump

Phil Longstaff plongstaff at rogers.com
Sat May 30 13:01:26 EDT 2009


Hi Erwin,

how do you install and use these?

Phil

On May 30, 2009 11:30:02 am Erwin Rieger wrote:
> Hi,
>
> i've noticed a different behavior of gnucash-backends when running
> querys from scheme. If a query is setup without accounts the xml backend
> selects data from all accounts, the sql backend coredumps with the same
> query (see backtrace below). If the query is setup with accounts, the
> query works with both the xml and sql backend.
>
> Scheme code to reproduce the error, this config.user adds two entries to
> the Extensions menu. AQueryTest1 runs a query with accounts
> (xaccQueryAddAccountMatch), AqueryTest2 runs a query without accounts
> (this is the one that crashes the sql backend):
>
>
>
>
> ################################################## config.user
> ################################################## (printf "Start
> config.user\n")
>
> (gnc-add-scm-extension
>     (
>         gnc:make-menu-item
>         (N_ "AQueryTest1")
>         (N_ "AQueryTest1")
>         (list (N_ "Extensions"))
>         (lambda (window)
>             (let (
>                     (book (gnc-get-current-book))
>                     (query (qof-query-create-for-splits))
>                     (accounts (gnc-account-get-descendants-sorted
> (gnc-get-current-root-account))) )
>
>                 (printf "querytest 1 ...\n")
>                 (qof-query-set-book query book)
>
>                 (printf "querytest 2 ...\n")
>                 (xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY
> QOF-QUERY-AND)
>
>                 (printf "querytest 3 ...\n")
>                 (printf "got %d transactions...\n" (length
> (xaccQueryGetTransactions query QUERY-TXN-MATCH-ANY)))
>
>                 (printf "querytest 4 ...\n")
>                 (qof-query-destroy query)
>
>                 (printf "querytest 5 ...\n")
>             )
>         )
>     )
> )
>
> (gnc-add-scm-extension
>     (
>         gnc:make-menu-item
>         (N_ "BQueryTest2")
>         (N_ "BQueryTest2")
>         (list (N_ "Extensions"))
>         (lambda (window)
>             (let (
>                     (book (gnc-get-current-book))
>                     (query (qof-query-create-for-splits))
>                     (accounts (gnc-account-get-descendants-sorted
> (gnc-get-current-root-account))) )
>
>                 (printf "querytest 1 ...\n")
>                 (qof-query-set-book query book)
>
>                 ; (printf "querytest 2 ...\n")
>                 ; (xaccQueryAddAccountMatch query accounts
> QOF-GUID-MATCH-ANY QOF-QUERY-AND)
>
>                 (printf "querytest 2 ...\n")
>                 (printf "got %d transactions...\n" (length
> (xaccQueryGetTransactions query QUERY-TXN-MATCH-ANY)))
>
>                 (printf "querytest 3 ...\n")
>                 (qof-query-destroy query)
>
>                 (printf "querytest 4 ...\n")
>             )
>         )
>     )
> )
>
> (printf "End config.user\n")
> ################################################## config.user
> ##################################################
>
>
> GDB backtrace from the query without accounts on a sql backend. Note:
> andTerm is NULL, so accessing andTerm->data is not a good idea ;-)
>
> ################################################## gdb backtrace
> ################################################## ....
> Loaded symbols for /usr/lib/libgvfscommon.so.0
> Reading symbols from
> /home/bh/gnucash_mysql_install/lib/gnucash/libgncqof-backend-qsf.so...done.
> Loaded symbols for
> /home/bh/gnucash_mysql_install/lib/gnucash/libgncqof-backend-qsf.so
> 0xffffe424 in __kernel_vsyscall ()
> (gdb) c
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb680b700 (LWP 24145)]
> 0xb49914d3 in get_guid_from_query (pQuery=0x83a7140) at
> gnc-transaction-sql.c:642 642     pTerm = (QofQueryTerm*)andTerm->data;
> (gdb) bt
> #0  0xb49914d3 in get_guid_from_query (pQuery=0x83a7140) at
> gnc-transaction-sql.c:642 #1  0xb49917b5 in compile_split_query
> (be=0x837df90, pQuery=0x83a7140) at gnc-transaction-sql.c:725 #2 
> 0xb4982891 in compile_query_cb (type=0xb4994c19 "Split", data_p=0xb4997980,
> be_data_p=0xbf7fde4c) at gnc-backend-sql.c:678 #3  0xb7ecd81d in
> foreach_backend (key=0xb4994c19, be_item=0xb4997980, arg=0xbf7fde08) at
> qofobject.c:339 #4  0xb69ba931 in g_hash_table_foreach () from
> /usr/lib/libglib-2.0.so.0 #5  0xb3e1a6de in ?? () from
> /home/bh/gnucash_mysql_install/lib/gnucash/libgncmod-business-backend-sql.s
>o #6  0x00000000 in ?? ()
> (gdb) p andTerm
> $1 = (GList *) 0x0
> (gdb)
> ################################################## gdb backtrace
> ##################################################



More information about the gnucash-devel mailing list