Okay, for anyone who is interested, the trick to adding and dropping tables (or 
executing any odd sql) when using sqlYoga is that you have to tell sqlYoga that 
the schema has changed. The easiest way to do that is reset the schema with 
dbschema_reset, then reconnect to the database. JUST reconnecting will NOT 
reload the schema causing you all kinds of headaches in the future. 

    dbschema_reset thePriDB
    dbconn_disconnect thePriDB
    dbconn_Connect thePriDB

I'm not sure you have to disconnect first but what the HEY! Also, any queries 
you use with sqlYoga will AUTOMATICALLY reconnect to the database. BUT if you 
are using the REV IDE to execute what I will call "foreign" queries, that is 
queries not run through sqlYoga, AND your connection has timed out, you will 
have problems, SO...

I now use dbconn_connect before executing "foreign" queries. 

    put "DROP TABLE 'myhostname'.'mytablename'" into theSQL -- foreign query
    dbconn_Connect thePriDB -- make sure we are currently connected
    put dbconn_get("connection id", theConnection, theDBObject) into theID -- 
get the current dbid
    revExecuteSQL theID, theSQL -- shoot the wild ass (just checking to see if 
you are reading the comments)

    -- now reload the schema
    dbschema_reset thePriDB -- wipes the database object clean
    dbconn_disconnect thePriDB -- may not need to do this...
    dbconn_Connect thePriDB  -- this will reload the schema
    dbobject_save thePriDB -- ALWAYS SAVE YOUR OBJECTS!

This will refresh the connection id before you execute the query and all will 
proceed famously. 

Problem solved. 

Bob


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to