SQLite3 ユーザ定義関数. [詳細]
Public メソッド | |
OSQLiteFunc (OSQLiteDBWrap db, ICallUserFunction iCallinterface) | |
コンストラクタ | |
void | Dispose () |
破棄 | |
ResultEnum | CreateFunction (string funcname, int inArg) |
Protected メソッド | |
unsafe delegate void | CallFuncDelegate (IntPtr context, int argc, void **inparams) |
コールバック型(マネージ) | |
unsafe delegate void | CallStepDelegate (IntPtr context, int argc, void **inparams) |
unsafe delegate void | CallFinalDelegate (IntPtr context) |
unsafe virtual void | CallFunc (IntPtr context, int argc, void **inparams) |
スカラー関数コールバック | |
unsafe virtual void | CallStep (IntPtr context, int argc, void **inparams) |
集約関数ステップコールバック | |
unsafe virtual void | CallFinal (IntPtr context) |
集約関数最終コールバック | |
unsafe object[] | CreateParams (int argc, void **inparams) |
ユーザ定義関数パラメータ作成 | |
Static Protected メソッド | |
static int | osqlite3_createfunction (IntPtr instance, string funcname, int iarg, int eTextRep, CallFuncDelegate xFunc, CallStepDelegate xStep, CallFinalDelegate xFinal) |
static int | __sqlite3_value_type (IntPtr inparam) |
static long | __sqlite3_value_int64 (IntPtr inparam) |
static double | __sqlite3_value_double (IntPtr inparam) |
static int | __sqlite3_value_bytes (IntPtr inparam) |
static IntPtr | __sqlite3_value_blob (IntPtr inparam) |
static string | __sqlite3_value_text16 (IntPtr inparam) |
static void | __sqlite3_result_int (IntPtr inparam, int val) |
static void | __sqlite3_result_int64 (IntPtr inparam, long val) |
static void | __sqlite3_result_double (IntPtr inparam, double val) |
static void | __sqlite3_result_text16 (IntPtr inparam, string val, int ilen) |
static void | __sqlite3_result_blob (IntPtr inparam, IntPtr val, int ilen) |
static void | __sqlite3_result_error16 (IntPtr inparam, string val, int ilen) |
static void | __sqlite3_result_error_toobig (IntPtr inparam) |
static void | __sqlite3_result_error_nomem (IntPtr inparam) |
static void | __sqlite3_result_error_code (IntPtr inparam, int icode) |
Protected 変数 | |
OSQLiteDBWrap | m_db |
データベース | |
ICallUserFunction | m_callinterface |
コールバックインターフェース |
SQLite3 ユーザ定義関数.
OSQLiteFunc.cs の 11 行で定義されています。
SQLiteCSLib.Inner.OSQLiteFunc.OSQLiteFunc | ( | OSQLiteDBWrap | db, | |
ICallUserFunction | iCallinterface | |||
) |
コンストラクタ
OSQLiteFunc.cs の 58 行で定義されています。
00059 { 00060 m_db = db; 00061 m_callinterface = iCallinterface; 00062 00063 unsafe 00064 { 00065 m_funcpoint = GCHandle.Alloc( new CallFuncDelegate( CallFunc ) ); 00066 m_steppoint = GCHandle.Alloc( new CallStepDelegate( CallStep ) ); 00067 m_finalpoint = GCHandle.Alloc( new CallFinalDelegate( CallFinal ) ); 00068 } 00069 00070 #if MOBILEPC 00071 m_disposeevent = CreateEvent( IntPtr.Zero , true, false, IntPtr.Zero ); 00072 #endif 00073 }
unsafe virtual void SQLiteCSLib.Inner.OSQLiteFunc.CallFinal | ( | IntPtr | context | ) | [protected, virtual] |
集約関数最終コールバック
context | コンテキスト |
OSQLiteFunc.cs の 264 行で定義されています。
00265 { 00266 IAggregateCallUserFunction iAggregate = m_callinterface as IAggregateCallUserFunction; 00267 if( iAggregate != null ) 00268 { 00269 try 00270 { 00271 object returnval = iAggregate.CallFinal(); 00272 if( returnval != null ) 00273 { 00274 SetResultValue( context, returnval ); 00275 } 00276 } 00277 catch( CallUserException ex ) 00278 { 00279 SetErrorResult( context, ex ); 00280 } 00281 } 00282 }
unsafe virtual void SQLiteCSLib.Inner.OSQLiteFunc.CallFunc | ( | IntPtr | context, | |
int | argc, | |||
void ** | inparams | |||
) | [protected, virtual] |
スカラー関数コールバック
context | コンテキスト | |
argc | 引数数 | |
inparams | 引数リスト |
OSQLiteFunc.cs の 218 行で定義されています。
00219 { 00220 IScalarCallUserFunction iScalar = m_callinterface as IScalarCallUserFunction; 00221 if( iScalar != null ) 00222 { 00223 try 00224 { 00225 object returnval = iScalar.CallFunc( CreateParams(argc,inparams) ); 00226 if( returnval != null ) 00227 { 00228 SetResultValue( context, returnval ); 00229 } 00230 } 00231 catch( CallUserException ex ) 00232 { 00233 SetErrorResult( context, ex ); 00234 } 00235 } 00236 }
unsafe delegate void SQLiteCSLib.Inner.OSQLiteFunc.CallFuncDelegate | ( | IntPtr | context, | |
int | argc, | |||
void ** | inparams | |||
) | [protected] |
コールバック型(マネージ)
unsafe virtual void SQLiteCSLib.Inner.OSQLiteFunc.CallStep | ( | IntPtr | context, | |
int | argc, | |||
void ** | inparams | |||
) | [protected, virtual] |
集約関数ステップコールバック
context | コンテキスト | |
argc | 引数数 | |
inparams | 引数リスト |
OSQLiteFunc.cs の 244 行で定義されています。
00245 { 00246 IAggregateCallUserFunction iAggregate = m_callinterface as IAggregateCallUserFunction; 00247 if( iAggregate != null ) 00248 { 00249 try 00250 { 00251 iAggregate.CallStep( CreateParams(argc,inparams) ); 00252 } 00253 catch( CallUserException ex ) 00254 { 00255 SetErrorResult( context, ex ); 00256 } 00257 } 00258 }
unsafe object [] SQLiteCSLib.Inner.OSQLiteFunc.CreateParams | ( | int | argc, | |
void ** | inparams | |||
) | [protected] |
ユーザ定義関数パラメータ作成
argc | 引数数 | |
inparams | 引数リスト |
OSQLiteFunc.cs の 339 行で定義されています。
00340 { 00341 object[] argslist = new object[argc]; 00342 00343 for( int iIdx=0; iIdx<argc; iIdx++ ) 00344 { 00345 void* val = inparams[ iIdx ]; 00346 00347 if( val != null ) 00348 { 00349 IntPtr context = new IntPtr(val); 00350 00351 DATATYPE iType = (DATATYPE)__sqlite3_value_type( context ); 00352 00353 switch( iType ) 00354 { 00355 case DATATYPE.INTEGER: 00356 argslist[ iIdx ] = __sqlite3_value_int64( context ); 00357 break; 00358 case DATATYPE.FLOAT: 00359 argslist[ iIdx ] = __sqlite3_value_double( context ) ; 00360 break; 00361 case DATATYPE.BLOB: 00362 { 00363 IntPtr pBin = __sqlite3_value_blob( context ); 00364 int valsize = __sqlite3_value_bytes( context ); 00365 00366 byte[] managememory = new byte[valsize]; 00367 Marshal.Copy( pBin, managememory, 0, valsize ); 00368 00369 argslist[ iIdx ] = managememory; 00370 } 00371 00372 break; 00373 case DATATYPE.DBNULL: 00374 argslist[ iIdx ] = null; 00375 break; 00376 case DATATYPE.TEXT: 00377 argslist[ iIdx ] = __sqlite3_value_text16( context ); 00378 break; 00379 } 00380 } 00381 } 00382 00383 return argslist; 00384 }
void SQLiteCSLib.Inner.OSQLiteFunc.Dispose | ( | ) |
破棄
OSQLiteFunc.cs の 86 行で定義されています。
00087 { 00088 #if MOBILEPC 00089 EventModify( m_disposeevent, 3 ); 00090 CloseHandle( m_disposeevent ); 00091 CloseHandle( m_clrevent ); 00092 #endif 00093 00094 if( m_db != null ) 00095 { 00096 m_funcpoint.Free(); 00097 m_steppoint.Free(); 00098 m_finalpoint.Free(); 00099 m_db = null; 00100 m_callinterface = null; 00101 } 00102 }
コールバックインターフェース
OSQLiteFunc.cs の 28 行で定義されています。
OSQLiteDBWrap SQLiteCSLib.Inner.OSQLiteFunc.m_db [protected] |
データベース
OSQLiteFunc.cs の 23 行で定義されています。