Re: Swedish letters fuck up parsing into SQL querry

2020-03-24 Thread Anders S via Digitalmars-d-learn
On Tuesday, 24 March 2020 at 14:10:19 UTC, WebFreak001 wrote: On Tuesday, 24 March 2020 at 11:15:24 UTC, matheus wrote: On Monday, 23 March 2020 at 15:41:50 UTC, Adam D. Ruppe wrote: On Monday, 23 March 2020 at 15:15:12 UTC, Anders S wrote: I'm creating a connection to the db and

Re: Swedish letters fuck up parsing into SQL querry

2020-03-23 Thread Anders S via Digitalmars-d-learn
On Monday, 23 March 2020 at 15:07:31 UTC, Adam D. Ruppe wrote: On Monday, 23 March 2020 at 14:26:46 UTC, Anders S wrote: do you mean I should loop through each pos till strlen(cellTab[CellIndex].name) to find "\0"? strlen is ok, that gives the answer itself. Just slice to that.

Re: Swedish letters fuck up parsing into SQL querry

2020-03-23 Thread Anders S via Digitalmars-d-learn
On Monday, 23 March 2020 at 14:58:03 UTC, bauss wrote: On Monday, 23 March 2020 at 14:26:46 UTC, Anders S wrote: On Monday, 23 March 2020 at 13:53:50 UTC, Adam D. Ruppe wrote: My first thought is to!string(cellTab[CellIndex].name) is wrong, if it is a char[20] you should be scanning it to find

Re: Swedish letters fuck up parsing into SQL querry

2020-03-23 Thread Anders S via Digitalmars-d-learn
On Monday, 23 March 2020 at 13:53:50 UTC, Adam D. Ruppe wrote: My first thought is to!string(cellTab[CellIndex].name) is wrong, if it is a char[20] you should be scanning it to find the length and slicing. Maybe [0 .. name.indexOf("\0")] or whatever. You also shouldn't be building a query by

Swedish letters fuck up parsing into SQL querry

2020-03-23 Thread Anders S via Digitalmars-d-learn
Hi guys, I'm trying to read a name from a struct iorequest where the name is char name[20] The struct is received through a FIFO pipe and message is going into a mysql database to update specific post there. Now my problem is that all works fine to read and stop with '\0' termination till

Re: How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Anders S via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:30:50 UTC, Jani Hur wrote: On Tuesday, 27 August 2019 at 08:08:05 UTC, Anders S wrote: Any ideas? + is not a string concatenation. Try ~ instead: auto x = "aa" ~ "bb" ~ "cc"; Hi again, the auto declaration worked as I expected my catenations should with

Re: How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Anders S via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:30:50 UTC, Jani Hur wrote: On Tuesday, 27 August 2019 at 08:08:05 UTC, Anders S wrote: Any ideas? + is not a string concatenation. Try ~ instead: auto x = "aa" ~ "bb" ~ "cc"; Hi thanks for answer, but didn't help. Got this error instead : Error: cannot

How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Anders S via Digitalmars-d-learn
Hi guys, Using MariaDB to communicate between appz via FIFO pipe Now I stumbled on the next problem, how to extract UUID from database into an UPDATE query that is a string ( the sql variable ). Got in a loop: char [16][10] hash; for(i =0; i < count; i++){ auto hash1 = row[0]; hash[i] =

Re: How do I extract and convert datatypes from ResultRange

2019-08-26 Thread Anders S via Digitalmars-d-learn
On Monday, 26 August 2019 at 13:58:34 UTC, Olivier Pisano wrote: On Monday, 26 August 2019 at 13:49:21 UTC, Anders S wrote: [...] I don't have a compiler accessible right now, but according to https://dlang.org/phobos/std_variant.html : int i; if (row[2].peek!int !is null)

How do I extract and convert datatypes from ResultRange

2019-08-26 Thread Anders S via Digitalmars-d-learn
Hi guys, I'm trying to read a post of different datatypes from MariaDB table into another message and pass it on into a FIFO pipe to an other application. My code : string sql = "SELECT * FROM guirequest WHERE read_request = -1;"; ResultRange range = conn.query(sql); Row row =

Re: How do I execute a sql-file inside D code

2019-08-26 Thread Anders S via Digitalmars-d-learn
On Tuesday, 20 August 2019 at 13:10:55 UTC, Andre Pany wrote: On Tuesday, 20 August 2019 at 11:33:33 UTC, Anders S wrote: I'm creating an application that connect to a database and write data from another application. Now when I start the application I want it to check if the database exists

Re: How do I execute a sql-file inside D code

2019-08-26 Thread Anders S via Digitalmars-d-learn
On Thursday, 22 August 2019 at 13:39:00 UTC, XavierAP wrote: On Tuesday, 20 August 2019 at 11:33:33 UTC, Anders S wrote: Use this code to check conn.exec("CREATE DATABASE IF NOT EXISTS boxweb;"); however haven't found a way to run the sql file that create the tables. The file is in the

How do I execute a sql-file inside D code

2019-08-20 Thread Anders S via Digitalmars-d-learn
I'm creating an application that connect to a database and write data from another application. Now when I start the application I want it to check if the database exists and if not create the database and it's tables. I have everything working IF the database and tables exist. Use this code

Re: not callable error

2016-12-16 Thread Anders S via Digitalmars-d-learn
On Friday, 4 November 2016 at 23:26:40 UTC, lobo wrote: On Friday, 4 November 2016 at 14:37:04 UTC, bluphantom91 wrote: On Friday, 4 November 2016 at 02:59:49 UTC, Paul Backus wrote: On Friday, 4 November 2016 at 02:28:17 UTC, bluphantom91 wrote: Hello, Am I just using getc the wrong

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Anders S via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 13:47:06 UTC, Anders S wrote: On Wednesday, 30 November 2016 at 12:41:24 UTC, Stefan Koch wrote: On Wednesday, 30 November 2016 at 10:20:35 UTC, Anders S wrote: int [1] argv; /* list of arguments */ Is that supposed to be a VLAIS ?

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Anders S via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 12:41:24 UTC, Stefan Koch wrote: On Wednesday, 30 November 2016 at 10:20:35 UTC, Anders S wrote: int [1] argv; /* list of arguments */ Is that supposed to be a VLAIS ? That will not port to D. It would be helpful If you could share

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Anders S via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 07:16:38 UTC, Anders S wrote: On Tuesday, 29 November 2016 at 23:33:19 UTC, Ali Çehreli wrote: On 11/29/2016 07:30 AM, Anders S wrote: Ali Thanks you all guys, and the cast (IOREQ *) ... did the trick!! I'll have a look at your other comments aswell

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-29 Thread Anders S via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 23:33:19 UTC, Ali Çehreli wrote: On 11/29/2016 07:30 AM, Anders S wrote: > INTargv[1];/* list of arguments */ In addition to what Nemanja Boric wrote, the recommended array syntax in D is the following: INT[1] argv; > char sbuf[1024]; >

Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-29 Thread Anders S via Digitalmars-d-learn
Hi guys, I want to write into a fifo pipe using write( ...) Now a gather my data into my own struct IOREQ so in order to write I have to cast into an char buffer. My problem in dlang is that it doesn't accept the casting (IOREQ *) I get: Error: Cannot implicitly convert expression () of type

Re: How can I concatenate a string, a char array and an int

2016-11-29 Thread Anders S via Digitalmars-d-learn
Thanks guys for a really quick answer !! OK, a little bit awkward to use but getting there posting a new question about char * to struct ;) Thanks /anders

How can I concatenate a string, a char array and an int

2016-11-29 Thread Anders S via Digitalmars-d-learn
Hi guys, just started to get into Dlang, comming from C and C++ I like to use methods like there if possible. Now I want to catenate something like this, but don't get it to work in standard C i code: char str[80]; sprintf(str, "This is a number = %f", 3.14356); Now in Dlang and