IValue.h
1/* Copyright (C) 2006-2026 by Tommi Maekitalo
2 Copyright (C) 2006-2026 by Marc Boris Duerner
3 SPDX-License-Identifier: LGPL-2.1-or-later WITH mif-exception
4*/
5
6#ifndef PT_DB_IVALUE_H
7#define PT_DB_IVALUE_H
8
9#include <Pt/RefCounted.h>
10#include <Pt/Db/Blob.h>
11#include <Pt/Db/Api.h>
12#include <string>
13
14
15namespace Pt {
16
17 class Date;
18 class Time;
19 class DateTime;
20 class Variant;
21
22namespace Db {
23
26 class PT_DB_API IValue : public RefCounted
27 {
28 public:
31 virtual bool isNull() const = 0;
32
35 virtual bool getBool() const = 0;
36
39 virtual int getInt() const = 0;
40
43 virtual unsigned getUnsigned() const = 0;
44
47 virtual float getFloat() const = 0;
48
51 virtual double getDouble() const = 0;
52
55 virtual char getChar() const = 0;
56
59 virtual std::string getString() const = 0;
60
63 virtual Date getDate() const = 0;
64
67 virtual Time getTime() const = 0;
68
71 virtual DateTime getDateTime() const = 0;
72
75 virtual void getBlob(Blob& blobdata) const = 0;
76 };
77
78} // namespace Db
79
80} // namespace Pt
81
82#endif // PT_DB_IVALUE_H
Combined Date and Time value.
Definition DateTime.h:66
Date expressed in year, month, and day.
Definition Date.h:104
Copy-on-write binary large object.
Definition Blob.h:144
Database-value backend.
Definition IValue.h:27
virtual DateTime getDateTime() const =0
Returns the value as date-time.
virtual float getFloat() const =0
Returns the value as float.
virtual int getInt() const =0
Returns the value as int.
virtual Time getTime() const =0
Returns the value as time.
virtual char getChar() const =0
Returns the value as char.
virtual double getDouble() const =0
Returns the value as double.
virtual std::string getString() const =0
Returns the value as string.
virtual bool getBool() const =0
Returns the value as bool.
virtual bool isNull() const =0
Returns true if the value is SQL NULL.
virtual void getBlob(Blob &blobdata) const =0
Writes the value as binary data into blobdata.
virtual unsigned getUnsigned() const =0
Returns the value as unsigned.
virtual Date getDate() const =0
Returns the value as date.
Time expressed in hours, minutes, seconds and milliseconds.
Definition Time.h:98
Portable SQL database access.
Core module.
Definition Allocator.h:33