gustafn
committed
on 17 Dec 18
db_handle reform

Use "ns_db currenthandles" (when available) to implement "db_with_handle"
instead of the old approach based on the global … Show more
db_handle reform

Use "ns_db currenthandles" (when available) to implement "db_with_handle"

instead of the old approach based on the global db_state variables.

The enws approach has the advantantge that it is

- more robust (deletion and creation of the per-request variables,

  no coherency problem),

- simpler, and

- faster (less overhead per db_with_handle call, simple queries up to 20% faster)

    time {db_string . {select object_id from acs_objects limit 1}} 1000

    old: 200-230 microseconds per iteration

    new: 160-180 microseconds per iteration

Show less

openacs-4/.../directory/www/index.adp (+1 -1)
54 54   <td align="center">
55 55
56 56     <table border="0" cellpadding="0" cellspacing="0" width="100%">
57 57      <tr>
58 58       <td class="HighlightColor">
59 59         <table border="0" cellpadding="3" cellspacing="1" align="center" width="100%">
60 60           @row_range_html;noquote@
61 61          <tr class="HighlightColor">
62 62           <th>@name_header;noquote@</th>
63 63           <th>@email_header;noquote@</th>
64 64          </tr>
65 65
66 66     <multiple name="all_user_data">
67 67      <if @all_user_data.rownum@ odd>
68 68        <tr class="RowColorOdd">
69 69      </if>
70 70      <else>
71 71        <tr class="RowColorEven">
72 72      </else>
73 73         <td width="50%"><a href="@all_user_data.member_url@">@all_user_data.last_name@, @all_user_data.first_names@</a></td>
74           <if @registered_user_p@>
  74         <if @registered_user_p;literal@ true>
75 75         <td width="50%"><a href="mailto:@all_user_data.email@">@all_user_data.email@</a></td>
76 76         </if>
77 77         <else>
78 78         <td width="50%">@all_user_data.email_partial@</td>
79 79         </else>
80 80        </tr>
81 81     </multiple>
82 82
83 83         </table>
84 84       </td>
85 85      </tr>
86 86     </table>
87 87
88 88   </td>
89 89  </tr>
90 90 </table>
91 91 </if>
92 92