Maria DB服务器

时间:2018-12-01 06:45:39

标签: mysql mariadb mysql-workbench

我在错误中指出:

  

错误代码1064:您的sqlsyntax错误;检查与您的MariaDB Server语法相对应的手册以使用正确的语法

Private Const MS_DEF_PROV = "Microsoft Base Cryptographic Provider v1.0"
Private Const PROV_RSA_FULL = 1
Private Const ALG_CLASS_DATA_ENCRYPT = 24576
Private Const ALG_CLASS_HASH = 32768

Private Const ALG_TYPE_ANY = 0
Private Const ALG_TYPE_BLOCK = 1536
Private Const ALG_TYPE_STREAM = 2048

Private Const ALG_SID_RC2 = 2

Private Const ALG_SID_RC4 = 1
Private Const ALG_SID_MD5 = 3
Private Const CALG_MD5 = ((ALG_CLASS_HASH Or ALG_TYPE_ANY) Or ALG_SID_MD5)
Private Const CALG_RC2 = ((ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_BLOCK) Or ALG_SID_RC2)
Private Const CALG_RC4 = ((ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_STREAM) Or ALG_SID_RC4)

Private Const ENCRYPT_ALGORITHM = CALG_RC4
Private Const ENCRYPT_BLOCK_SIZE = 1

Private Const CRYPT_EXPORTABLE = 1

Dim lHHash As Long
Dim lHkey As Long
Dim lResult As Long
Dim lHExchgKey As Long
Dim lHCryptprov As Long

Dim sContainer As String
Dim lCryptLength As Long
Dim lCryptBufLen As Long
Dim sCryptBuffer As String

On Error GoTo EncryptError

Dim sOutputBuffer As String

Dim sProvider

sOutputBuffer = ""
'Get handle to the default CSP
sProvider = MS_DEF_PROV & vbNullChar

If Len(PlainText) = 0 Then
    DoCryptoEncrypt = ""
    Exit Function
End If
If Not CBool(CryptAcquireContext(lHCryptprov, ByVal _
            sContainer, ByVal sProvider, PROV_RSA_FULL, 0)) Then
        ' If there is no default key container then create one
        ' using Flags field
        If GetLastError = 0 Then
        If Not CBool(CryptAcquireContext(lHCryptprov, 0&, ByVal sProvider, PROV_RSA_FULL, CRYPT_NEWKEYSET)) Then
            sOutputBuffer = PlainText
            GoTo Finished
        End If
    End If
End If

'Create a hash object
If Not CBool(CryptCreateHash(lHCryptprov, CALG_MD5, 0, _
        0, lHHash)) Then
    GoTo Finished
End If

'Hash in the password text
If Not CBool(CryptHashData(lHHash, sPassword, _
        Len(sPassword), 0)) Then
    GoTo Finished
End If

'Create a session key from the hash object.
If Not CBool(CryptDeriveKey(lHCryptprov, _
        ENCRYPT_ALGORITHM, lHHash, 0, lHkey)) Then
    GoTo Finished
End If

'Destroy the hash object.
CryptDestroyHash (lHHash)
lHHash = 0

'Create a buffer for the CryptEncrypt function
lCryptLength = Len(PlainText)
lCryptBufLen = lCryptLength * 2
sCryptBuffer = String(lCryptBufLen, vbNullChar)
LSet sCryptBuffer = PlainText

'Encrypt the text data
If Not CBool(CryptEncrypt(lHkey, 0, 1, 0, sCryptBuffer, _
    lCryptLength, lCryptBufLen)) Then
End If

1 个答案:

答案 0 :(得分:0)

使用`代替'(单引号)

您应该这样写:

    CREATE TABLE `company`.`employee`(
      `fname` VARCHAR (10) NOT NULL,
      `mname` VARCHAR(2) NULL,
      `lname` VARCHAR(10) NOT NULL,
      `ssn` CHAR(9) NOT NULL,
      `bdate` DATE,
      `address` VARCHAR(20) NOT NULL,
      `sex` CHAR NULL,
      `salary` DECIMAL (10, 2) NULL,
      `super_ssn` CHAR(9) NULL,
      `d_no` INT NOT NULL,
      PRIMARY KEY (`ssn`)
    );

实际上,`符号是可选的,但是如果字段名称,表或数据库与关键字或MySQL子句相同,则其目的是使MySQL与查询中的含义不混淆。

>

例如:

SELECT column FROM `char`

我使用`符号,因为表名与MySQL上的关键字相同,即CHAR()(但是这样命名是一种不好的方式),因此请记住,如果编写SQL查询您必须决定使用`符号

希望这可以为您提供帮助。