ストレージプロセス(SQLサンプルバージョン)
今日はあなたが理解するためのSQLストレージプロセスをお送りします
createprocedurelogin_verify
(
@community_idint、値を取得します
@usernamevarchar(20)、
@passwordvarchar(40)、
@resulttinyintoutput
))
として
setnocounton
declare@service_deadline_datesmalldateTime、@community_setting_max_online_countint - 短い日付形式で変数を定義します
@community_setting_max_online_count = community_setting_max_online_count、@service_deadline_date = service_deadline_datefromcommunity_infowherecommunity_id =@community_id-これは、ログインの最大数を見つけるためです。
ifdatediff(d、@service_deadline_date、getDate())> 10 - 実際には、これはユーザーの使用期間を制限することです。ライブラリの現在の日付と記録日が10日を超えている場合は、 @result = 11を返します
始める
@result = 11 - exexecting Service Life
戻る
終わり
if(selectcount(*)fromonline_userwhere =@community_setting_max_online_count "> community_id =@community_id)> =@community_setting_max_online_count - comparisonライブラリのレコード設定に基づいて現在の人の数と
始める
@result = 10を設定します - ex cuceed number number lime-returnを @result = 10にします
戻る
終わり
@stamiaint、@last_update_stamia_datesmalldatetime、@level_idint - define integer short date integer
declare@useridint、@user_roleint
@userid = userid、@user_role = user_role、@stamia = stamia、@last_update_stamia_date = last_update_stamia_date、@level_id = level_idfromuser_infowhereusername =@usernameandpassword =@passwordandcommunity_iduser_type
- ユーザー情報テーブルから定義された3つの変数にいくつかの情報を作成します
@useridisnotnullの場合--- @useridがnull値を変更しない場合
begin-ausnameとパスワードの検証が成功しました
@result = 1---テストは成功しました
戻る
終わり
それ以外
始める
@result = 0を設定します - 障害のあるログ
終わり
setnocountoff
行く
上記のプロセスlogin_verifyに名前を付けましょう
ASPコードでセキュリティ認証が呼び出される場所として書かれています
'' connは事前に定義されています
setcmd.activeconnection = conn
cmd.commandtext = "login_verify"
cmd.commandtype =&h0004
@community_idint、値を取得します
@usernamevarchar(20)、
@passwordvarchar(40)、
@resultint
cmd.parameters.appendcmd.createparameter( "@community_id"、3)
cmd.parameters.appendcmd.createparameter( "@username"、200)