如題,請教各位高手,Firebird資料庫中的陣列欄位,該如何進行添加,讀取操作,謝謝。
我的配置:FireDAC + Firebird 嵌入版
uj5u.com熱心網友回復:
另外,附上資料庫定義:Create Table AryTable(
UserID SmallInt not null,
GroupName Varchar(10) ,
MemberVal Varchar(10)[0:3],
Primary Key (UserID)
);
uj5u.com熱心網友回復:
TurboBird is a Firebird Administration tool我是一名網路搬運工
專門班門弄斧
uj5u.com熱心網友回復:
感謝您的分享,但是我接觸delphi的時間不長,能否受累指點一下哪部分是設計arrayField操作的嗎?謝謝!
uj5u.com熱心網友回復:
function TdmSysTables.GetDBUsers(dbIndex: Integer; ObjectName: string = ''): string;
begin
Init(dbIndex);
sqQuery.Close;
sqQuery.SQL.Text:= 'select distinct RDB$User, RDB$User_Type from RDB$USER_PRIVILEGES ';
if ObjectName <> '' then // Specify specific Object
sqQuery.SQL.Add('where RDB$Relation_Name = ''' + UpperCase(ObjectName) + ''' ');
sqQuery.SQL.Add('order by RDB$User_Type');
sqQuery.Open;
while not sqQuery.EOF do
begin
if sqQuery.Fields[1].AsInteger = 13 then // Role
Result:= Result + '<R>';
Result:= Result + Trim(sqQuery.Fields[0].Text);
sqQuery.Next;
if not sqQuery.EOF then
Result:= Result + ',';
end;
sqQuery.Close;
end;
function TFirebirdServices.AttachService: Boolean;
var
S: String;
ServiceName, Buff: array [0..255] of Char;
W1, W2: Word;
B: Byte;
begin
if ServiceAttached then
raise EFBServiceError.Create('Service already attached!!!');
S := Trim(FHostName);
if (Length(S) > 0) and (UTF8UpperCase(S) <> 'LOCALHOST') then
S := FHostName + ':service_mgr'
else
S := 'service_mgr';
W1 := Length(S);
ServiceName := S;
B := isc_spb_version;
S := Char(B);
B := isc_spb_current_version;
S := S + Char(B);
B := isc_spb_user_name;
S := S + Char(B);
B := Length(FUserName);
S := S + Char(B) + FUserName;
B := isc_spb_password;
S := S + Char(B);
B := Length(FPassword);
S := S + Char(B) + FPassword;
W2 := Length(S);
Buff := S;
Result := isc_service_attach(@FArrIStatus, W1, @ServiceName, @FPServiceHandle, W2, @Buff) = 0;
if not Result then
RaiseServiceErr;
end;
資料:
turbobird/unitfirebirdservices.pas
turbobird/systables.pas
FireBird 系統表相關SQL
uj5u.com熱心網友回復:
不好意思,沒太看明白,我是想問如何操作如下結構中的 MemberVal 欄位,還請指點,謝謝!PS:我接觸 Delphi 時間不長,還請詳細說明,謝謝!
資料結構:
Create Table AryTable(
UserID SmallInt not null,
GroupName Varchar(10) ,
MemberVal Varchar(10)[0:3],
Primary Key (UserID)
);
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/72945.html
標籤:數據庫相關
