8. Working with Images and Text Strings : How You Can Work with Text Strings : How You Can Store Strings in the Database : How You Can Create a String Storage Table
 
Share this page                  
How You Can Create a String Storage Table
If you need to store string objects in your database, you may be able to use a system catalog or you may need to create your own string storage table. This depends on if you are using Enterprise Access Microsoft SQL Server and whether the database is Unicode-enabled.
Note:  Notes: If your database is Enterprise Access Microsoft SQL Server and Unicode-enabled:
You must create your own string storage table (see following procedure).
The name of this table must be passed to the methods associated with writing and reading a string object stored in a database. Supply the name of the predefined table using the tablename parameter on the InsertIntoDB method of the StringObject. For more information, see the Language Reference Guide.
We strongly recommend using NFC normalization format databases (-i option in the createdb command).
Determing Whether a Database Is Unicode-enabled
You can determine whether a database is Unicode-enabled by using the following query:
SELECT   cap_value
FROM   iidbcapabilities
WHERE  cap_capability = 'NATIONAL_CHARACTER_SET'
If the value of cap_value is ‘N’, then the database is not Unicode-enabled. If the value of cap_value is ‘Y’, then the database is Unicode-enabled.
Creating Your Own String Storage Table
Note:  This procedure applies to Ingres 9.1.1 or higher. Typically, you store strings in the database that contains the other data for the application. Someone with authority to grant the user permission must own this storage table, which must have exactly the following columns and data types:
string_id
Data Type: i4 not null
Specifies the ID of the string in the table. This value is a sequential number, starting from 1, that was established when the string was inserted into the database. In the DBHandle that refers to this string, this ID appears in textual form after the table name.
row_sequence
Data Type: i4 not null
Specifies the sequence number for text in the string, beginning with 1
text_total
Data Type: i4 not null
Specifies the total number of bytes in the full text string
text_value
For Ingres and any non-Enterprise Access Microsoft SQL Server database, the data type for this column must be the following:
Data Type: varchar(1786) not null
For Enterprise Access Microsoft SQL Server databases:
If the database is not Unicode-enabled, the data type for this column must be the following:
Data Type: varchar(1786) not null
If the database is Unicode-enabled, the data type for this column must be the following:
Data Type: nvarchar(893) not null
Create this table with a B-tree structure (compressed or not) with the unique key values on string_id and row_sequence. Be sure to grant the correct permissions on the table.