> Hi João,
>
> I finally got around to play with your cgreen test suite. I've created
> a MySQL database libdbitest to get around the above mentioned
> problem. The tests basically run ok, so the cgreen framework and your
> test code work properly, with a few minor problems remaining:
>

Good news.

> (1) Failure!: LIBDBI fixture -> Database Infrastructure -> 
> test_dbi_conn_get_table_list -> [test_datatypes] should match [ERROR] at 
> [test_dbi_sql_database_infrastructure.c] line [9]
>
> This function attempts to read the table name from the result set
> using '3' as an index which has to fail. The index should be '1'
> instead. Using this value, MySQL passes the test. If your tests
> required '3' to succeed, most likely one of the database drivers does
> not implement dbi_conn_get_table_list() as intended: according to the
> docs the function (in fact, the corresponding driver function) should
> return the table names in column 1.

I will test it.

>
> (2) Failure!: LIBDBI fixture -> Retriving fields data by name ->
> test_dbi_result_get_string_copy -> [ERROR] should match [Can 'we'
> "quote" this properly?] at [test_dbi_retrieving_fields_data_name.c]
> line [316]
>
> Upon analyzing this error I've noticed that your code does not use the
> dbi_conn_quote_string() family of functions here. Instead you attempt
> to manually quote the input strings of the INSERT query. Wouldn't it
> be easier to use the quoted strings when assembling your INSERT query?

Yes. But this is a test and we need to tests all libdbi API. If I did
use dbi_conn_quote_string() I can't have sure about the correct value
get by an dbi_result_get* call.

In other words. We have two types of test: 1st: Every test function
need to test one libdbi function. 2nd: We can create a test case and
use more functions together.

Currently I wrote tests to "all" libdbi API function.

This is the reason because I encode all the fields of table
test_datatypes by hand.

> In any case, the code for assembling the MySQL INSERT query is
> obviously broken.

About test_dbi_cgreen.c line 688:

Is this 'Can \\'we\\' \"quote\" this properly?' right?

For every database engine I need to quote by hand. This can be prone
to error but one time written right we can be sure about the right
result.

>
> (3) Failure!: LIBDBI fixture -> Test select cases -> test_retrieve_zero_rows 
> -> Value: '0x0' Error 1146: 'root' at [test_dbi_misc.c] line [8]
> Failure!: LIBDBI fixture -> Test select cases -> test_retrieve_zero_rows -> 
> [-1] should not match [-1] at [test_dbi_misc.c] line [12]
> Failure!: LIBDBI fixture -> Test select cases -> test_retrieve_zero_rows -> 
> [-1] should match [0] at [test_dbi_misc.c] line [13]
> Running "libdbi tests"...
>
> I tend to believe that this is a libdbi bug. I've tried test_dbi.c
> which returns 26 rows instead of zero with at least the mysql and
> sqlite3 drivers. I've never noticed this problem before. This actually
> shows how valuable the cgreen framework is going to be for us! In any
> case, I'll investigate if the library indeed has a problem here.
>
> I'll check the other drivers as soon as time permits.

Many tanks.

These tests code can be enhanced. Libdbi is a generic library. Inside
of the tests we need to work with the particularities of every
database engine.


-- 
-----------------------------------------------------------
João Henrique Freitas - joaohf_at_gmail.com
Campinas-SP-Brasil
BSD051283
LPI 1
http://www.joaohfreitas.eti.br

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to