0

ファイルで可能なように、データ構造をPostgreSQLテーブルに「一度に」読み取って更新する方法があるかどうか疑問に思っています。

Public Structure myStuct
    Dim p_id As Integer
    Dim p_myInt As Integer
    Dim p_myString As String
    Dim p_myDecNumber As Double
End Structure
Dim st as myStruct

FileGet (ff, recordnum, st)

OR

st.p_id = 1234
st.myInt = 14
st.myString = "tarzan"
st.myDecNumber = 3.14

FilePut (ff, recordnum, st)

質問は、構造「st」のメンバーのような同じタイプの形成されたデータを持つテーブルがある場合、すべてのメンバーを1つずつ書き込む代わりに、テーブルのあるインデックスで構造全体を挿入/更新することはできません。今やる?

4

1 に答える 1

1

postgresql複合型を試しましたか?例えば

CREATE TYPE myStruct AS (
 p_Id        integer,
 myInt       integer,
 myString    text,
 myDecNumber double precision
);
CREATE TABLE myStructs (
 value myStruct
);
INSERT INTO myStructs VALUES ( ROW(1234, 14, 'tarzan', 3.14) );

http://www.postgresql.org/docs/9.2/static/rowtypes.html#AEN7268

于 2013-01-26T13:14:23.030 に答える