37#include <rtl/ustrbuf.hxx>
44#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
45#include <com/sun/star/sdbc/ColumnValue.hpp>
46#include <com/sun/star/sdbc/DataType.hpp>
47#include <com/sun/star/sdbc/SQLException.hpp>
48#include <com/sun/star/sdbc/XRow.hpp>
56using com::sun::star::uno::Any;
57using com::sun::star::uno::Exception;
59using com::sun::star::uno::UNO_QUERY;
62using com::sun::star::sdbc::SQLException;
63using com::sun::star::sdbc::XStatement;
64using com::sun::star::sdbc::XRow;
65using com::sun::star::sdbc::XResultSet;
66using com::sun::star::sdbcx::XColumnsSupplier;
67using com::sun::star::sdbcx::XTablesSupplier;
70using com::sun::star::container::XNameAccess;
103 if( atttypmod & 0xffff0000 )
118 css::uno::Reference< css::sdbc::XResultSet > origin,
121 PGresult
const *pResult,
124 m_xMutex(
std::move( refMutex )),
125 m_ppSettings( ppSettings ),
126 m_origin(
std::move( origin )),
128 m_schemaName(
std::move( schemaName )),
129 m_colDesc( PQnfields( pResult ) ),
130 m_pResultSet( pResultSet ),
131 m_checkedForTable( false ),
132 m_checkedForTypes( false ),
133 m_colCount( PQnfields( pResult ) )
140 sal_Int32
size = PQfsize( pResult,
col );
145 PQfmod( pResult,
col ),
148 char *
name = PQfname( pResult,
col );
163 OUStringBuffer buf(128);
164 buf.append(
"SELECT oid, typname, typtype FROM pg_type WHERE ");
168 buf.append(
" OR " );
170 buf.append(
"oid=" + OUString::number(
static_cast<sal_Int32
>(oid)) );
176 Oid oid = xRow->getInt( 1 );
177 OUString
typeName = xRow->getString( 2 );
178 OUString typType = xRow->getString( 3 );
210 tables = supplier->getTables();
216 const OUString composedName( schema.isEmpty() ?
name : (schema +
"." +
name) );
217 tables->getByName( composedName ) >>=
m_table;
226 MutexGuard guard(
m_xMutex->GetMutex() );
232 set->getPropertyValue(
name ) >>= ret;
235 catch( css::uno::Exception & )
246 MutexGuard guard(
m_xMutex->GetMutex() );
251 set->getPropertyValue(
name ) >>= ret;
254 catch( css::uno::Exception & )
272 if( columns.is() && columns->hasByName(
columnName ) )
312 getStatics().IS_NULLABLE, column, css::sdbc::ColumnValue::NULLABLE_UNKNOWN );
322 MutexGuard guard(
m_xMutex->GetMutex() );
334 MutexGuard guard(
m_xMutex->GetMutex() );
347 MutexGuard guard(
m_xMutex->GetMutex() );
354 MutexGuard guard(
m_xMutex->GetMutex() );
388 MutexGuard guard(
m_xMutex->GetMutex() );
402 catch( css::uno::Exception & )
430 if( columnIndex < 1 || columnIndex >
m_colCount )
433 "pq_resultsetmetadata: index out of range (expected 1 to "
434 + OUString::number(
m_colCount ) +
", got " + OUString::number( columnIndex ),
435 *
this, OUString(), 1,
Any() );
sal_Int32 guessDataType(sal_Int32 column)
RttiCompleteObjectLocator col
void set(css::uno::UnoInterfaceReference const &value)
class SAL_NO_VTABLE XPropertySet
Reference< XConnection > extractConnectionFromStatement(const Reference< XInterface > &stmt)
static void extractPrecisionAndScale(sal_Int32 atttypmod, sal_Int32 *precision, sal_Int32 *scale)
sal_Int32 typeNameToDataType(const OUString &typeName, std::u16string_view typtype)
returns the constant from sdbc.DataType
static const rtl_TextEncoding encoding