4D(4th Dimension、または初期開発時にはSilver Surferとして知られていた)は、Laurent Ribardièreによって開発されたリレーショナルデータベース管理システムおよび統合開発環境である。[ 3 ] 4Dは1984年に作成され[ 4 ] 、独自のプログラミング言語とともに、 1987年にMacintosh向けに少し遅れて一般公開された[ 5 ] [ 6 ] [ 7 ]。[ 1 ]
4D製品ラインはその後、 SQLバックエンド、統合コンパイラ、 PHPとの統合、そして数々の生産性向上プラグインとインターフェースへと拡張されました。4Dが開発したプラグインには、4D Write(ワードプロセッサ)、4D View(表計算ソフトに似ているが、追加機能付き)、4D Internet Commands(データベースにインターネット関連機能を追加できる)などがあります。また、無料版と有料版を含め、100種類以上のサードパーティ製プラグインも存在します。
4Dは、コンパイル済みのデータベースアプリケーションを実行するためのWebサーバーとしても使用できます。
現在、4Dはフランスの4D SAS社によって販売・流通・サポート体制が整えられており、米国、英国、フランスを主要市場として、ほとんどの主要市場で事業を展開しています。製品は10以上の言語に対応しています。
Silver Surfer, as it was known during early development, was developed by Laurent Ribardière in 1984. Following negotiations with Ribardiere it was planned that Apple Inc. (formerly Apple Computer Inc) would publish the software but Apple canceled the plan, reportedly due to pressure from other potential database publishers who claimed that if Apple had their own "brand" database, third-party products would be disadvantaged in the marketplace.[8] Apple tried at the time to ensure well-known software publishers supported the Macintosh platform, and as a result the project reverted to Laurent Ribardière, who with the French businesswoman Marylene Delbourg-Delphis published 4th Dimension. Although independently published, Apple supported the new venture and used 4D extensively throughout the organization for projects including fitness center management and CIM (Computer Integrated Manufacturing). A number of Apple personnel became 4D experts, including Lance McAndrew in Apple's Cupertino headquarters and Andrew O'Donoghue in Apple's Ireland-based European manufacturing headquarters, where a 4th Dimension application managed the European Service Center administration.
Over the next few years 4th Dimension's installed base grew, and the publisher ACI established a US-based subsidiary called ACIUS, initially led by Guy Kawasaki. After 16 years of operating as ACIUS up to 2000, the name was officially changed to 4D Inc.[9]
In 1993, 4D Server v1.1, the client/server version of 4th Dimension was introduced along with the release of 4th Dimension v3.1.[10]
In 1995, 4D v3.5 went cross-platform and has since then supported both the Microsoft Windows and Apple Macintosh operating systems.[11]
In 1997, 4D v6 was the first version of 4D to contain a fully integrated web server, allowing developers to translate 4D forms into HTML on the fly using only the 4D language.[12]
In 2004, 4D 2004 was the first version of 4D to allow developers to create standalone, client/server, web and Service Oriented Applications (SOA) without changing any code.[13]
In 2008, 4D v11 added a SQL layer to the 4D database engine and extending native SQL in to the 4D programming language which allowed 4D developers to write native SQL code to connect to either local or remote servers.[14][15]
2010年に、4D v12では4Dプログラミング言語内からPHP関数/スクリプトを実行する機能が統合されました。このバージョンでは、新しいレプリケーションおよび同期コマンドもサポートされ、4D Serverの64ビット版も含まれていました。[ 16 ]
4Dアプリケーションは、スタンドアロンモードまたはクライアント/サーバーモードのいずれでも実行できます。
スタンドアロンモードでは、4Dアプリケーション(Windowsでは4D.exe、Macでは4D.app)を使用して、構造ファイル(4DB/4DC)と関連データファイル(4DD)を直接開きます。
クライアント/サーバー方式では、4Dサーバーアプリケーション(Windowsでは4DServer.exe、Macでは4DServer.app)を使用して、構造ファイル(4DB/4DC)と関連データファイル(4DD)を直接開きます。その後、4Dをリモートモードで使用して4Dサーバーに接続できます。
4Dには、4Dと4D Serverという2つのアプリケーションがあります。4D Serverはサーバーとしてのみ動作しますが、4Dはスタンドアロンモードまたはリモートモードのどちらでも実行できます。
4Dは2つのモードで実行できます。シングルユーザーモードでは、1人のユーザーがアプリケーションを実行できます。リモートモードでは、4Dサーバーに接続して使用します。
4Dサーバーは、アプリケーションへのクライアント/サーバー接続に使用されます。このモードでは、4Dサーバーは構造ファイル(4DBまたは4DC)とデータファイル(4DD)をロードし、4D(リモート)へのネットワークアクセスを提供します。各ワークステーションは、作業中のリソースの動的に更新されるキャッシュを保持し、4Dサーバーはデータとコードを維持します。
このセクションでは、4Dで使用されるさまざまなプログラミング構造(forループや変数の使用方法など)を示す構文例を紹介します。
4D フィールド、変数、および式は、次のデータ型になります。[ 18 ]
4Dデータ型に関する詳細は、[4Dデータ型]ドキュメントページをご覧ください。
ローカル変数には「」$のような接頭辞が付き$myLocalVariable、メソッドの実行期間中のみ有効です。
プロセス変数には、のような接頭辞は付かずmyProcessVariable、プロセスの実行期間中ずっと有効です。
プロセス間変数(またはグローバル変数)は、<>のような接頭辞が付き<>myGlobalVariable、アプリケーションの実行期間中有効です。
(vCounter;1;100) // 何かを実行する 終了
$i :=1 // カウンターを初期化する while($i<=100) // 100回ループする // 何かを実行する $i :=$i +1 // カウンターをインクリメントする必要がある 終了
$i :=1 // カウンターを初期化する 繰り返す // 何かを実行する $i :=$i +1 // カウンターをインクリメントする必要がある Until($i=100) // 100回ループする
次の例では、2次元配列のすべての要素を順に処理します。
For($vlElem;1;配列のサイズ(anArray)) // ... // 行に対して何らかの処理を行う // ... For($vlSubElem;1;配列のサイズ(anArray{$vlElem})) // 要素に対して何らかの処理を行う anArray{$vlElem}{$vlSubElem}:=... 終了 終了 次の例では、データベースに存在するすべての日付フィールドへのポインタの配列を作成します。
配列ポインタ($apDateFields;0) $vlElem:=0 For($vlTable;1;最後のテーブル番号を取得) // 各テーブル番号を$vTableとしてループする テーブル番号が有効かどうか($vlTable) // テーブル番号 $vTable が有効かどうかを確認します // 有効なテーブルのみをループする For($vlField;1;最後のフィールド番号を取得($vlTable)) // 現在のテーブル内の各フィールド番号をループ処理します // $vlField を現在のフィールド番号として使用 もし(フィールド番号が有効か($vlTable;$vlField)) // フィールド番号が有効かどうかを確認します $vpField:=Field($vlTable;$vlField) // フィールドへのポインタを取得 もし(Type($vpField->)=Is date) // 現在のフィールドが日付かどうかを確認します // フィールドが日付の場合にのみこれらのアクションを実行します $vlElem:=$vlElem+1 INSERT IN ARRAY($apDateFields;$vlElem) $apDateFields{$vlElem}:=$vpField 終了条件 End If 終了 End If 終了