SQL INSERT queries

View: New views
5 Messages — Rating Filter:   Alert me  

SQL INSERT queries

by Roy Walter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are there any plans to add write capabilities to the sql module?

-- Roy

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: SQL INSERT queries

by Andrew Hart CEMS Staff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What do you mean?  insert is just an sql statement like any other isn't it?

Roy Walter wrote:

> Are there any plans to add write capabilities to the sql module?
>
> -- Roy
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open
>
>
> This incoming email to UWE has been independently scanned for viruses by McAfee anti-virus software and none were detected
>
>  



This email was independently scanned for viruses by McAfee anti-virus software and none were found
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: SQL INSERT queries

by Roy Walter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah good, so it should work then. Must be my problem.

-- Roy

Andrew Hart CEMS Staff wrote:

> What do you mean?  insert is just an sql statement like any other
> isn't it?
>
> Roy Walter wrote:
>> Are there any plans to add write capabilities to the sql module?
>>
>> -- Roy
>>
>> ------------------------------------------------------------------------------
>>
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment
>> - and focus on what you do best, core application coding. Discover
>> what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Exist-open mailing list
>> Exist-open@...
>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>
>>
>> This incoming email to UWE has been independently scanned for viruses
>> by McAfee anti-virus software and none were detected
>>
>>  
>
>
>
> This email was independently scanned for viruses by McAfee anti-virus
> software and none were found
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.424 / Virus Database: 270.14.49/2480 - Release Date: 11/04/09 07:37:00
>
>  

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: SQL INSERT queries

by Andrew Hart CEMS Staff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I do this before using the mysql database. Should be similar stuff for
other databases I assume.

declare function local:mysqlpassword($user as xs:string, $mysqlpassword
as xs:string, $create as xs:string) {
    let $connection := sql:get-connection("com.mysql.jdbc.Driver",
"jdbc:mysql://mysql5.cems.uwe.ac.uk/mysql", "root", "xxxxxxx")

    let $createstring := concat( "create database ", $user, ";")
    let $accessstring := concat( "grant select, insert, alter, update,
delete, create, drop on ", $user, ".* to '", $user,
                                  "'@'%' identified by '",
$mysqlpassword, "';")
    let $showdbstring := concat( "grant show databases on *.* to '",
$user, "'@'%' identified by '", $mysqlpassword, "';" )
               
    let $result := if ( $create = "Yes" ) then sql:execute($connection,
$createstring, fn:true()) else ()
    let $result := if ( $create = "No" ) then sql:execute($connection,
$accessstring, fn:true()) else ()
    let $result := if ( $create = "No" ) then sql:execute($connection,
$showdbstring, fn:true()) else ()
    return true()
};


Roy Walter wrote:

> Ah good, so it should work then. Must be my problem.
>
> -- Roy
>
> Andrew Hart CEMS Staff wrote:
>  
>> What do you mean?  insert is just an sql statement like any other
>> isn't it?
>>
>> Roy Walter wrote:
>>    
>>> Are there any plans to add write capabilities to the sql module?
>>>
>>> -- Roy
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day trial. Simplify your report design, integration and deployment
>>> - and focus on what you do best, core application coding. Discover
>>> what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> Exist-open mailing list
>>> Exist-open@...
>>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>>
>>>
>>> This incoming email to UWE has been independently scanned for viruses
>>> by McAfee anti-virus software and none were detected
>>>
>>>  
>>>      
>>
>> This email was independently scanned for viruses by McAfee anti-virus
>> software and none were found
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 8.5.424 / Virus Database: 270.14.49/2480 - Release Date: 11/04/09 07:37:00
>>
>>  
>>    
>
>
> This incoming email to UWE has been independently scanned for viruses by McAfee anti-virus software and none were detected
>  



This email was independently scanned for viruses by McAfee anti-virus software and none were found
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: SQL INSERT queries

by Roy Walter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Andrew. Working fine now.

-- Roy

Andrew Hart CEMS Staff wrote:

> I do this before using the mysql database. Should be similar stuff for
> other databases I assume.
>
> declare function local:mysqlpassword($user as xs:string,
> $mysqlpassword as xs:string, $create as xs:string) {
>    let $connection := sql:get-connection("com.mysql.jdbc.Driver",
> "jdbc:mysql://mysql5.cems.uwe.ac.uk/mysql", "root", "xxxxxxx")
>
>    let $createstring := concat( "create database ", $user, ";")
>    let $accessstring := concat( "grant select, insert, alter, update,
> delete, create, drop on ", $user, ".* to '", $user,
>                                  "'@'%' identified by '",
> $mysqlpassword, "';")
>    let $showdbstring := concat( "grant show databases on *.* to '",
> $user, "'@'%' identified by '", $mysqlpassword, "';" )
>                  let $result := if ( $create = "Yes" ) then
> sql:execute($connection, $createstring, fn:true()) else ()
>    let $result := if ( $create = "No" ) then sql:execute($connection,
> $accessstring, fn:true()) else ()
>    let $result := if ( $create = "No" ) then sql:execute($connection,
> $showdbstring, fn:true()) else ()
>    return true()
> };
>
>
> Roy Walter wrote:
>> Ah good, so it should work then. Must be my problem.
>>
>> -- Roy
>>
>> Andrew Hart CEMS Staff wrote:
>>  
>>> What do you mean?  insert is just an sql statement like any other
>>> isn't it?
>>>
>>> Roy Walter wrote:
>>>    
>>>> Are there any plans to add write capabilities to the sql module?
>>>>
>>>> -- Roy
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>> Let Crystal Reports handle the reporting - Free Crystal Reports
>>>> 2008 30-Day trial. Simplify your report design, integration and
>>>> deployment - and focus on what you do best, core application
>>>> coding. Discover what's new with
>>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>>> _______________________________________________
>>>> Exist-open mailing list
>>>> Exist-open@...
>>>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>>>
>>>>
>>>> This incoming email to UWE has been independently scanned for
>>>> viruses by McAfee anti-virus software and none were detected
>>>>
>>>>        
>>>
>>> This email was independently scanned for viruses by McAfee
>>> anti-virus software and none were found
>>> ------------------------------------------------------------------------
>>>
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com Version: 8.5.424 / Virus Database:
>>> 270.14.49/2480 - Release Date: 11/04/09 07:37:00
>>>
>>>      
>>
>>
>> This incoming email to UWE has been independently scanned for viruses
>> by McAfee anti-virus software and none were detected
>>  
>
>
>
> This email was independently scanned for viruses by McAfee anti-virus
> software and none were found
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.424 / Virus Database: 270.14.50/2481 - Release Date: 11/04/09 19:51:00
>
>  

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open