home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
MySQL option
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="blaudden" data-source="post: 111294" data-attributes="member: 26996"><p>Will just reply one more thing to myself tonight.</p><p></p><p>Looked in the Gentle.NET Framework and in PersistenceBroker I find the below code indicating unless either "con" or "tr" is passed to Retrieve it will create a new connection to the database engine for each retrieve. If that could be avoided I'm sure the perfomance would be improved - maybe for all database engines. But it could be that MSSQL is using client side connection pooling and has no need to run those initial queries?</p><p></p><p>Just need to find the place in TvServer code where this is called. Or is this something explicitly handled by the FrameWork?</p><p><span style="font-family: 'Courier New'"></span></p><p><span style="font-family: 'Courier New'">/// <summary></span></p><p><span style="font-family: 'Courier New'">/// Retrieve data for the specified type. Throws an exception for unsupported types.</span></p><p><span style="font-family: 'Courier New'">/// </summary></span></p><p><span style="font-family: 'Courier New'">/// <param name="type">The type of object</param></span></p><p><span style="font-family: 'Courier New'">/// <param name="key">The key indentifying the object</param></span></p><p><span style="font-family: 'Courier New'">/// <param name="conn">An existing database connection to reuse. This is useful</span></p><p><span style="font-family: 'Courier New'">/// when you need to execute statements in the same session as a previous statement.</param></span></p><p><span style="font-family: 'Courier New'">/// <param name="tr">The database transaction for when participating in transactions.</param></span></p><p><span style="font-family: 'Courier New'">/// <returns>An SqlResult containing the returned rows and helper methods</returns></span></p><p><span style="font-family: 'Courier New'">public SqlResult Retrieve( Type type, Key key, IDbConnection conn, IDbTransaction tr )</span></p><p><span style="font-family: 'Courier New'">{</span></p><p><span style="font-family: 'Courier New'"> SqlStatement stmt = GetRetrieveStatement( type, key );</span></p><p><span style="font-family: 'Courier New'"> // connections are supplied from outside when in a transaction or executing batch queries</span></p><p><span style="font-family: 'Courier New'"> conn = tr != null ? tr.Connection : ( conn != null ? conn : stmt.SessionBroker.Provider.GetConnection() ); </span></p><p><span style="font-family: 'Courier New'"> SqlResult sr = stmt.Execute( conn, tr );</span></p><p><span style="font-family: 'Courier New'"> // require that operation succeeded and a valid result</span></p><p><span style="font-family: 'Courier New'"> if( IsPrimaryKeyForType( type, key ) )</span></p><p><span style="font-family: 'Courier New'"> {</span></p><p><span style="font-family: 'Courier New'"> Check.Verify( sr.ErrorCode == 0, Error.NoSuchRecord, type, key, sr.Error );</span></p><p><span style="font-family: 'Courier New'"> Check.Verify( sr.RowsContained == 1, Error.UnexpectedRowCount, sr.RowsContained, 1 );</span></p><p><span style="font-family: 'Courier New'"> }</span></p><p><span style="font-family: 'Courier New'"> return sr;</span></p><p><span style="font-family: 'Courier New'">}</span></p></blockquote><p></p>
[QUOTE="blaudden, post: 111294, member: 26996"] Will just reply one more thing to myself tonight. Looked in the Gentle.NET Framework and in PersistenceBroker I find the below code indicating unless either "con" or "tr" is passed to Retrieve it will create a new connection to the database engine for each retrieve. If that could be avoided I'm sure the perfomance would be improved - maybe for all database engines. But it could be that MSSQL is using client side connection pooling and has no need to run those initial queries? Just need to find the place in TvServer code where this is called. Or is this something explicitly handled by the FrameWork? [FONT="Courier New"] /// <summary> /// Retrieve data for the specified type. Throws an exception for unsupported types. /// </summary> /// <param name="type">The type of object</param> /// <param name="key">The key indentifying the object</param> /// <param name="conn">An existing database connection to reuse. This is useful /// when you need to execute statements in the same session as a previous statement.</param> /// <param name="tr">The database transaction for when participating in transactions.</param> /// <returns>An SqlResult containing the returned rows and helper methods</returns> public SqlResult Retrieve( Type type, Key key, IDbConnection conn, IDbTransaction tr ) { SqlStatement stmt = GetRetrieveStatement( type, key ); // connections are supplied from outside when in a transaction or executing batch queries conn = tr != null ? tr.Connection : ( conn != null ? conn : stmt.SessionBroker.Provider.GetConnection() ); SqlResult sr = stmt.Execute( conn, tr ); // require that operation succeeded and a valid result if( IsPrimaryKeyForType( type, key ) ) { Check.Verify( sr.ErrorCode == 0, Error.NoSuchRecord, type, key, sr.Error ); Check.Verify( sr.RowsContained == 1, Error.UnexpectedRowCount, sr.RowsContained, 1 ); } return sr; }[/FONT] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
MySQL option
Contact us
RSS
Top
Bottom