Function Reference

_SQLite_Display2DResult

フォーマットされた2次元配列をコンソールに表示、または返します。

#include <SQLite.au3>
_SQLite_Display2DResult ( $aResult [, $iCellWidth = 0 [, $bReturn = 0 ]] )

 

パラメータ

$aResult 表示される配列
$iCellWidth [オプション]データフィールドのサイズを指定します
$bReturn [オプション]Trueの場合、フォーマットされた文字列が返され、表示はされません。 Falseの場合、フォーマットされた文字列がStdOutに送信されます。

 

返し値

成功: なし、またはフォーマットされた文字列
失敗: @error = 1 - $aResultは配列ではないか、次元が誤っています

 

注意

なし。

 

関連

_SQLite_GetTable2d

 


#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $aResult, $iRows, $iColumns, $iRval

_SQLite_Startup ()
If @error Then
    MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
    Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; :メモリ: データベースを開く
If @error Then
    MsgBox(16, "SQLite Error", "Can't Load Database!")
    Exit - 1
EndIf

;サンプルテーブル
;   Name        | Age
;   -----------------------
;   Alice       | 43
;   Bob         | 28
;   Cindy       | 21

If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())

; クエリ
$iRval = _SQLite_GetTable2d (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then
    _SQLite_Display2DResult($aResult)

;~    $aResultは次のようになる:
;~
;~   Name   Age
;~   Alice  43
;~   Bob    28
;~   Cindy  21
;~
;~    _SQLite_GetTable2dで次元が切り替えられた場合、結果は次のようになる:
;~
;~   Name  Alice  Bob  Cindy
;~   Age   43     28   21

Else
    MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
EndIf

_SQLite_Close ()
_SQLite_Shutdown ()