Warning, /sdk/codevis/thirdparty/soci/languages/ada/soci.adb is written in an unsupported language. File is not indexed.
0001 -- Copyright (C) 2008-2011 Maciej Sobczak 0002 -- Distributed under the Boost Software License, Version 1.0. 0003 -- (See accompanying file LICENSE_1_0.txt or copy at 0004 -- http://www.boost.org/LICENSE_1_0.txt) 0005 0006 with Ada.Strings.Fixed; 0007 with Interfaces.C.Strings; 0008 0009 package body SOCI is 0010 0011 procedure Check_Session_State (Handle : in Session_Handle) is 0012 0013 function Soci_Session_State (S : in Session_Handle) return Interfaces.C.int; 0014 0015 pragma Import (C, Soci_Session_State, "soci_session_state"); 0016 0017 function Soci_Session_Error_Message 0018 (S : in Session_Handle) 0019 return Interfaces.C.Strings.chars_ptr; 0020 pragma Import (C, Soci_Session_Error_Message, "soci_session_error_message"); 0021 0022 State : constant Interfaces.C.int := Soci_Session_State (Handle); 0023 Bad_State : constant Interfaces.C.int := 0; 0024 0025 use type Interfaces.C.int; 0026 0027 begin 0028 if State = Bad_State then 0029 declare 0030 Message : constant String := 0031 Interfaces.C.Strings.Value (Soci_Session_Error_Message (Handle)); 0032 begin 0033 raise Database_Error with Message; 0034 end; 0035 end if; 0036 end Check_Session_State; 0037 0038 function Make_Session_Handle (Connection_String : in String) return Session_Handle is 0039 0040 function Soci_Create_Session (C : in Interfaces.C.char_array) return Session_Handle; 0041 pragma Import (C, Soci_Create_Session, "soci_create_session"); 0042 0043 Connection_String_C : constant Interfaces.C.char_array := 0044 Interfaces.C.To_C (Connection_String); 0045 0046 Handle : constant Session_Handle := 0047 Soci_Create_Session (Connection_String_C); 0048 0049 begin 0050 if Handle = Null_Session_Handle then 0051 raise Database_Error with "Cannot create session object."; 0052 else 0053 return Handle; 0054 end if; 0055 end Make_Session_Handle; 0056 0057 function Data_State_To_Int (State : in Data_State) return Interfaces.C.int is 0058 begin 0059 if State = Data_Not_Null then 0060 return 1; 0061 else 0062 return 0; 0063 end if; 0064 end Data_State_To_Int; 0065 0066 function Int_To_Data_State (State : in Interfaces.C.int) return Data_State is 0067 use type Interfaces.C.int; 0068 begin 0069 if State /= 0 then 0070 return Data_Not_Null; 0071 else 0072 return Data_Null; 0073 end if; 0074 end Int_To_Data_State; 0075 0076 procedure Check_Is_Open (This : in Session'Class) is 0077 begin 0078 if not This.Initialized then 0079 raise Database_Error with "Session is not initialized."; 0080 end if; 0081 end Check_Is_Open; 0082 0083 procedure Check_Statement_State (Handle : in Statement_Handle) is 0084 0085 function Soci_Statement_State (S : in Statement_Handle) return Interfaces.C.int; 0086 pragma Import (C, Soci_Statement_State, "soci_statement_state"); 0087 0088 function Soci_Statement_Error_Message 0089 (S : in Statement_Handle) 0090 return Interfaces.C.Strings.chars_ptr; 0091 pragma Import (C, Soci_Statement_Error_Message, "soci_statement_error_message"); 0092 0093 State : constant Interfaces.C.int := Soci_Statement_State (Handle); 0094 Bad_State : constant Interfaces.C.int := 0; 0095 0096 use type Interfaces.C.int; 0097 0098 begin 0099 if State = Bad_State then 0100 declare 0101 Message : constant String := 0102 Interfaces.C.Strings.Value (Soci_Statement_Error_Message (Handle)); 0103 begin 0104 raise Database_Error with Message; 0105 end; 0106 end if; 0107 end Check_Statement_State; 0108 0109 function String_To_Time (Source : in String) return Ada.Calendar.Time is 0110 0111 Year_N : Natural; 0112 Month_N : Natural; 0113 Day_N : Natural; 0114 Hour_N : Natural; 0115 Minute_N : Natural; 0116 Second_N : Natural; 0117 0118 procedure Get_Next_Number 0119 (Source : in String; 0120 Position : in out Natural; 0121 Result : out Natural) is 0122 0123 I : Natural; 0124 begin 0125 I := Ada.Strings.Fixed.Index (Source => Source, 0126 Pattern => " ", 0127 From => Position); 0128 0129 if I /= 0 then 0130 Result := Natural'Value (Source (Position .. I)); 0131 Position := I + 1; 0132 else 0133 Result := Natural'Value (Source (Position .. Source'Last)); 0134 Position := 0; 0135 end if; 0136 end Get_Next_Number; 0137 0138 Pos : Natural := 1; 0139 0140 begin 0141 0142 Get_Next_Number (Source => Source, Position => Pos, Result => Year_N); 0143 Get_Next_Number (Source => Source, Position => Pos, Result => Month_N); 0144 Get_Next_Number (Source => Source, Position => Pos, Result => Day_N); 0145 Get_Next_Number (Source => Source, Position => Pos, Result => Hour_N); 0146 Get_Next_Number (Source => Source, Position => Pos, Result => Minute_N); 0147 Get_Next_Number (Source => Source, Position => Pos, Result => Second_N); 0148 0149 return Ada.Calendar.Time_Of (Year_N, Month_N, Day_N, 0150 Duration (Hour_N * 3_600 + Minute_N * 60 + Second_N)); 0151 0152 end String_To_Time; 0153 0154 function Time_To_String (Date : in Ada.Calendar.Time) return String is 0155 0156 Year : Ada.Calendar.Year_Number; 0157 Month : Ada.Calendar.Month_Number; 0158 Day : Ada.Calendar.Day_Number; 0159 Seconds : Ada.Calendar.Day_Duration; 0160 0161 Hour : Natural; 0162 Minute : Natural; 0163 Seconds_N : Natural; 0164 0165 begin 0166 Ada.Calendar.Split (Date, Year, Month, Day, Seconds); 0167 Seconds_N := Natural (Seconds); 0168 0169 Hour := Seconds_N / 3_600; 0170 Minute := (Seconds_N - Natural (Hour) * 3_600) / 60; 0171 Seconds_N := Seconds_N - Natural (Hour) * 3_600 - Natural (Minute) * 60; 0172 return Ada.Calendar.Year_Number'Image (Year) & " " & 0173 Ada.Calendar.Month_Number'Image (Month) & " " & 0174 Ada.Calendar.Day_Number'Image (Day) & " " & 0175 Natural'Image (Hour) & " " & 0176 Natural'Image (Minute) & " " & 0177 Natural'Image (Seconds_N); 0178 end Time_To_String; 0179 0180 0181 function Make_Session (Connection_String : in String) return Session is 0182 begin 0183 return S : Session do 0184 S.Handle := Make_Session_Handle (Connection_String); 0185 S.Initialized := True; 0186 Check_Session_State (S.Handle); 0187 end return; 0188 end Make_Session; 0189 0190 procedure Open (This : in out Session; Connection_String : in String) is 0191 begin 0192 if This.Initialized then 0193 raise Database_Error with "Session is already initialized."; 0194 else 0195 declare 0196 Handle : constant Session_Handle := 0197 Make_Session_Handle (Connection_String); 0198 begin 0199 Check_Session_State (Handle); 0200 0201 This.Handle := Handle; 0202 This.Initialized := True; 0203 end; 0204 end if; 0205 end Open; 0206 0207 procedure Close (This : in out Session) is 0208 0209 procedure Soci_Destroy_Session (S : in Session_Handle); 0210 pragma Import (C, Soci_Destroy_Session, "soci_destroy_session"); 0211 0212 begin 0213 if This.Initialized then 0214 if This.Belongs_To_Pool then 0215 raise Database_Error with "Cannot close session - not an owner (session in pool)."; 0216 else 0217 Soci_Destroy_Session (This.Handle); 0218 This.Initialized := False; 0219 end if; 0220 end if; 0221 end Close; 0222 0223 function Is_Open (This : in Session) return Boolean is 0224 begin 0225 return This.Initialized; 0226 end Is_Open; 0227 0228 procedure Finalize (This : in out Session) is 0229 begin 0230 if This.Initialized then 0231 if This.Belongs_To_Pool then 0232 This.Pool.all.Give_Back (This.Position_In_Pool); 0233 This.Initialized := False; 0234 else 0235 This.Close; 0236 end if; 0237 end if; 0238 end Finalize; 0239 0240 procedure Start (This : in Session) is 0241 0242 procedure Soci_Begin (S : in Session_Handle); 0243 pragma Import (C, Soci_Begin, "soci_begin"); 0244 0245 begin 0246 Check_Is_Open (This); 0247 Soci_Begin (This.Handle); 0248 Check_Session_State (This.Handle); 0249 end Start; 0250 0251 procedure Commit (This : in Session) is 0252 0253 procedure Soci_Commit (S : in Session_Handle); 0254 pragma Import (C, Soci_Commit, "soci_commit"); 0255 0256 begin 0257 Check_Is_Open (This); 0258 Soci_Commit (This.Handle); 0259 Check_Session_State (This.Handle); 0260 end Commit; 0261 0262 procedure Rollback (This : in Session) is 0263 0264 procedure Soci_Rollback (S : in Session_Handle); 0265 pragma Import (C, Soci_Rollback, "soci_rollback"); 0266 0267 begin 0268 Check_Is_Open (This); 0269 Soci_Rollback (This.Handle); 0270 Check_Session_State (This.Handle); 0271 end Rollback; 0272 0273 procedure Execute (This : in Session; Query : in String) is 0274 S : Statement := Make_Statement (This); 0275 begin 0276 S.Prepare (Query); 0277 S.Execute; 0278 end Execute; 0279 0280 protected body Connection_Pool_PS is 0281 0282 procedure Open (Position : in Positive; Connection_String : in String) is 0283 begin 0284 if Position > Size then 0285 raise Database_Error with "Index out of range."; 0286 end if; 0287 0288 Connections (Position).Open (Connection_String); 0289 end Open; 0290 0291 procedure Close (Position : in Positive) is 0292 begin 0293 if Position > Size then 0294 raise Database_Error with "Index out of range."; 0295 end if; 0296 0297 if Is_Used (Position) then 0298 raise Database_Error with "Cannot close connection that is currently in use."; 0299 end if; 0300 0301 Connections (Position).Close; 0302 end Close; 0303 0304 entry Lease (S : in out Session'Class) when Available is 0305 Found : Boolean := False; 0306 begin 0307 if S.Initialized then 0308 raise Database_Error with "This session is already initialized."; 0309 end if; 0310 0311 -- Find some connection in the pool that is not currently used. 0312 for I in 1 .. Size loop 0313 if not Is_Used (I) then 0314 Check_Is_Open (Connections (I)); 0315 0316 S.Handle := Connections (I).Handle; 0317 S.Initialized := True; 0318 S.Belongs_To_Pool := True; 0319 S.Position_In_Pool := I; 0320 0321 -- WORKAROUND: 0322 -- The S.Pool component is set in the Lease procedure 0323 -- of the Connection_Pool type, because here the access 0324 -- to the protected object could not be taken (compiler bug). 0325 0326 Is_Used (I) := True; 0327 Found := True; 0328 exit; 0329 end if; 0330 end loop; 0331 0332 if not Found then 0333 raise Database_Error with "Internal error."; 0334 end if; 0335 0336 -- Update the Available flag. 0337 Found := False; 0338 for I in 1 .. Size loop 0339 if not Is_Used (I) then 0340 Found := True; 0341 exit; 0342 end if; 0343 end loop; 0344 Available := Found; 0345 0346 end Lease; 0347 0348 procedure Give_Back (Position : in Positive) is 0349 begin 0350 if Position > Size then 0351 raise Database_Error with "Index out of range."; 0352 end if; 0353 0354 if not Is_Used (Position) then 0355 raise Database_Error with "Cannot give back connection that is not in use."; 0356 end if; 0357 0358 Is_Used (Position) := False; 0359 Available := True; 0360 end Give_Back; 0361 0362 end Connection_Pool_PS; 0363 0364 procedure Open 0365 (This : in out Connection_Pool; 0366 Position : in Positive; 0367 Connection_String : in String) is 0368 begin 0369 This.Pool.Open (Position, Connection_String); 0370 end Open; 0371 0372 procedure Close (This : in out Connection_Pool; Position : in Positive) is 0373 begin 0374 This.Pool.Close (Position); 0375 end Close; 0376 0377 procedure Lease (This : in out Connection_Pool; S : in out Session'Class) is 0378 begin 0379 This.Pool.Lease (S); 0380 0381 -- WORKAROUND: 0382 -- The S.Pool component is set here because the access 0383 -- to protected object cannot be taken in protected body (compiler bug.) 0384 0385 -- JUSTIFICATION: 0386 -- The Unchecked_Access is taken here to enable the session to properly 0387 -- "unregister" from the pool in Session's Finalize. 0388 -- An alternative would be to rely on the user to explicitly unlock 0389 -- the appropriate entry in the pool, which is too error prone. 0390 -- It is assumed that connection pool always has wider lifetime 0391 -- than that of the session which is temporarily leased from the pool 0392 -- - this guarantees that S.Pool always points to a valid pool object. 0393 0394 S.Pool := This.Pool'Unchecked_Access; 0395 end Lease; 0396 0397 function Make_Statement (Sess : in Session'Class) return Statement is 0398 0399 function Soci_Create_Statement (Sess : in Session_Handle) return Statement_Handle; 0400 pragma Import (C, Soci_Create_Statement, "soci_create_statement"); 0401 0402 begin 0403 Check_Is_Open (Sess); 0404 0405 declare 0406 Handle : constant Statement_Handle := 0407 Soci_Create_Statement (Sess.Handle); 0408 begin 0409 0410 return S : Statement do 0411 S.Handle := Handle; 0412 S.Initialized := True; 0413 Check_Statement_State (S.Handle); 0414 end return; 0415 end; 0416 end Make_Statement; 0417 0418 procedure Finalize (This : in out Statement) is 0419 0420 procedure Soci_Destroy_Statement (S : in Statement_Handle); 0421 pragma Import (C, Soci_Destroy_Statement, "soci_destroy_statement"); 0422 0423 begin 0424 if This.Initialized then 0425 Soci_Destroy_Statement (This.Handle); 0426 This.Initialized := False; 0427 end if; 0428 end Finalize; 0429 0430 procedure Prepare (This : in Statement; Query : in String) is 0431 0432 procedure Soci_Prepare (St : in Statement_Handle; Q : in Interfaces.C.char_array); 0433 pragma Import (C, Soci_Prepare, "soci_prepare"); 0434 0435 Query_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Query); 0436 0437 begin 0438 Soci_Prepare (This.Handle, Query_C); 0439 Check_Statement_State (This.Handle); 0440 end Prepare; 0441 0442 procedure Execute (This : in Statement; With_Data_Exchange : in Boolean := False) is 0443 Result : constant Boolean := This.Execute (With_Data_Exchange); 0444 begin 0445 null; 0446 end Execute; 0447 0448 function Execute 0449 (This : in Statement; 0450 With_Data_Exchange : in Boolean := False) 0451 return Boolean is 0452 0453 function Soci_Execute 0454 (St : in Statement_Handle; 0455 WDE : in Interfaces.C.int) 0456 return Interfaces.C.int; 0457 pragma Import (C, Soci_Execute, "soci_execute"); 0458 0459 WDE_C : Interfaces.C.int; 0460 Result : Interfaces.C.int; 0461 0462 use type Interfaces.C.int; 0463 0464 begin 0465 if With_Data_Exchange then 0466 WDE_C := 1; 0467 else 0468 WDE_C := 0; 0469 end if; 0470 0471 Result := Soci_Execute (This.Handle, WDE_C); 0472 Check_Statement_State (This.Handle); 0473 0474 return Result /= 0; 0475 end Execute; 0476 0477 function Fetch (This : in Statement) return Boolean is 0478 0479 function Soci_Fetch (St : in Statement_Handle) return Interfaces.C.int; 0480 pragma Import (C, Soci_Fetch, "soci_fetch"); 0481 0482 Result : constant Interfaces.C.int := Soci_Fetch (This.Handle); 0483 0484 use type Interfaces.C.int; 0485 0486 begin 0487 Check_Statement_State (This.Handle); 0488 return Result /= 0; 0489 end Fetch; 0490 0491 function Got_Data (This : in Statement) return Boolean is 0492 0493 function Soci_Got_Data (St : in Statement_Handle) return Interfaces.C.int; 0494 pragma Import (C, Soci_Got_Data, "soci_got_data"); 0495 0496 Result : constant Interfaces.C.int := Soci_Got_Data (This.Handle); 0497 0498 use type Interfaces.C.int; 0499 0500 begin 0501 Check_Statement_State (This.Handle); 0502 return Result /= 0; 0503 end Got_Data; 0504 0505 function Into_String (This : in Statement) return Into_Position is 0506 0507 function Soci_Into_String (St : in Statement_Handle) return Interfaces.C.int; 0508 pragma Import (C, Soci_Into_String, "soci_into_string"); 0509 0510 Result : constant Interfaces.C.int := Soci_Into_String (This.Handle); 0511 0512 begin 0513 Check_Statement_State (This.Handle); 0514 return Into_Position (Result); 0515 end Into_String; 0516 0517 function Into_Integer (This : in Statement) return Into_Position is 0518 0519 function Soci_Into_Int (St : in Statement_Handle) return Interfaces.C.int; 0520 pragma Import (C, Soci_Into_Int, "soci_into_int"); 0521 0522 Result : constant Interfaces.C.int := Soci_Into_Int (This.Handle); 0523 0524 begin 0525 Check_Statement_State (This.Handle); 0526 return Into_Position (Result); 0527 end Into_Integer; 0528 0529 function Into_Long_Long_Integer (This : in Statement) return Into_Position is 0530 0531 function Soci_Into_Long_Long (St : in Statement_Handle) return Interfaces.C.int; 0532 pragma Import (C, Soci_Into_Long_Long, "soci_into_long_long"); 0533 0534 Result : constant Interfaces.C.int := Soci_Into_Long_Long (This.Handle); 0535 0536 begin 0537 Check_Statement_State (This.Handle); 0538 return Into_Position (Result); 0539 end Into_Long_Long_Integer; 0540 0541 function Into_Long_Float (This : in Statement) return Into_Position is 0542 0543 function Soci_Into_Double (St : in Statement_Handle) return Interfaces.C.int; 0544 pragma Import (C, Soci_Into_Double, "soci_into_double"); 0545 0546 Result : constant Interfaces.C.int := Soci_Into_Double (This.Handle); 0547 0548 begin 0549 Check_Statement_State (This.Handle); 0550 return Into_Position (Result); 0551 end Into_Long_Float; 0552 0553 function Into_Time (This : in Statement) return Into_Position is 0554 0555 function Soci_Into_Date (St : in Statement_Handle) return Interfaces.C.int; 0556 pragma Import (C, Soci_Into_Date, "soci_into_date"); 0557 0558 Result : constant Interfaces.C.int := Soci_Into_Date (This.Handle); 0559 0560 begin 0561 Check_Statement_State (This.Handle); 0562 return Into_Position (Result); 0563 end Into_Time; 0564 0565 function Into_Vector_String (This : in Statement) return Into_Position is 0566 0567 function Soci_Into_String_V (St : in Statement_Handle) return Interfaces.C.int; 0568 pragma Import (C, Soci_Into_String_V, "soci_into_string_v"); 0569 0570 Result : constant Interfaces.C.int := Soci_Into_String_V (This.Handle); 0571 0572 begin 0573 Check_Statement_State (This.Handle); 0574 return Into_Position (Result); 0575 end Into_Vector_String; 0576 0577 function Into_Vector_Integer (This : in Statement) return Into_Position is 0578 0579 function Soci_Into_Int_V (St : in Statement_Handle) return Interfaces.C.int; 0580 pragma Import (C, Soci_Into_Int_V, "soci_into_int_v"); 0581 0582 Result : constant Interfaces.C.int := Soci_Into_Int_V (This.Handle); 0583 0584 begin 0585 Check_Statement_State (This.Handle); 0586 return Into_Position (Result); 0587 end Into_Vector_Integer; 0588 0589 function Into_Vector_Long_Long_Integer (This : in Statement) return Into_Position is 0590 0591 function Soci_Into_Long_Long_V (St : in Statement_Handle) return Interfaces.C.int; 0592 pragma Import (C, Soci_Into_Long_Long_V, "soci_into_long_long_v"); 0593 0594 Result : constant Interfaces.C.int := Soci_Into_Long_Long_V (This.Handle); 0595 0596 begin 0597 Check_Statement_State (This.Handle); 0598 return Into_Position (Result); 0599 end Into_Vector_Long_Long_Integer; 0600 0601 function Into_Vector_Long_Float (This : in Statement) return Into_Position is 0602 0603 function Soci_Into_Double_V (St : in Statement_Handle) return Interfaces.C.int; 0604 pragma Import (C, Soci_Into_Double_V, "soci_into_double_v"); 0605 0606 Result : constant Interfaces.C.int := Soci_Into_Double_V (This.Handle); 0607 0608 begin 0609 Check_Statement_State (This.Handle); 0610 return Into_Position (Result); 0611 end Into_Vector_Long_Float; 0612 0613 function Into_Vector_Time (This : in Statement) return Into_Position is 0614 0615 function Soci_Into_Date_V (St : in Statement_Handle) return Interfaces.C.int; 0616 pragma Import (C, Soci_Into_Date_V, "soci_into_date_v"); 0617 0618 Result : constant Interfaces.C.int := Soci_Into_Date_V (This.Handle); 0619 0620 begin 0621 Check_Statement_State (This.Handle); 0622 return Into_Position (Result); 0623 end Into_Vector_Time; 0624 0625 function Get_Into_State 0626 (This : in Statement; 0627 Position : in Into_Position) 0628 return Data_State is 0629 0630 function Soci_Get_Into_State 0631 (St : in Statement_Handle; 0632 P : in Interfaces.C.int) 0633 return Interfaces.C.int; 0634 pragma Import (C, Soci_Get_Into_State, "soci_get_into_state"); 0635 0636 Result : constant Interfaces.C.int := 0637 Soci_Get_Into_State (This.Handle, Interfaces.C.int (Position)); 0638 0639 use type Interfaces.C.int; 0640 0641 begin 0642 Check_Statement_State (This.Handle); 0643 return Int_To_Data_State (Result); 0644 end Get_Into_State; 0645 0646 function Get_Into_String 0647 (This : in Statement; 0648 Position : in Into_Position) 0649 return String is 0650 0651 function Soci_Get_Into_String 0652 (St : in Statement_Handle; 0653 P : in Interfaces.C.int) 0654 return Interfaces.C.Strings.chars_ptr; 0655 pragma Import (C, Soci_Get_Into_String, "soci_get_into_string"); 0656 0657 Result : constant Interfaces.C.Strings.chars_ptr := 0658 Soci_Get_Into_String (This.Handle, Interfaces.C.int (Position)); 0659 0660 begin 0661 Check_Statement_State (This.Handle); 0662 return Interfaces.C.Strings.Value (Result); 0663 end Get_Into_String; 0664 0665 function Get_Into_Integer 0666 (This : in Statement; 0667 Position : in Into_Position) 0668 return DB_Integer is 0669 0670 function Soci_Get_Into_Int 0671 (St : in Statement_Handle; 0672 P : in Interfaces.C.int) 0673 return Interfaces.C.int; 0674 pragma Import (C, Soci_Get_Into_Int, "soci_get_into_int"); 0675 0676 Result : constant Interfaces.C.int := 0677 Soci_Get_Into_Int (This.Handle, Interfaces.C.int (Position)); 0678 0679 begin 0680 Check_Statement_State (This.Handle); 0681 return DB_Integer (Result); 0682 end Get_Into_Integer; 0683 0684 function Get_Into_Long_Long_Integer 0685 (This : in Statement; 0686 Position : in Into_Position) 0687 return DB_Long_Long_Integer is 0688 0689 function Soci_Get_Into_Long_Long 0690 (St : in Statement_Handle; 0691 P : in Interfaces.C.int) 0692 return Interfaces.Integer_64; 0693 pragma Import (C, Soci_Get_Into_Long_Long, "soci_get_into_long_long"); 0694 0695 Result : constant Interfaces.Integer_64 := 0696 Soci_Get_Into_Long_Long (This.Handle, Interfaces.C.int (Position)); 0697 0698 begin 0699 Check_Statement_State (This.Handle); 0700 return DB_Long_Long_Integer (Result); 0701 end Get_Into_Long_Long_Integer; 0702 0703 function Get_Into_Long_Float 0704 (This : in Statement; 0705 Position : in Into_Position) 0706 return DB_Long_Float is 0707 0708 function Soci_Get_Into_Double 0709 (St : in Statement_Handle; 0710 P : in Interfaces.C.int) 0711 return Interfaces.C.double; 0712 pragma Import (C, Soci_Get_Into_Double, "soci_get_into_double"); 0713 0714 Result : constant Interfaces.C.double := 0715 Soci_Get_Into_Double (This.Handle, Interfaces.C.int (Position)); 0716 0717 begin 0718 Check_Statement_State (This.Handle); 0719 return DB_Long_Float (Result); 0720 end Get_Into_Long_Float; 0721 0722 function Get_Into_Time 0723 (This : in Statement; 0724 Position : in Into_Position) 0725 return Ada.Calendar.Time is 0726 0727 function Soci_Get_Into_Date 0728 (St : in Statement_Handle; 0729 P : in Interfaces.C.int) 0730 return Interfaces.C.Strings.chars_ptr; 0731 pragma Import (C, Soci_Get_Into_Date, "soci_get_into_date"); 0732 0733 Result_C : constant Interfaces.C.Strings.chars_ptr := 0734 Soci_Get_Into_Date (This.Handle, Interfaces.C.int (Position)); 0735 Result : constant String := Interfaces.C.Strings.Value (Result_C); 0736 0737 begin 0738 Check_Statement_State (This.Handle); 0739 return String_To_Time (Result); 0740 end Get_Into_Time; 0741 0742 function Get_Into_Vectors_Size (This : in Statement) return Natural is 0743 0744 function Soci_Into_Get_Size_V 0745 (St : in Statement_Handle) 0746 return Interfaces.C.int; 0747 pragma Import (C, Soci_Into_Get_Size_V, "soci_into_get_size_v"); 0748 0749 Result_C : constant Interfaces.C.int := Soci_Into_Get_Size_V (This.Handle); 0750 0751 begin 0752 Check_Statement_State (This.Handle); 0753 return Natural (Result_C); 0754 end Get_Into_Vectors_Size; 0755 0756 function Into_Vectors_First_Index (This : in Statement) return Vector_Index is 0757 begin 0758 return 0; 0759 end Into_Vectors_First_Index; 0760 0761 function Into_Vectors_Last_Index (This : in Statement) return Vector_Index is 0762 begin 0763 return Vector_Index (This.Get_Into_Vectors_Size - 1); 0764 end Into_Vectors_Last_Index; 0765 0766 procedure Into_Vectors_Resize (This : in Statement; New_Size : in Natural) is 0767 0768 procedure Soci_Into_Resize_V 0769 (St : in Statement_Handle; 0770 New_Size : in Interfaces.C.int); 0771 pragma Import (C, Soci_Into_Resize_V, "soci_into_resize_v"); 0772 0773 begin 0774 Soci_Into_Resize_V (This.Handle, Interfaces.C.int (New_Size)); 0775 Check_Statement_State (This.Handle); 0776 end Into_Vectors_Resize; 0777 0778 function Get_Into_Vector_State 0779 (This : in Statement; 0780 Position : in Into_Position; 0781 Index : in Vector_Index) 0782 return Data_State is 0783 0784 function Soci_Get_Into_State_V 0785 (St : in Statement_Handle; 0786 P : in Interfaces.C.int; 0787 I : in Interfaces.C.int) 0788 return Interfaces.C.int; 0789 pragma Import (C, Soci_Get_Into_State_V, "soci_get_into_state_v"); 0790 0791 Result : constant Interfaces.C.int := 0792 Soci_Get_Into_State_V 0793 (This.Handle, 0794 Interfaces.C.int (Position), 0795 Interfaces.C.int (Index)); 0796 0797 use type Interfaces.C.int; 0798 0799 begin 0800 Check_Statement_State (This.Handle); 0801 return Int_To_Data_State (Result); 0802 end Get_Into_Vector_State; 0803 0804 function Get_Into_Vector_String 0805 (This : in Statement; 0806 Position : in Into_Position; 0807 Index : in Vector_Index) return String is 0808 0809 function Soci_Get_Into_String_V 0810 (St : in Statement_Handle; 0811 P : in Interfaces.C.int; 0812 I : in Interfaces.C.int) 0813 return Interfaces.C.Strings.chars_ptr; 0814 pragma Import (C, Soci_Get_Into_String_V, "soci_get_into_string_v"); 0815 0816 Result : constant Interfaces.C.Strings.chars_ptr := 0817 Soci_Get_Into_String_V (This.Handle, 0818 Interfaces.C.int (Position), 0819 Interfaces.C.int (Index)); 0820 0821 begin 0822 Check_Statement_State (This.Handle); 0823 return Interfaces.C.Strings.Value (Result); 0824 end Get_Into_Vector_String; 0825 0826 function Get_Into_Vector_Integer 0827 (This : in Statement; 0828 Position : in Into_Position; 0829 Index : in Vector_Index) 0830 return DB_Integer is 0831 0832 function Soci_Get_Into_Int_V 0833 (St : in Statement_Handle; 0834 P : in Interfaces.C.int; 0835 I : in Interfaces.C.int) 0836 return Interfaces.C.int; 0837 pragma Import (C, Soci_Get_Into_Int_V, "soci_get_into_int_v"); 0838 0839 Result : constant Interfaces.C.int := 0840 Soci_Get_Into_Int_V (This.Handle, 0841 Interfaces.C.int (Position), 0842 Interfaces.C.int (Index)); 0843 0844 begin 0845 Check_Statement_State (This.Handle); 0846 return DB_Integer (Result); 0847 end Get_Into_Vector_Integer; 0848 0849 function Get_Into_Vector_Long_Long_Integer 0850 (This : in Statement; 0851 Position : in Into_Position; 0852 Index : in Vector_Index) 0853 return DB_Long_Long_Integer is 0854 0855 function Soci_Get_Into_Long_Long_V 0856 (St : in Statement_Handle; 0857 P : in Interfaces.C.int; 0858 I : in Interfaces.C.int) 0859 return Interfaces.Integer_64; 0860 pragma Import (C, Soci_Get_Into_Long_Long_V, "soci_get_into_long_long_v"); 0861 0862 Result : constant Interfaces.Integer_64 := 0863 Soci_Get_Into_Long_Long_V (This.Handle, 0864 Interfaces.C.int (Position), 0865 Interfaces.C.int (Index)); 0866 0867 begin 0868 Check_Statement_State (This.Handle); 0869 return DB_Long_Long_Integer (Result); 0870 end Get_Into_Vector_Long_Long_Integer; 0871 0872 function Get_Into_Vector_Long_Float 0873 (This : in Statement; 0874 Position : in Into_Position; 0875 Index : in Vector_Index) 0876 return DB_Long_Float is 0877 0878 function Soci_Get_Into_Double_V 0879 (St : in Statement_Handle; 0880 P : in Interfaces.C.int; 0881 I : in Interfaces.C.int) 0882 return Interfaces.C.double; 0883 pragma Import (C, Soci_Get_Into_Double_V, "soci_get_into_double_v"); 0884 0885 Result : constant Interfaces.C.double := 0886 Soci_Get_Into_Double_V (This.Handle, 0887 Interfaces.C.int (Position), 0888 Interfaces.C.int (Index)); 0889 0890 begin 0891 Check_Statement_State (This.Handle); 0892 return DB_Long_Float (Result); 0893 end Get_Into_Vector_Long_Float; 0894 0895 function Get_Into_Vector_Time 0896 (This : in Statement; 0897 Position : in Into_Position; 0898 Index : in Vector_Index) 0899 return Ada.Calendar.Time is 0900 0901 function Soci_Get_Into_Date_V 0902 (St : in Statement_Handle; 0903 P : in Interfaces.C.int; 0904 I : in Interfaces.C.int) 0905 return Interfaces.C.Strings.chars_ptr; 0906 pragma Import (C, Soci_Get_Into_Date_V, "soci_get_into_date_v"); 0907 0908 Result_C : constant Interfaces.C.Strings.chars_ptr := 0909 Soci_Get_Into_Date_V (This.Handle, 0910 Interfaces.C.int (Position), 0911 Interfaces.C.int (Index)); 0912 Result : constant String := Interfaces.C.Strings.Value (Result_C); 0913 0914 begin 0915 Check_Statement_State (This.Handle); 0916 return String_To_Time (Result); 0917 end Get_Into_Vector_Time; 0918 0919 procedure Use_String (This : in Statement; Name : in String) is 0920 0921 procedure Soci_Use_String 0922 (St : in Statement_Handle; 0923 Name : in Interfaces.C.char_array); 0924 pragma Import (C, Soci_Use_String, "soci_use_string"); 0925 0926 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 0927 0928 begin 0929 Soci_Use_String (This.Handle, Name_C); 0930 Check_Statement_State (This.Handle); 0931 end Use_String; 0932 0933 procedure Use_Integer (This : in Statement; Name : in String) is 0934 0935 procedure Soci_Use_Int 0936 (St : in Statement_Handle; 0937 Name : in Interfaces.C.char_array); 0938 pragma Import (C, Soci_Use_Int, "soci_use_int"); 0939 0940 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 0941 0942 begin 0943 Soci_Use_Int (This.Handle, Name_C); 0944 Check_Statement_State (This.Handle); 0945 end Use_Integer; 0946 0947 procedure Use_Long_Long_Integer (This : in Statement; Name : in String) is 0948 0949 procedure Soci_Use_Long_Long 0950 (St : in Statement_Handle; 0951 Name : in Interfaces.C.char_array); 0952 pragma Import (C, Soci_Use_Long_Long, "soci_use_long_long"); 0953 0954 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 0955 0956 begin 0957 Soci_Use_Long_Long (This.Handle, Name_C); 0958 Check_Statement_State (This.Handle); 0959 end Use_Long_Long_Integer; 0960 0961 procedure Use_Long_Float (This : in Statement; Name : in String) is 0962 0963 procedure Soci_Use_Double 0964 (St : in Statement_Handle; 0965 Name : in Interfaces.C.char_array); 0966 pragma Import (C, Soci_Use_Double, "soci_use_double"); 0967 0968 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 0969 0970 begin 0971 Soci_Use_Double (This.Handle, Name_C); 0972 Check_Statement_State (This.Handle); 0973 end Use_Long_Float; 0974 0975 procedure Use_Time (This : in Statement; Name : in String) is 0976 0977 procedure Soci_Use_Date 0978 (St : in Statement_Handle; 0979 Name : in Interfaces.C.char_array); 0980 pragma Import (C, Soci_Use_Date, "soci_use_date"); 0981 0982 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 0983 0984 begin 0985 Soci_Use_Date (This.Handle, Name_C); 0986 Check_Statement_State (This.Handle); 0987 end Use_Time; 0988 0989 procedure Use_Vector_String (This : in Statement; Name : in String) is 0990 0991 procedure Soci_Use_String_V 0992 (St : in Statement_Handle; 0993 Name : in Interfaces.C.char_array); 0994 pragma Import (C, Soci_Use_String_V, "soci_use_string_v"); 0995 0996 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 0997 0998 begin 0999 Soci_Use_String_V (This.Handle, Name_C); 1000 Check_Statement_State (This.Handle); 1001 end Use_Vector_String; 1002 1003 procedure Use_Vector_Integer (This : in Statement; Name : in String) is 1004 1005 procedure Soci_Use_Int_V 1006 (St : in Statement_Handle; 1007 Name : in Interfaces.C.char_array); 1008 pragma Import (C, Soci_Use_Int_V, "soci_use_int_v"); 1009 1010 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1011 1012 begin 1013 Soci_Use_Int_V (This.Handle, Name_C); 1014 Check_Statement_State (This.Handle); 1015 end Use_Vector_Integer; 1016 1017 procedure Use_Vector_Long_Long_Integer (This : in Statement; Name : in String) is 1018 1019 procedure Soci_Use_Long_Long_V 1020 (St : in Statement_Handle; 1021 Name : in Interfaces.C.char_array); 1022 pragma Import (C, Soci_Use_Long_Long_V, "soci_use_long_long_v"); 1023 1024 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1025 1026 begin 1027 Soci_Use_Long_Long_V (This.Handle, Name_C); 1028 Check_Statement_State (This.Handle); 1029 end Use_Vector_Long_Long_Integer; 1030 1031 procedure Use_Vector_Long_Float (This : in Statement; Name : in String) is 1032 1033 procedure Soci_Use_Double_V 1034 (St : in Statement_Handle; 1035 Name : in Interfaces.C.char_array); 1036 pragma Import (C, Soci_Use_Double_V, "soci_use_double_v"); 1037 1038 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1039 1040 begin 1041 Soci_Use_Double_V (This.Handle, Name_C); 1042 Check_Statement_State (This.Handle); 1043 end Use_Vector_Long_Float; 1044 1045 procedure Use_Vector_Time (This : in Statement; Name : in String) is 1046 1047 procedure Soci_Use_Date_V 1048 (St : in Statement_Handle; 1049 Name : in Interfaces.C.char_array); 1050 pragma Import (C, Soci_Use_Date_V, "soci_use_date_v"); 1051 1052 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1053 1054 begin 1055 Soci_Use_Date_V (This.Handle, Name_C); 1056 Check_Statement_State (This.Handle); 1057 end Use_Vector_Time; 1058 1059 procedure Set_Use_State 1060 (This : in Statement; 1061 Name : in String; 1062 State : in Data_State) is 1063 1064 procedure Soci_Set_Use_State 1065 (St : in Statement_Handle; 1066 Name : in Interfaces.C.char_array; 1067 State : in Interfaces.C.int); 1068 pragma Import (C, Soci_Set_Use_State, "soci_set_use_state"); 1069 1070 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1071 State_C : constant Interfaces.C.int := Data_State_To_Int (State); 1072 1073 begin 1074 Soci_Set_Use_State (This.Handle, Name_C, State_C); 1075 Check_Statement_State (This.Handle); 1076 end Set_Use_State; 1077 1078 procedure Set_Use_String 1079 (This : in Statement; 1080 Name : in String; 1081 Value : in String) is 1082 1083 procedure Soci_Set_Use_String 1084 (St : in Statement_Handle; 1085 Name : in Interfaces.C.char_array; 1086 Value : in Interfaces.C.char_array); 1087 pragma Import (C, Soci_Set_Use_String, "soci_set_use_string"); 1088 1089 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1090 Value_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Value); 1091 1092 begin 1093 Soci_Set_Use_String (This.Handle, Name_C, Value_C); 1094 Check_Statement_State (This.Handle); 1095 end Set_Use_String; 1096 1097 procedure Set_Use_Integer 1098 (This : in Statement; 1099 Name : in String; 1100 Value : in DB_Integer) is 1101 1102 procedure Soci_Set_Use_Int 1103 (St : in Statement_Handle; 1104 Name : in Interfaces.C.char_array; 1105 Value : in Interfaces.C.int); 1106 pragma Import (C, Soci_Set_Use_Int, "soci_set_use_int"); 1107 1108 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1109 Value_C : constant Interfaces.C.int := Interfaces.C.int (Value); 1110 1111 begin 1112 Soci_Set_Use_Int (This.Handle, Name_C, Value_C); 1113 Check_Statement_State (This.Handle); 1114 end Set_Use_Integer; 1115 1116 procedure Set_Use_Long_Long_Integer 1117 (This : in Statement; 1118 Name : in String; 1119 Value : in DB_Long_Long_Integer) is 1120 1121 procedure Soci_Set_Use_Long_Long 1122 (St : in Statement_Handle; 1123 Name : in Interfaces.C.char_array; 1124 Value : in Interfaces.Integer_64); 1125 pragma Import (C, Soci_Set_Use_Long_Long, "soci_set_use_long_long"); 1126 1127 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1128 Value_C : constant Interfaces.Integer_64 := Interfaces.Integer_64 (Value); 1129 1130 begin 1131 Soci_Set_Use_Long_Long (This.Handle, Name_C, Value_C); 1132 Check_Statement_State (This.Handle); 1133 end Set_Use_Long_Long_Integer; 1134 1135 procedure Set_Use_Long_Float 1136 (This : in Statement; 1137 Name : in String; 1138 Value : in DB_Long_Float) is 1139 1140 procedure Soci_Set_Use_Double 1141 (St : in Statement_Handle; 1142 Name : in Interfaces.C.char_array; 1143 Value : in Interfaces.C.double); 1144 pragma Import (C, Soci_Set_Use_Double, "soci_set_use_double"); 1145 1146 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1147 Value_C : constant Interfaces.C.double := Interfaces.C.double (Value); 1148 1149 begin 1150 Soci_Set_Use_Double (This.Handle, Name_C, Value_C); 1151 Check_Statement_State (This.Handle); 1152 end Set_Use_Long_Float; 1153 1154 procedure Set_Use_Time 1155 (This : in Statement; 1156 Name : in String; 1157 Value : in Ada.Calendar.Time) is 1158 1159 procedure Soci_Set_Use_Date 1160 (St : in Statement_Handle; 1161 Name : in Interfaces.C.char_array; 1162 Value : in Interfaces.C.char_array); 1163 pragma Import (C, Soci_Set_Use_Date, "soci_set_use_date"); 1164 1165 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1166 Value_C : constant Interfaces.C.char_array := 1167 Interfaces.C.To_C (Time_To_String (Value)); 1168 1169 begin 1170 Soci_Set_Use_Date (This.Handle, Name_C, Value_C); 1171 Check_Statement_State (This.Handle); 1172 end Set_Use_Time; 1173 1174 function Get_Use_Vectors_Size (This : in Statement) return Natural is 1175 1176 function Soci_Use_Get_Size_V 1177 (St : in Statement_Handle) 1178 return Interfaces.C.int; 1179 pragma Import (C, Soci_Use_Get_Size_V, "soci_use_get_size_v"); 1180 1181 Result_C : constant Interfaces.C.int := Soci_Use_Get_Size_V (This.Handle); 1182 1183 begin 1184 Check_Statement_State (This.Handle); 1185 return Natural (Result_C); 1186 end Get_Use_Vectors_Size; 1187 1188 function Use_Vectors_First_Index (This : in Statement) return Vector_Index is 1189 begin 1190 return 0; 1191 end Use_Vectors_First_Index; 1192 1193 function Use_Vectors_Last_Index (This : in Statement) return Vector_Index is 1194 begin 1195 return Vector_Index (This.Get_Use_Vectors_Size - 1); 1196 end Use_Vectors_Last_Index; 1197 1198 procedure Use_Vectors_Resize (This : in Statement; New_Size : in Natural) is 1199 1200 procedure Soci_Use_Resize_V 1201 (St : in Statement_Handle; 1202 New_Size : in Interfaces.C.int); 1203 pragma Import (C, Soci_Use_Resize_V, "soci_use_resize_v"); 1204 1205 begin 1206 Soci_Use_Resize_V (This.Handle, Interfaces.C.int (New_Size)); 1207 Check_Statement_State (This.Handle); 1208 end Use_Vectors_Resize; 1209 1210 procedure Set_Use_Vector_State 1211 (This : in Statement; 1212 Name : in String; 1213 Index : in Vector_Index; 1214 State : in Data_State) is 1215 1216 procedure Soci_Set_Use_State_V 1217 (St : in Statement_Handle; 1218 Name : in Interfaces.C.char_array; 1219 Index : in Interfaces.C.int; 1220 State : in Interfaces.C.int); 1221 pragma Import (C, Soci_Set_Use_State_V, "soci_set_use_state_v"); 1222 1223 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1224 Index_C : constant Interfaces.C.int := Interfaces.C.int (Index); 1225 State_C : constant Interfaces.C.int := Data_State_To_Int (State); 1226 1227 begin 1228 Soci_Set_Use_State_V (This.Handle, Name_C, Index_C, State_C); 1229 Check_Statement_State (This.Handle); 1230 end Set_Use_Vector_State; 1231 1232 procedure Set_Use_Vector_String 1233 (This : in Statement; 1234 Name : in String; 1235 Index : in Vector_Index; 1236 Value : in String) is 1237 1238 procedure Soci_Set_Use_String_V 1239 (St : in Statement_Handle; 1240 Name : in Interfaces.C.char_array; 1241 Index : in Interfaces.C.int; 1242 Value : in Interfaces.C.char_array); 1243 pragma Import (C, Soci_Set_Use_String_V, "soci_set_use_string_v"); 1244 1245 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1246 Index_C : constant Interfaces.C.int := Interfaces.C.int (Index); 1247 Value_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Value); 1248 1249 begin 1250 Soci_Set_Use_String_V (This.Handle, Name_C, Index_C, Value_C); 1251 Check_Statement_State (This.Handle); 1252 end Set_Use_Vector_String; 1253 1254 procedure Set_Use_Vector_Integer 1255 (This : in Statement; 1256 Name : in String; 1257 Index : in Vector_Index; 1258 Value : in DB_Integer) is 1259 1260 procedure Soci_Set_Use_Int_V 1261 (St : in Statement_Handle; 1262 Name : in Interfaces.C.char_array; 1263 Index : in Interfaces.C.int; 1264 Value : in Interfaces.C.int); 1265 pragma Import (C, Soci_Set_Use_Int_V, "soci_set_use_int_v"); 1266 1267 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1268 Index_C : constant Interfaces.C.int := Interfaces.C.int (Index); 1269 Value_C : constant Interfaces.C.int := Interfaces.C.int (Value); 1270 1271 begin 1272 Soci_Set_Use_Int_V (This.Handle, Name_C, Index_C, Value_C); 1273 Check_Statement_State (This.Handle); 1274 end Set_Use_Vector_Integer; 1275 1276 procedure Set_Use_Vector_Long_Long_Integer 1277 (This : in Statement; 1278 Name : in String; 1279 Index : in Vector_Index; 1280 Value : in DB_Long_Long_Integer) is 1281 1282 procedure Soci_Set_Use_Long_Long_V 1283 (St : in Statement_Handle; 1284 Name : in Interfaces.C.char_array; 1285 Index : in Interfaces.C.int; 1286 Value : in Interfaces.Integer_64); 1287 pragma Import (C, Soci_Set_Use_Long_Long_V, "soci_set_use_long_long_v"); 1288 1289 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1290 Index_C : constant Interfaces.C.int := Interfaces.C.int (Index); 1291 Value_C : constant Interfaces.Integer_64 := Interfaces.Integer_64 (Value); 1292 1293 begin 1294 Soci_Set_Use_Long_Long_V (This.Handle, Name_C, Index_C, Value_C); 1295 Check_Statement_State (This.Handle); 1296 end Set_Use_Vector_Long_Long_Integer; 1297 1298 procedure Set_Use_Vector_Long_Float 1299 (This : in Statement; 1300 Name : in String; 1301 Index : in Vector_Index; 1302 Value : in DB_Long_Float) is 1303 1304 procedure Soci_Set_Use_Double_V 1305 (St : in Statement_Handle; 1306 Name : in Interfaces.C.char_array; 1307 Index : in Interfaces.C.int; 1308 Value : in Interfaces.C.double); 1309 pragma Import (C, Soci_Set_Use_Double_V, "soci_set_use_double_v"); 1310 1311 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1312 Index_C : constant Interfaces.C.int := Interfaces.C.int (Index); 1313 Value_C : constant Interfaces.C.double := Interfaces.C.double (Value); 1314 1315 begin 1316 Soci_Set_Use_Double_V (This.Handle, Name_C, Index_C, Value_C); 1317 Check_Statement_State (This.Handle); 1318 end Set_Use_Vector_Long_Float; 1319 1320 procedure Set_Use_Vector_Time 1321 (This : in Statement; 1322 Name : in String; 1323 Index : in Vector_Index; 1324 Value : in Ada.Calendar.Time) is 1325 1326 procedure Soci_Set_Use_Date_V 1327 (St : in Statement_Handle; 1328 Name : in Interfaces.C.char_array; 1329 Index : in Interfaces.C.int; 1330 Value : in Interfaces.C.char_array); 1331 pragma Import (C, Soci_Set_Use_Date_V, "soci_set_use_date_v"); 1332 1333 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1334 Index_C : constant Interfaces.C.int := Interfaces.C.int (Index); 1335 Value_C : constant Interfaces.C.char_array := 1336 Interfaces.C.To_C (Time_To_String (Value)); 1337 1338 begin 1339 Soci_Set_Use_Date_V (This.Handle, Name_C, Index_C, Value_C); 1340 Check_Statement_State (This.Handle); 1341 end Set_Use_Vector_Time; 1342 1343 function Get_Use_State 1344 (This : in Statement; 1345 Name : in String) return Data_State is 1346 1347 function Soci_Get_Use_State 1348 (St : in Statement_Handle; 1349 Name : in Interfaces.C.char_array) 1350 return Interfaces.C.int; 1351 pragma Import (C, Soci_Get_Use_State, "soci_get_use_state"); 1352 1353 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1354 Result : constant Interfaces.C.int := 1355 Soci_Get_Use_State (This.Handle, Name_C); 1356 1357 use type Interfaces.C.int; 1358 1359 begin 1360 Check_Statement_State (This.Handle); 1361 return Int_To_Data_State (Result); 1362 end Get_Use_State; 1363 1364 function Get_Use_String 1365 (This : in Statement; 1366 Name : in String) 1367 return String is 1368 1369 function Soci_Get_Use_String 1370 (St : in Statement_Handle; 1371 Name : in Interfaces.C.char_array) 1372 return Interfaces.C.Strings.chars_ptr; 1373 pragma Import (C, Soci_Get_Use_String, "soci_get_use_string"); 1374 1375 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1376 Result : constant Interfaces.C.Strings.chars_ptr := 1377 Soci_Get_Use_String (This.Handle, Name_C); 1378 1379 begin 1380 Check_Statement_State (This.Handle); 1381 return Interfaces.C.Strings.Value (Result); 1382 end Get_Use_String; 1383 1384 function Get_Use_Integer 1385 (This : in Statement; 1386 Name : in String) 1387 return DB_Integer is 1388 1389 function Soci_Get_Use_Int 1390 (St : in Statement_Handle; 1391 Name : in Interfaces.C.char_array) 1392 return Interfaces.C.int; 1393 pragma Import (C, Soci_Get_Use_Int, "soci_get_use_int"); 1394 1395 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1396 Result : constant Interfaces.C.int := 1397 Soci_Get_Use_Int (This.Handle, Name_C); 1398 1399 begin 1400 Check_Statement_State (This.Handle); 1401 return DB_Integer (Result); 1402 end Get_Use_Integer; 1403 1404 function Get_Use_Long_Long_Integer 1405 (This : in Statement; 1406 Name : in String) 1407 return DB_Long_Long_Integer is 1408 1409 function Soci_Get_Use_Long_Long 1410 (St : in Statement_Handle; 1411 Name : in Interfaces.C.char_array) 1412 return Interfaces.Integer_64; 1413 pragma Import (C, Soci_Get_Use_Long_Long, "soci_get_use_long_long"); 1414 1415 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1416 Result : constant Interfaces.Integer_64 := 1417 Soci_Get_Use_Long_Long (This.Handle, Name_C); 1418 1419 begin 1420 Check_Statement_State (This.Handle); 1421 return DB_Long_Long_Integer (Result); 1422 end Get_Use_Long_Long_Integer; 1423 1424 function Get_Use_Long_Float 1425 (This : in Statement; 1426 Name : in String) 1427 return DB_Long_Float is 1428 1429 function Soci_Get_Use_Double 1430 (St : in Statement_Handle; 1431 Name : in Interfaces.C.char_array) 1432 return Interfaces.C.double; 1433 pragma Import (C, Soci_Get_Use_Double, "soci_get_use_double"); 1434 1435 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1436 Result : constant Interfaces.C.double := 1437 Soci_Get_Use_Double (This.Handle, Name_C); 1438 1439 begin 1440 Check_Statement_State (This.Handle); 1441 return DB_Long_Float (Result); 1442 end Get_Use_Long_Float; 1443 1444 function Get_Use_Time 1445 (This : in Statement; 1446 Name : in String) 1447 return Ada.Calendar.Time is 1448 1449 function Soci_Get_Use_Date 1450 (St : in Statement_Handle; 1451 Name : in Interfaces.C.char_array) 1452 return Interfaces.C.Strings.chars_ptr; 1453 pragma Import (C, Soci_Get_Use_Date, "soci_get_use_date"); 1454 1455 Name_C : constant Interfaces.C.char_array := Interfaces.C.To_C (Name); 1456 Result_C : constant Interfaces.C.Strings.chars_ptr := 1457 Soci_Get_Use_Date (This.Handle, Name_C); 1458 Result : constant String := Interfaces.C.Strings.Value (Result_C); 1459 1460 begin 1461 Check_Statement_State (This.Handle); 1462 return String_To_Time (Result); 1463 end Get_Use_Time; 1464 1465 end SOCI;