f2s_pg_namespace¶
Applies to: PostgreSQL Driver
Syntax¶
set_attribute f2s_pg_namespace of {DriverID} to {variable}
get_attribute f2s_pg_namespace of {DriverID} to {variable}
Parameter |
Description |
---|---|
DriverID |
The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverId. |
variable |
String variable containing the Postgre schema name. |
Description¶
Getting this attribute returns the name of the schema currently being used to open tables. Setting this attribute sets the name of the schema used to open tables.
Note
Setting this attribute to a schema that does not exist on the database will not throw an error. That will happen when you try to open the table. Setting this attribute does NOT create a schema on the server.
Setting this attribute will NOT override the SCHEMA_NAME token in the .int file. In other words, this attribute does NOT work if the SCHEMA_NAME token is defined in the .int file.
This is similiar to the attribute f2s_schema_name, however f2s_schema_name is for MSSQL and Oracle. f2s_pg_namespace is for PostGres.
Examples¶
get_attribute
string sSchema
get_attribute f2s_pg_namespace of _f2s_Active_DriverId to sSchema
set_attribute
In this example, the tables in VDF Order Entry have been converted to PostGres. The table Production.Users has been added to the database. It has the same structure as .Users (public being the default schema) but has different data.
String sName sFirstName
get_attribute f2s_pg_namespace of _f2s_Active_DriverId to sName
Send Clear to oUsers_DD
Send Find to oUsers_DD GE Index.1
Showln (SFormat("The first name in users for schema %1 is %2.",sName, Users.Full_Name))
//close the table so it can be opened using the new schema
Close Users
set_attribute f2s_pg_namespace of _f2s_Active_DriverId to "Production"
get_attribute f2s_pg_namespace of _f2s_Active_DriverId to sName
//open the table using the new schema
Open Users
Send Clear to oUsers_DD
Send Find to oUsers_DD GE Index.1
Showln (SFormat("The first name in users for schema %1 is %2.",sName, Users.Full_Name))
//close the table so it is set back to its default
Close Users
//reset the schema to the original
set_attribute f2s_pg_namespace of _f2s_Active_DriverId to "public"
Open Users
This will show:
The first name in users for schema public is John Doe.
The first name in users for schema Production is Jane Fox
In the next example, the tables are being converted from DataFlex to PostGres. Here, the namespace should be set before converting the file:
set_attribute f2s_pg_namespace of _f2s_ActiveDriverId to 'mertech'
Open customer
f2s_convert_dat_full customer.File_Number
Close Customer
In this case, the newly created customer table will be in the mertech namespace.