On Mon, Apr 18, 2005 at 01:02:24PM +0800, Willy K' wrote:
> As I've seen in the tutorial, my understanding to the use of
> sql_create_# should be sql_create_N(name_of_struct, A, N,
> data_type_1, variable_1, ... , data_type_N, variable_N), where
> N is the no of variable and A is a number that I still don't
> quite understand. The same should be the same with
> sql_create_simple_N. (Please correct if I am wrong)
> My questions are:
> 1: I don't get the meaning of what A do. In another words,
> what action did it does and how could I make use of it
From examples/custom4.cpp (I know, it's well hidden) :-)
1, // This number is used to make a SSQLS less-than-comparable.
// If this number is n then if the first n elements are the
// same the two SSQLS are the same.
// In this case if two two stock's "item" are the same then
// the two stock are the same.
5, // This number should generally be the same as the number of
// elements in the list unless you have a good reason not to.
I think this is most useful when you put a unique ID as the first
column, but I don't have a lot of experience with this yet.
> 2: I want to create a SSQLS with four string variables, to
> access another table. So i simply use custom1.cpp and modify
> sql_create_5(stock, 1, 5, ...) to sql_create_4(stock, 1,4,
> ...), which it pumps up a lot of error messages.
Not sure what messages you got, but you'll need to add/remove actual
fields as well.
> 3: This is about sql_create_simple_#. For the use of retriving
> data, I used sql_create_simple_4(stock, 0, 0,...) instead and
> it worked (based on custom1.cpp). However, when I turn to
> inserting data with sql_create_simple_4, error messages again.
> It says there's not a "set" method in struct stock, which I
> saw that there is such a method in the API. What's wrong with it?
sql_create_simple_# doesn't exist in my tree. Are you using an old version?
> 4: In custom2.cpp, is print_stock_table used only for the
> struct stock? where is it located???
It's in util.cpp.