<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:courier,monaco,monospace,sans-serif;font-size:12pt">is there some universal ansi sql stmt that is small and harmless<br>but is supported by everything? to replace "select 1"<br><br><br><div> </div><div>Anthony Minessale II<br><br><span>FreeSWITCH <a target="_blank" href="http://www.freeswitch.org/">http://www.freeswitch.org/</a></span><br><span>ClueCon <a target="_blank" href="http://www.cluecon.com/">http://www.cluecon.com/</a></span><br><br>AIM: anthm<br>MSN:anthony_minessale@hotmail.com<br>GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<br>IRC: irc.freenode.net #freeswitch</div><div><br>FreeSWITCH Developer Conference<br>sip:888@conference.freeswitch.org<br>iax:guest@conference.freeswitch.org/888<br>googletalk:conf+888@conference.freeswitch.org<br>pstn:213-799-1400</div><div style="font-family: courier,monaco,monospace,sans-serif; font-size:
12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: David Revill <davidrevill@datarun.co.uk><br>To: freeswitch-users@lists.freeswitch.org<br>Sent: Tuesday, February 19, 2008 6:56:31 AM<br>Subject: Re: [Freeswitch-users] Spidermonkey ODBC<br><br>
<style></style>
<div><font face="Arial" size="2">One way to detect firebird would be to put the
'Select first 1 * from RDB$relations' into switch_odbc_handle_connect. If
it succeeds then it is Firebird. A better query might be 'select * from
rdb$database' as the system table rdb$database only ever has 1
record.</font></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
<a rel="nofollow" title="jonas.gauffin@gmail.com" ymailto="mailto:jonas.gauffin@gmail.com" target="_blank" href="mailto:jonas.gauffin@gmail.com">Jonas
Gauffin</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a rel="nofollow" title="freeswitch-users@lists.freeswitch.org" ymailto="mailto:freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>
</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Tuesday, February 19, 2008 12:18
PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> Re: [Freeswitch-users]
Spidermonkey ODBC</div>
<div><br></div>I''ve only tested it with firebird on windows. As you said,
your driver name doesnt match any of the names I used to detect if it's
firebird.<br><br>The problem is that most databases supports "SELECT 1" as a
query. It will always be successful if the the connection is up. However,
firebird did not support "SELECT 1" and therefore i did query the system
database instead.<br><br>If the firebird check fails, it will try to invoke
"SELECT 1", and on firebird that query will fail. And the failure is
interpreted as the connection is down, and therefore it tries to
reconnect.<br><br>That's probably why you get that error. If you have any
other idea on how I can detect if it's a firebird db, please let me know and
i'll fix the odbc code.<br><br>
<div class="gmail_quote">On Feb 19, 2008 1:05 PM, David Revill <<a rel="nofollow" ymailto="mailto:davidrevill@datarun.co.uk" target="_blank" href="mailto:davidrevill@datarun.co.uk">davidrevill@datarun.co.uk</a>>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div><font face="Arial" size="2">That's a fair point, but db_is_up is only
called in 2 places and the attempted re-connect could be done if the exec'd
query fails. That way it would not be dependant on the name of the
driver.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">In my application, the database was queried at
the beginning of the script and the connection closed. It was explicitly
re-connected at the end to post data, so the connection timeout was not an
issue.</font></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div class="Ih2E3d">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
<a rel="nofollow" title="jonas.gauffin@gmail.com" ymailto="mailto:jonas.gauffin@gmail.com" target="_blank" href="mailto:jonas.gauffin@gmail.com">Jonas Gauffin</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a rel="nofollow" title="freeswitch-users@lists.freeswitch.org" ymailto="mailto:freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a> </div></div>
<div>
<div></div>
<div class="Wj3C7c">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Tuesday, February 19, 2008 10:35 AM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b>
Re: [Freeswitch-users] Spidermonkey ODBC</div>
<div><br></div>I did that code a couple of months ago.<br>The function was
added since connections are closed if they are idle too long, and they
were not reconnected again if that happened.<br><br><br>
<div class="gmail_quote">On Feb 19, 2008 11:22 AM, David Revill <<a rel="nofollow" ymailto="mailto:davidrevill@datarun.co.uk" target="_blank" href="mailto:davidrevill@datarun.co.uk">davidrevill@datarun.co.uk</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div><font face="Arial" size="2">The problem is in switch_odbc.c function
db_is_up. It assumes that the variable is_firebird is true, but the
setting of this variable assumes that the Firebird driver name has
'FIREBIRD', 'FB64' or 'FB32' in it.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">I commented out the code in
db_is_up and just returned a true value, as on closer inspection
could not see the point of this function.</font></div><font color="#888888">
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">David Revill</font></div></font>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
<a rel="nofollow" title="davidrevill@datarun.co.uk" ymailto="mailto:davidrevill@datarun.co.uk" target="_blank" href="mailto:davidrevill@datarun.co.uk">David Revill</a>
</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a rel="nofollow" title="freeswitch-users@lists.freeswitch.org" ymailto="mailto:freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a> </div></div>
<div>
<div></div>
<div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Tuesday, February 19, 2008 8:58 AM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b>
Re: [Freeswitch-users] Spidermonkey ODBC</div>
<div><br></div>
<div><font face="Arial" size="2">I spotted this error a few months ago,
and to my shame did not let everyone know. I have since archived
the project so cannot point you to the actual code. However, the
problem is that it assumes the name of the Firebird Driver
(FB64?) to set a boolean, so that it handle the connection test
differently.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">When looking at the actual code, I
actually felt that the connection test was redundant, as all it did
was a select from a system table. This meant it was doing two queries
for everyone required. (One to see if it could do a query, and then
one to do it). I therefore commented the connection test function
out.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">regards</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">David Revill</font></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
<a rel="nofollow" title="steven.brown@justfone.com" ymailto="mailto:steven.brown@justfone.com" target="_blank" href="mailto:steven.brown@justfone.com">Steven
Brown</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a rel="nofollow" title="freeswitch-users@lists.freeswitch.org" ymailto="mailto:freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Monday, February 18, 2008 11:34 PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b>
[Freeswitch-users] Spidermonkey ODBC</div>
<div><br></div>
<div><font color="#000000" face="Arial" size="2">Hi,</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">I'm experimenting with
spidermonkey for JavaScript call control, the basics seem fine
and I'm now trying to connect to an existing Firebird database, the
Firebird odbc lib is installed ok as is unixODBC and I can confirm
this and access the db no problem with isql, something strange
happens though when I connect in spidermonkey, basically the odbc
connection is made successfully, but then as soon as I call either
exec or query the odbc connection starts to drop and re-connect
continuously, </font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">the isql output is below </font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">isql -v
test<br>+---------------------------------------+<br>|
Connected!
|<br>|
|<br>|
sql-statement
|<br>| help
[tablename]
|<br>|
quit
|<br>|
|<br>+---------------------------------------+<br>SQL> select
first 1 * from
pool_phones<br>+---------------------+------------+<br>|
GSMNO
| ORGNO
|<br>+---------------------+------------+<br>|
0712345678 |
1
|<br>+---------------------+------------+<br>SQLRowCount returns
1<br>1 rows fetched<br>SQL><br></font></div>
<div><font face="Arial" size="2">however the following test code calling
the same query</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">use("ODBC");</font></div>
<div><font face="Arial" size="2">var db = new
ODBC("test","SYSDBA","masterkey");<br>db.connect();<br>db.query("select
first 1 * from pool_phones");</font></div>
<div><font face="Arial" size="2">db.nextRow();</font></div>
<div><font face="Arial" size="2">row =
db.getData();<br>console_log("INFO","HELLO " + row["GSMNO"]
+ "\n");</font></div>
<div><font face="Arial" size="2">exit();</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">gives the following output and then
just loops disconnecting and reconnecting until I shutdown
freeswitch<br></font></div>
<div><font face="Arial" size="2">2008-02-18 23:26:03 [DEBUG]
switch_core_state_machine.c:144 switch_core_standard_on_execute()
</font><a rel="nofollow" ymailto="mailto:sofia/default/1000@192.168.0.7:5060" target="_blank" href="mailto:sofia/default/1000@192.168.0.7:5060"><font face="Arial" size="2">sofia/default/1000@192.168.0.7:5060</font></a><font face="Arial" size="2"> Execute
javascript(/usr/scripts/test1.js)<br>2008-02-18 23:26:03 [DEBUG]
mod_spidermonkey.c:3150 js_api_use() Loading ODBC<br>2008-02-18
23:26:03 [DEBUG] switch_odbc.c:145 switch_odbc_handle_connect()
Connecting test<br>2008-02-18 23:26:03 [DEBUG] switch_odbc.c:174
switch_odbc_handle_connect() Connected to [test]<br>2008-02-18
23:26:03 [DEBUG] switch_odbc.c:95 switch_odbc_handle_disconnect()
Disconnected 0 from [test]<br>2008-02-18 23:26:03 [DEBUG]
switch_odbc.c:142 switch_odbc_handle_connect() Re-connecting
test<br>2008-02-18 23:26:03 [DEBUG] switch_odbc.c:145
switch_odbc_handle_connect() Connecting test<br>2008-02-18 23:26:03
[DEBUG] switch_odbc.c:174 switch_odbc_handle_connect() Connected to
[test]<br>2008-02-18 23:26:03 [CRIT] switch_odbc.c:234 db_is_up()
The sql server is not responding for DSN test []<br>2008-02-18
23:26:03 [INFO] switch_odbc.c:239 db_is_up() The connection has been
re-established</font></div>
<div><font face="Arial" size="2">...</font></div>
<p><font face="Arial" size="2">Any ideas much appreciated</font></p>
<p><font face="Arial" size="2">Thanks</font></p>
<p><font face="Arial" size="2">Steve</font></p>
<p><font face="Arial" size="2"></font> </p>
<p><font face="Arial" size="2"></font> </p>
<p><font face="Arial" size="2"></font> </p>
<p><font face="Arial" size="2"></font> </p>
<div><br><br></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<p></p>
<SPAN style="width:100%;height:2px;border-bottom:1px solid rgb(212,208,200); border-top:1px solid rgb(128,128,128);background-color:black;overflow:hidden; margin:8px 0px;"></SPAN>
<p></p>_______________________________________________<br>Freeswitch-users
mailing list<br><a rel="nofollow" ymailto="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a rel="nofollow" target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></blockquote>
<p></p>
<SPAN style="width:100%;height:2px;border-bottom:1px solid rgb(212,208,200); border-top:1px solid rgb(128,128,128);background-color:black;overflow:hidden; margin:8px 0px;"></SPAN>
<p></p>_______________________________________________<br>Freeswitch-users
mailing list<br><a rel="nofollow" ymailto="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a rel="nofollow" target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></div></div></blockquote></div><br>_______________________________________________<br>Freeswitch-users
mailing list<br><a rel="nofollow" ymailto="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a rel="nofollow" target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br><br></blockquote></div><br></div></div>
<p></p>
<SPAN style="width:100%;height:2px;border-bottom:1px solid rgb(212,208,200); border-top:1px solid rgb(128,128,128);background-color:black;overflow:hidden; margin:8px 0px;"></SPAN>
<div class="Ih2E3d">
<p></p>_______________________________________________<br>Freeswitch-users
mailing list<br><a rel="nofollow" ymailto="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a rel="nofollow" target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></div></blockquote></div><br>_______________________________________________<br>Freeswitch-users
mailing list<br><a rel="nofollow" ymailto="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a rel="nofollow" target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a rel="nofollow" target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br><br></blockquote></div><br>
<p>
</p><SPAN style="width:100%;height:2px;border-bottom:1px solid rgb(212,208,200); border-top:1px solid rgb(128,128,128);background-color:black;overflow:hidden; margin:8px 0px;"></SPAN>
<p></p>_______________________________________________<br>Freeswitch-users
mailing
list<br>Freeswitch-users@lists.freeswitch.org<br><a target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></blockquote><!-- kill --><div><br><br>-----Inline Attachment Follows-----<br><br>_______________________________________________<br>Freeswitch-users
mailing
list<br><a ymailto="mailto:Freeswitch-users@lists.freeswitch.org" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></div></div><br></div></div><br>
<hr size=1>Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. <a href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ "> Try it now.</a></body></html>