Hello,
On 13/11/2011 18:15, Björn Lundin wrote:
> Firstly i hope that this mail list is not c++ only, or else could i
> Get a pointer to an ada mail list.
There is no separate mailing list for the Ada part. I believe it is OK
to discuss the Ada binding and idioms here.
> I read the samples on the soci-site, and that leaves me with a couple of
> questions.
>
> I did not see any samples like 'select * from table'
This form of SQL (in general: an unknown number of columns in a rowset)
is not supported in Ada. There is *some* support for dynamically bound
data in C++ that allows to discover the structure of the rowset after it
was received, but to be frank I would rather avoid such use case anyway.
> All samples had 1 column only selected. How does a code snippet look like
> When there are several columns involved?
Just create many variables of type SOCI.Into_Position and call
St.Into_SOME_TYPE many times, once for each value item.
For example (that is modified example from docs):
with SOCI;
with Ada.Text_IO;
procedure My_Program is
SQL : SOCI.Session := SOCI.Make_Session
("postgresql://dbname=my_database");
St : SOCI.Statement := SOCI.Make_Statement (SQL);
Pos_Count : SOCI.Into_Position;
Pos_Max_Age : SOCI.Into_Position;
Num_Of_Persons : SOCI.DB_Integer;
Max_Age : SOCI.DB_Integer;
begin
Pos_Count := St.Into_Integer;
Pos_Max_Age := St.Into_Integer;
St.Prepare ("select count(*), max(age) from persons");
St.Execute (True);
Num_Of_Persons := St.Get_Into_Integer (Pos_Count);
Max_Age := St.Get_Into_Integer (Pos_Max_Age);
Ada.Text_IO.Put_Line ("Number of persons: " & SOCI.DB_Integer'Image
(Num_Of_Persons));
Ada.Text_IO.Put_Line ("The oldest is: " & SOCI.DB_Integer'Image
(Max_Age));
end My_Program;
> Is it possible to retrieve values, both by column index and by column name?
No.
> Is there clob support in soci- ada?
No, only simple data types are supported in the current version.
> We run on aix 5 and 6, windows 2k8 and recent linux on debian/ ubuntu
> Are all of these platforms supported? I saw some trouble for aix, in this
> list,
> But i am not clear on it being resolved.
Certainly, Aix is not on our priority list, but the library was tested
on several variants of Linux. The C++ part was tested on the widest
range of platforms, especially on Windows.
Regards,
--
Maciej Sobczak * www.msobczak.com * www.inspirel.com
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users