Help with Garage and sanitized strings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with Garage and sanitized strings

CdAB63
By the way, the following script fails with the same Exception
(mysql_stmt_send_long_data):

| db str sttmt |

     db := GADriver
                 connectToConnectionString:
'mysql://localhost:3306/leaincertezas?user=learoot&password=welcomeLEA'.

     str := 'INSERT INTO chaves_de_encriptacao (numero_funcional,
chave_privada, chave_publica) VALUES (''?'', ''?'', ''?'')'.

     sttmt := db prepare: str.
     sttmt at: 1 bind: '10'.
     sttmt at: 2 bind: '0BC0DE0FG32A128AB2EF01'.
     sttmt at: 3 bind: 'BEC0D01279F92123FAB2E0'.

     sttmt execute.

     db close.

But the script:

| db str sttmt |

     db := GADriver
                 connectToConnectionString:
'mysql://localhost:3306/leaincertezas?user=learoot&password=welcomeLEA'.

     str := 'INSERT INTO chaves_de_encriptacao (numero_funcional,
chave_privada, chave_publica) VALUES (''10'',
''0BC0DE0FG32A128AB2EF01'', ''0BC0DE0FG32A128AB2EF01'')'.

     db execute: str.

     db close.

Results:

MariaDB [leaincertezas]> SELECT * FROM chaves_de_encriptacao;
+------------------+------------------------+------------------------+
| numero_funcional | chave_privada          | chave_publica          |
+------------------+------------------------+------------------------+
|               10 | 0BC0DE0FG32A128AB2EF01 | 0BC0DE0FG32A128AB2EF01 |
+------------------+------------------------+------------------------+
1 row in set (0.00 sec)


Reply | Threaded
Open this post in threaded view
|

Re: Help with Garage and sanitized strings

CdAB63
Problem solved. Question marks shouldn´t be inside apostrophes

'SELECT * FROM chaves_de_encriptacao WHERE numero_funcional = ?'

and not:

'SELECT * FROM chaves_de_encriptacao WHERE numero_funcional = ''?'''


2017-09-18 20:11 GMT-03:00 Casimiro de Almeida Barreto <[hidden email]>:
By the way, the following script fails with the same Exception (mysql_stmt_send_long_data):

| db str sttmt |

    db := GADriver
                connectToConnectionString:
'mysql://localhost:3306/leaincertezas?user=learoot&password=welcomeLEA'.

    str := 'INSERT INTO chaves_de_encriptacao (numero_funcional, chave_privada, chave_publica) VALUES (''?'', ''?'', ''?'')'.

    sttmt := db prepare: str.
    sttmt at: 1 bind: '10'.
    sttmt at: 2 bind: '0BC0DE0FG32A128AB2EF01'.
    sttmt at: 3 bind: 'BEC0D01279F92123FAB2E0'.

    sttmt execute.

    db close.

But the script:

| db str sttmt |

    db := GADriver
                connectToConnectionString:
'mysql://localhost:3306/leaincertezas?user=learoot&password=welcomeLEA'.

    str := 'INSERT INTO chaves_de_encriptacao (numero_funcional, chave_privada, chave_publica) VALUES (''10'', ''0BC0DE0FG32A128AB2EF01'', ''0BC0DE0FG32A128AB2EF01'')'.

    db execute: str.

    db close.

Results:

MariaDB [leaincertezas]> SELECT * FROM chaves_de_encriptacao;
+------------------+------------------------+------------------------+
| numero_funcional | chave_privada          | chave_publica          |
+------------------+------------------------+------------------------+
|               10 | 0BC0DE0FG32A128AB2EF01 | 0BC0DE0FG32A128AB2EF01 |
+------------------+------------------------+------------------------+
1 row in set (0.00 sec)




--
The information contained in this message is confidential and
intended to the recipients specified in the headers. If you received
this message by error, notify the sender immediately. The
unauthorized use, disclosure, copy or alteration of this message
are strictly forbidden and subjected to civil and criminal sanctions.